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
[NETBEANS-5181] Update NbBundle to read bundle files like JDK9 does (UTF-8 then ISO-8859-1) #2633
[NETBEANS-5181] Update NbBundle to read bundle files like JDK9 does (UTF-8 then ISO-8859-1) #2633
Conversation
I checked the travis log, only 1 job failed "#8201.21 Test Java modules without nb-javac on Java 14". There are exceptions in several places, no idea which one is fatal, and it does not seem related to the code I've changed. Help is welcome... |
For the unittest: That job is flaky - I restartet the test. For the commit: Please adjust the title (it is UTF-8, not UTF-1). What I'm missing is a reasoning for the possible issues introduced by this change. How probable is it, that some one used a ISO-8859-1 char from the high range (with the highest bit set) and that that character (or this character and the following characters) form a valid UTF-8 sequence? For example the sequence
That correctly decodes as UTF-8 to 삧 (Hangul Bbic). So this might introduce regressions. How does the JDK handle this situation? |
A few unittest would be nice. |
Regarding the regression risk, my code has exactly the same approach than JDK. I'll add a few unit tests. |
0b1a014
to
4219416
Compare
@@ -10,13 +10,12 @@ | |||
* http://www.apache.org/licenses/LICENSE-2.0 | |||
* | |||
* Unless required by applicable law or agreed to in writing, | |||
* software distributed under the License is distributed on an | |||
* software distributeFd under the License is distributed on an |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something got here, needs to be fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me. If I remember the number of bundles in the netbeans code base, I think preventing unnessary waste would be good. In that case, two static variables each holding an instance of Utf8ThenIsoCharset
, one with acceptOnlyUTF8
and one without it set.
I left two additional inline comments.
36062c1
to
77b4661
Compare
@jjazzboss thank you. I also double checked and this should indeed be save. To get this finished, a bit of work remains:
If that is done, I'll let travis do its work and will then merge. |
…lt since JDK9 Change NbBundle to read Bundle files using UTF-1 encoding by default, and automatically switch to ISO-8859-1 if UTF-1 decoding fails. System property java.util.PropertyResourceBundle.encoding can can alter the behavior like for PropertyResourceBundle (from JDK9).
77b4661
to
3b8dea5
Compare
@matthiasblaesing Yes I'm ok for the donation. I squashed the commits. Happy to complete my first PR :-) |
Thank you. |
Changed NbBundle to read Bundle files using UTF-1 encoding by default, and
automatically switch to ISO-8859-1 if UTF-1 decoding fails. System property
java.util.PropertyResourceBundle.encoding can alter the behavior
like for PropertyResourceBundle (from JDK9).