<Swing Dev> RFR(S): 8234913 Improve parsing of Length Units in javax/swing/text/html/CSS

Volodin, Vladislav vladislav.volodin at sap.com
Thu Nov 28 10:08:14 UTC 2019


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


More information about the swing-dev mailing list