Skip to content

org.w3c.css.properties.css3.Css3Style cannot be cast to org.w3c.css.properties.svg.SVGBasicStyle #98

Closed
@sideshowbarker

Description

@sideshowbarker

The CSS Validator results for checking https://www.hex.co.il/ with the default options show this:

org.w3c.css.properties.css3.Css3Style cannot be cast to org.w3c.css.properties.svg.SVGBasicStyle

The problem doesn’t occur if the profile value is css3svg; it occurs if it’s just css3.

When that happens, the stack trace for the underlying exception looks like this:

java.lang.ClassCastException: org.w3c.css.properties.css3.Css3Style cannot be cast to org.w3c.css.properties.svg.SVGBasicStyle
        at org.w3c.css.properties.css.CssWritingMode.addToStyle(CssWritingMode.java:84)
        at org.w3c.css.parser.CssStyle.setProperty(CssStyle.java:83)
        at org.w3c.css.parser.CssSelectors.addProperty(CssSelectors.java:314)
        at org.w3c.css.css.StyleSheet.addProperty(StyleSheet.java:94)
        at org.w3c.css.css.StyleSheetParser.handleRule(StyleSheetParser.java:96)
        at org.w3c.css.parser.CssFouffa.handleRule(CssFouffa.java:815)
        at org.w3c.css.parser.analyzer.CssParser.ruleSet(CssParser.java:2532)
        at org.w3c.css.parser.analyzer.CssParser.afterImportDeclaration(CssParser.java:669)
        at org.w3c.css.parser.analyzer.CssParser.parserUnit(CssParser.java:547)
        at org.w3c.css.parser.CssFouffa.parseStyle(CssFouffa.java:374)
        at org.w3c.css.css.StyleSheetParser.parseStyleElement(StyleSheetParser.java:316)
        at org.w3c.css.css.HTMLParserStyleSheetHandler.endElement(HTMLParserStyleSheetHandler.java:401)
        at nu.validator.saxtree.TreeParser.endElement(TreeParser.java:132)
        at nu.validator.saxtree.Element.revisit(Element.java:110)
        at nu.validator.saxtree.TreeParser.parse(TreeParser.java:95)
        at nu.validator.htmlparser.sax.HtmlParser.parse(HtmlParser.java:428)
        at org.w3c.css.css.HTMLParserStyleSheetHandler.parse(HTMLParserStyleSheetHandler.java:695)
        at org.w3c.css.css.DocumentParser.<init>(DocumentParser.java:153)
        at org.w3c.css.css.CssValidator.main(CssValidator.java:154)

The source that causes a ClassCastException exception to be thrown is here:

public void addToStyle(ApplContext ac, CssStyle style) {
SVGBasicStyle s = (SVGBasicStyle) style;

Apparently when profile is css3 and that code is reached, style’s an instance of Css3Style (and can’t be cast to SVGBasicStyle because that extends Css3Style, instead of the other way around).

And I notice that same SVGBasicStyle s = (SVGBasicStyle) style cast in 22 other classes in org/w3c/css/properties/css/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions