Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-971

Problem with transcoding SVG files on multiple threads.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 1.8
    • None
    • Bridge
    • None
    • Operating System: Linux
      Platform: PC

    Description

      I am consistently getting following exception when trying to process different documents on multiple threads:

      org.w3c.dom.DOMException: file:/tmp/layer_3139666847115514441Complex%20SVG%20intro.svg:
      The attribute "style" represents an invalid CSS declaration ("fill:#148409;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:17.00787354;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0").
      Original message:
      java.lang.NullPointerException
      at org.apache.batik.css.engine.CSSEngine.getCascadedStyleMap(CSSEngine.java:825)
      at org.apache.batik.css.engine.CSSEngine.getComputedStyle(CSSEngine.java:868)
      at org.apache.batik.bridge.CSSUtilities.getComputedStyle(CSSUtilities.java:82)
      at org.apache.batik.bridge.CSSUtilities.convertDisplay(CSSUtilities.java:564)
      at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:206)
      at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
      at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
      at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)
      at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:208)
      at org.apache.batik.transcoder.print.PrintTranscoder.transcode(PrintTranscoder.java:159)
      at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
      at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
      at org.apache.batik.transcoder.print.PrintTranscoder.print(PrintTranscoder.java:307)

      This is a code fragment (which I have written) which causes the issue:

      String parser = XMLResourceDescriptor.getXMLParserClassName();
      SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
      Document doc = f.createDocument(svgUri);
      ...
      ...

      final public void render(Graphics2D graphics2D, float width, float height) throws Exception

      { TranscoderInput input = new TranscoderInput(doc); PrintTranscoder printTranscoder = new PrintTranscoder(); printTranscoder.addTranscodingHint(PrintTranscoder.KEY_SCALE_TO_PAGE, Boolean.TRUE); printTranscoder.addTranscodingHint(PrintTranscoder.KEY_PAGE_WIDTH, new Float(width)); printTranscoder.addTranscodingHint(PrintTranscoder.KEY_PAGE_HEIGHT, new Float(height)); printTranscoder.addTranscodingHint(PrintTranscoder.KEY_WIDTH, new Float(width)); printTranscoder.addTranscodingHint(PrintTranscoder.KEY_HEIGHT, new Float(height)); printTranscoder.transcode(input, null); PageFormat pageFormat = new PageFormat(); Paper paper = new Paper(); paper.setSize(width, height); paper.setImageableArea(0, 0, width, height); pageFormat.setPaper(paper); printTranscoder.print(graphics2D, pageFormat, 0); }

      When I make the method 'synchronized' all works fine (also, when there is only one thread then it works fine too). I am testing it with 5 threads and the exception is thrown always.

      I am using current (trunk from SVN) version of Batik.

      At first I thought that it is connected to the FOP-1610 in FOP but I am not using FOP in this case (and even if I am wrong about it I have the latest FOP from SVN which should have that bug fixed).

      Attachments

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            karolbe@gmail.com Karol Bryd
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: