On Tue, 26 Mar 2024 12:00:07 GMT, Alexey Ivanov <[email protected]> wrote:

>> ChangedCharSetException is used to amend the charset during read according 
>> to html directives. Currently it causes immediate exit of the method which 
>> in turn causes failure to load html documents with charset directives (even 
>> if the latter must not change after all). This PR restores the catch 
>> operation as it was before the use of try with resources.
>
> 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.

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

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

Reply via email to