brand-zz / jing-trang

Automatically exported from code.google.com/p/jing-trang
Other
0 stars 0 forks source link

NullPointerException with SVG 1.1 grammar and <svg><font/></svg> instance #156

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Document instance TEST.svg: <svg 
xmlns="http://www.w3.org/2000/svg"><font/></svg>

java -jar jing.jar http://www.w3.org/Graphics/SVG/1.1/rng/svg11.rng TEST.svg

Fails with an NPE. Full stack trace:

Exception in thread "main" java.lang.NullPointerException
    at java.lang.String.compareTo(String.java:1167)
    at java.lang.String.compareTo(String.java:92)
    at java.util.TreeMap.put(TreeMap.java:545)
    at java.util.TreeSet.add(TreeSet.java:238)
    at com.thaiopensource.relaxng.impl.PatternValidator$NameRecordingVisitor.visitElement(Unknown Source)
    at com.thaiopensource.relaxng.impl.ElementPattern.accept(Unknown Source)
    at com.thaiopensource.relaxng.impl.PatternValidator$NameRecordingVisitor.visitGroup(Unknown Source)
    at com.thaiopensource.relaxng.impl.GroupPattern.accept(Unknown Source)
    at com.thaiopensource.relaxng.impl.PatternValidator.endElement(Unknown Source)
    at com.thaiopensource.xml.sax.ForkContentHandler.endElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:601)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:180)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
    at com.thaiopensource.validate.ValidationDriver.validate(Unknown Source)
    at com.thaiopensource.relaxng.util.Driver.doMain(Unknown Source)
    at com.thaiopensource.relaxng.util.Driver.main(Unknown Source)

Original issue reported on code.google.com by sideshowbarker on 13 Apr 2012 at 5:20

GoogleCodeExporter commented 9 years ago
The problem appears to start with the following defines in svg-basic-font.rng:

  <define name="SVG.font-face.extra.class">
    <notAllowed/>
  </define>

  <define name="SVG.font-face.content">
    <zeroOrMore>
      <ref name="SVG.Description.class"/>
    </zeroOrMore>
    <optional>
      <ref name="font-face-src"/>
    </optional>
    <ref name="SVG.font-face.extra.class"/>
  </define>

So, SVG.font-face.extra.class is defined as notAllowed at that point.

The the svg-font.rng file has this:

  <include href="svg-basic-font.rng"/>

  <define name="SVG.font-face.extra.class" combine="interleave">
    <optional>
      <ref name="definition-src"/>
    </optional>
  </define>

If I change that instead to the following, no NPE is thrown, I get the 
validation errors I would expect to get for the document, and jing exits 
normally.

  <include href="svg-basic-font.rng">
    <define name="SVG.font-face.extra.class" combine="interleave">
      <optional>
        <ref name="definition-src"/>
      </optional>
    </define>
  </include>

So I'm wondering first whether the schema is even valid. If it's not valid, 
then what's causing jing to not catch the error in the schema. Or if it is 
valid, then what's causing jing to not use the schema as expected.

Original comment by sideshowbarker on 13 Apr 2012 at 5:30

GoogleCodeExporter commented 9 years ago

Original comment by sideshowbarker on 13 Apr 2012 at 5:31

GoogleCodeExporter commented 9 years ago

Original comment by sideshowbarker on 13 Apr 2012 at 5:32