Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Externalize Strings Dialog] StringIndexOutOfBoundsException #219

Open
2 tasks done
wolfgang-ch opened this issue Aug 1, 2024 · 0 comments
Open
2 tasks done

[Externalize Strings Dialog] StringIndexOutOfBoundsException #219

wolfgang-ch opened this issue Aug 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@wolfgang-ch
Copy link

wolfgang-ch commented Aug 1, 2024

Let's make sure issue is not already fixed in latest builds first.

Steps to reproduce

Open the "Externalize Strings..." dialog with this simple class

public class NLTest {

   public static final String SYMBOL_AMPERSAND = "&";  //$NON-NLS-1$
   public static final String SYMBOL_QUOTA     = "\""; //$NON-NLS-1$
}

I expected: The NLS dialog should open

But got: The NLS dialog did not opened

With this workaround the NLS dialog opens

public class NLTest {

   public static final String SYMBOL_AMPERSAND = "&";                                       //$NON-NLS-1$
   public static final String SYMBOL_QUOTA     = new StringBuilder().append('"').toString();
}

Here is some relevant log output

From the terminal

java.lang.StringIndexOutOfBoundsException: begin 3, end 0, length 3
        at java.base/java.lang.String.checkBoundsBeginEnd(String.java:4606)
        at java.base/java.lang.String.substring(String.java:2709)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHint.stripQuotes(NLSHint.java:266)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHint.createSubstitutions(NLSHint.java:221)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHint.<init>(NLSHint.java:106)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring.<init>(NLSRefactoring.java:92)
        at org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring.create(NLSRefactoring.java:113)
        at org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizard.lambda$0(ExternalizeWizard.java:84)
        at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)
        at org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizard.open(ExternalizeWizard.java:81)
        at org.eclipse.jdt.ui.actions.ExternalizeStringsAction.run(ExternalizeStringsAction.java:191)
        at org.eclipse.jdt.ui.actions.ExternalizeStringsAction.run(ExternalizeStringsAction.java:156)
        at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:278)
        at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:252)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:474)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:581)
        at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:415)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:91)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4326)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1174)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4124)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3712)

Tested under this environment:

  • OS & version: Windows 10
  • Eclipse IDE/Platform version (as shown in Help > About): I20240731-1800

Community

  • I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
@wolfgang-ch wolfgang-ch added the bug Something isn't working label Aug 1, 2024
wolfgang-ch referenced this issue in mytourbook/mytourbook Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant