RFR: 8328953 : JEditorPane.read throws ChangedCharSetException

Alexey Ivanov aivanov at openjdk.org
Tue Mar 26 12:11:22 UTC 2024


On Tue, 26 Mar 2024 12:04:35 GMT, Tejesh R <tr at openjdk.org> wrote:

>> src/java.desktop/share/classes/javax/swing/JEditorPane.java line 621:
>> 
>>> 619:         String charset = (String) getClientProperty("charset");
>>> 620:         try(Reader r = (charset != null) ? new InputStreamReader(in, charset) :
>>> 621:                 new InputStreamReader(in)) {
>> 
>> The changeset looks confusing in the diff. It becomes clearer if you disable showing whitespace differences.
>> 
>> You could've elaborated on the fix in the description.
>> 
>> The fix is to add a nested `try`-block inside `try-with-resource`; all the exceptions are handled in the nested `try`; the outer `try`-with-resouces only closes the input stream.
>
> Yeah, I too agree on this point. The fix description has to elaborated, we are not able to make out in diff.

I pulled the change into my local workspace to test it. IDE hides white-space differences and the fix becomes clear. I hid white-space differences in GitHub diff viewer: only two lines are changed. :)

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17567#discussion_r1539099247


More information about the client-libs-dev mailing list