<Swing Dev> RFR(S): 8234913 Improve parsing of Length Units in javax/swing/text/html/CSS
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Sat Jan 4 19:40:12 UTC 2020
Hi, Vladislav.
The fix looks fine, but please add a copyright header to the test.
> If you think that my work might be helpful, I have identified few other places, where exceptions were either improperly handled, or thrown when it can be avoided. I can improve that part as well.
Such improvements are welcome.
> Regarding boxing & unboxing optimizations, I followed suggestions from IntelliJ.
>
> Kind regards,
> Vlad
>
> -----Original Message-----
> From: Sergey Bylokhov <Sergey.Bylokhov at oracle.com>
> Sent: Dienstag, 3. Dezember 2019 01:13
> To: Volodin, Vladislav <vladislav.volodin at sap.com>
> Cc: swing-dev at openjdk.java.net
> Subject: Re: <Swing Dev> RFR(S): 8234913 Improve parsing of Length Units in javax/swing/text/html/CSS
>
> Probably "java -verbose:class" might help? I guess after the fix
> this exception should not be loaded on successful parsing of "%".
>
> On 12/2/19 2:38 pm, Volodin, Vladislav wrote:
>> Hello Sergey,
>>
>> indeed I wish I can create it. The main difficulty is that the exception (when it occurs) is handled by try-catch and swallowed. So only if I turn on the debugger with “any exception” breakpoint, I will be able to find that the execution path was wrong.
>>
>> I am new here, and I will appreciate if you can give me an idea how to test the exception presence? Something with reflection? E.g. count a number of NumberFormatException constructor calls?
>>
>> Kind regards,
>> Vlad
>>
>> Sent from myFone
>>
>>> On 2. Dec 2019, at 23:24, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
>>>
>>> Hi, Vladislav.
>>>
>>> Is it possible to provide an automated test for this change?
>>>
>>> On 11/28/19 2:08 am, Volodin, Vladislav wrote:
>>>> Hello everyone,
>>>> I'd like to contribute a little improvement to javax/swing/text/html/CSS. The issue is that "font-size: 100%" throws NumberFormatException for 100%, because of a wrong execution path. It is possible to reproduce the issue with the code below (but you should create Java exception breakpoints to see the place):
>>>> package com.test;
>>>> import javax.swing.text.MutableAttributeSet;
>>>> import javax.swing.text.SimpleAttributeSet;
>>>> import javax.swing.text.html.CSS;
>>>> import javax.swing.text.html.StyleSheet;
>>>> public class Main {
>>>> public static void main(String[] args) {
>>>> StyleSheet ss = new StyleSheet();
>>>> MutableAttributeSet attr = new SimpleAttributeSet();
>>>> ss.addCSSAttribute(attr, CSS.Attribute.FONT_SIZE, "100%");
>>>> }
>>>> }
>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8234913
>>>> Webrev: http://cr.openjdk.java.net/~clanger/webrevs/8234913.0/
>>>> Kind regards,
>>>> Vlad
>>>
>>>
>>> --
>>> Best regards, Sergey.
>
>
--
Best regards, Sergey.
More information about the swing-dev
mailing list