https://issues.apache.org/bugzilla/show_bug.cgi?id=50536
Summary: Problem with transcoding SVG files on multiple
threads.
Product: Batik
Version: 1.8
Platform: PC
OS/Version: Linux
Status: NEW
Severity: major
Priority: P2
Component: Bridge
AssignedTo: [email protected]
ReportedBy: [email protected]
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 bug #46360 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).
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]