Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 337086 - [nls tooling] "Source > Externalize strings" throws IAE when .properties file contains invalid unicode escape
Summary: [nls tooling] "Source > Externalize strings" throws IAE when .properties file...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 4.3 M2   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-13 23:54 EST by Deepak Azad CLA
Modified: 2012-08-23 09:53 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Deepak Azad CLA 2011-02-13 23:54:46 EST
If the properties file contains an invalid unicode escape
e.g
bad=\u26
hello= world

"Source > Externalize strings" fails silently and an IAE is written to the log.
I guess like Bug 331562 we should write an error to the editor status line and don't write to the .log.

------------------------------------------------------------------------
java.lang.IllegalArgumentException: Invalid Unicode sequence: illegal character
at java.util.Properties.load(Properties.java:344)
at java.util.Properties.load(Properties.java:280)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHintHelper.getProperties(NLSHintHelper.java:461)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHintHelper.getProperties(NLSHintHelper.java:426)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSHint.<init>(NLSHint.java:97)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring.<init>(NLSRefactoring.java:89)
at org.eclipse.jdt.internal.corext.refactoring.nls.NLSRefactoring.create(NLSRefactoring.java:110)
at org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizard$1.run(ExternalizeWizard.java:73)
at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
at org.eclipse.jdt.internal.ui.refactoring.nls.ExternalizeWizard.open(ExternalizeWizard.java:71)
at org.eclipse.jdt.ui.actions.ExternalizeStringsAction.run(ExternalizeStringsAction.java:199)
at org.eclipse.jdt.ui.actions.ExternalizeStringsAction.run(ExternalizeStringsAction.java:162)
at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:278)
Comment 1 Dani Megert CLA 2012-08-23 09:46:31 EDT
Showing a dialog is better here and we also need to fix the Quick Fix.
Comment 2 Dani Megert CLA 2012-08-23 09:53:47 EDT
Fixed with http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=5241b0d1205f40009faa57c441d67e20f91f0f94

NOTE: A clean fix would wrap the IAE into a CoreException when loading the properties file and pass it through the whole call chain but that's overkill for this corner case.