-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Description
Given a Java project with org.eclipse.osgi in the classpath and the following files:
Test.java
package test;
public class Test {
String A = Messages.Test_0;
String B = "B";
}Messages.java
package test;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = Messages.class.getPackageName() + ".messages"; //$NON-NLS-1$
public static String Test_0;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}messages.properties
Test_0=A
When opening the wizard and switching to the second page, following exception is logged, preventing me from finishing the operation:
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
at org.eclipse.jdt.internal.corext.refactoring.nls.PropertyFileDocumentModel.escape(PropertyFileDocumentModel.java:217)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSPropertyFileModifier.addReplaceEdits(NLSPropertyFileModifier.java:186)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSPropertyFileModifier.addChanges(NLSPropertyFileModifier.java:119)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSPropertyFileModifier.create(NLSPropertyFileModifier.java:79)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring.createChange(NLSRefactoring.java:247)
at org.eclipse.ltk.core.refactoring.CreateChangeOperation.run(CreateChangeOperation.java:119)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2505)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:2533)
at org.eclipse.ltk.internal.ui.refactoring.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:90)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:123)
The problem seems to be that the wizard includes the already externalized Test_0 entry without loading its value.
The value is also explicitly hidden from the viewer. So I would expect it to be ignored. Though it only disappears when changing the accessor class.

Metadata
Metadata
Assignees
Labels
No labels