xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan wood <jonathanshaww...@gmail.com>
Subject Re: problem with batik transcoder on a headless system
Date Tue, 09 Feb 2010 18:56:13 GMT
Hello Simon,

  I suspect the root of your problem is how the local vm is
sorting/selecting the constructor for java.awt.Color.

  Your headless system is likely constructing using the float version
of the Constructor which does something like:

this( (int) (r*255+0.5), (int) (g*255+0.5), (int) (b*255+0.5));

Hence, if you are passing an int as the color value (very likely), you
will blow the values far from the acceptable 0-255 range.  The
Constructor order seems to differ by platform and even by jdk revision
on platforms.

You can almost certainly verify this by check the stack while
suspended at the exception.  If you see the float constructor called
prior to the int version then this is almost certainly the issue.

Of course, if you could provide the failing test.svg for inspection,
it might help to determine a suitable work-around.

Hope this helps a bit and please share anything you find!

Jonathan



On Tue, Feb 9, 2010 at 12:04 PM, simon <simon@333.ch> wrote:
>
> Helder Magalhães schrieb:
>>
>> Hi simon,
>>
>
> hi helder,
>
> thanks very much for your response.
>>
>>
>>>
>>> i have developed a yanel resource-type which is using the batik transcoder
>>> to create png and jpg from svg. on my local computer everything works like a
>>> charm. after i deployed it on a haedless server i run into a problem. i
>>> tried Djava.awt.headless=true and xvfb. and a real simple svg worked fine
>>> but for most cases i get an exception (see below). after this exception was
>>> thrown even the simple svg which worked before throws the exception.
>>>
>>
>> Maybe you got caught by bug 42408 [1]? Could you try downloading the
>> source [2] and apply the available patch [1] locally and see if it
>> helps? Please reply back (or comment on the bug report) if so. ;-)
>>
>
> unfortunately i could not apply the patch to source of 1.7 and as i understand the comments
in the bug 42408 the patch has already been applied to trunk. so i just checked out the trunk
and tried the rasterizer:
>
> simon@debian:~/batik-test/batik-trunk/batik-1.8pre$ java  -Djava.awt.headless=true -jar
batik-rasterizer.jar test.svg
> About to transcode 1 SVG file(s)
>
> Converting test.svg to test.png ... java.lang.IllegalArgumentException: Color parameter
outside of expected range: Alpha Green
>       at java.awt.Color.testColorValueRange(Color.java:298)
>       at java.awt.Color.<init>(Color.java:382)
>       at org.apache.batik.bridge.PaintServer.convertColor(Unknown Source)
>       at org.apache.batik.bridge.CSSUtilities.convertStopColor(Unknown Source)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge$SVGStopElementBridge.createStop(Unknown
Source)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge.extractLocalStop(Unknown
Source)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge.extractStop(Unknown
Source)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge.createPaint(Unknown
Source)
>       at org.apache.batik.bridge.PaintServer.convertURIPaint(Unknown Source)
>       at org.apache.batik.bridge.PaintServer.convertPaint(Unknown Source)
>       at org.apache.batik.bridge.PaintServer.convertFillPaint(Unknown Source)
>       at org.apache.batik.bridge.PaintServer.convertFillAndStroke(Unknown Source)
>       at org.apache.batik.bridge.SVGShapeElementBridge.createShapePainter(Unknown
Source)
>       at org.apache.batik.bridge.SVGCircleElementBridge.createShapePainter(Unknown
Source)
>       at org.apache.batik.bridge.SVGShapeElementBridge.buildGraphicsNode(Unknown Source)
>       at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
>       at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
>       at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
>       at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
>       at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(Unknown Source)
>       at org.apache.batik.bridge.GVTBuilder.buildComposite(Unknown Source)
>       at org.apache.batik.bridge.GVTBuilder.build(Unknown Source)
>       at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
>       at org.apache.batik.transcoder.image.ImageTranscoder.transcode(Unknown Source)
>       at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)
>       at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)
>       at org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown Source)
>       at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
>       at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source)
>       at org.apache.batik.apps.rasterizer.Main.main(Unknown Source)
> ... error (SVGConverter.error.while.rasterizing.file)
>
>>
>>
>>>
>>> Caused by: java.lang.IllegalArgumentException: Color parameter outside of expected
range: Alpha Red
>>>  at java.awt.Color.testColorValueRange(Color.java:298)
>>>
>>
>> [...]
>> The exception is somehow weird so I'd ask you to attach a simple test
>> case [3] which reproduces the issue in a reply, so one can see if
>> that's really what's happening. Thanks! :-)
>>
>
> instead of writing a test i just tried the batik-rasterizer on my headless system and
got the following (same) exception:
> simon@debian:~/batik-test/batik-1.7$ java  -Djava.awt.headless=true -jar batik-rasterizer.jar
test.svg
> About to transcode 1 SVG file(s)
>
> Converting test.svg to test.png ... java.lang.IllegalArgumentException: Color parameter
outside of expected range: Alpha Green Blue
>       at java.awt.Color.testColorValueRange(Color.java:298)
>       at java.awt.Color.<init>(Color.java:382)
>       at org.apache.batik.bridge.PaintServer.convertColor(PaintServer.java:449)
>       at org.apache.batik.bridge.CSSUtilities.convertStopColor(CSSUtilities.java:864)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge$SVGStopElementBridge.createStop(AbstractSVGGradientElementBridge.java:330)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge.extractLocalStop(AbstractSVGGradientElementBridge.java:237)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge.extractStop(AbstractSVGGradientElementBridge.java:189)
>       at org.apache.batik.bridge.AbstractSVGGradientElementBridge.createPaint(AbstractSVGGradientElementBridge.java:70)
>       at org.apache.batik.bridge.PaintServer.convertURIPaint(PaintServer.java:359)
>       at org.apache.batik.bridge.PaintServer.convertPaint(PaintServer.java:259)
>       at org.apache.batik.bridge.PaintServer.convertFillPaint(PaintServer.java:228)
>       at org.apache.batik.bridge.PaintServer.convertFillAndStroke(PaintServer.java:146)
>       at org.apache.batik.bridge.SVGShapeElementBridge.createShapePainter(SVGShapeElementBridge.java:117)
>       at org.apache.batik.bridge.SVGCircleElementBridge.createShapePainter(SVGCircleElementBridge.java:123)
>       at org.apache.batik.bridge.SVGShapeElementBridge.buildGraphicsNode(SVGShapeElementBridge.java:91)
>       at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:224)
>       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.image.ImageTranscoder.transcode(ImageTranscoder.java:92)
>       at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(XMLAbstractTranscoder.java:142)
>       at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(SVGAbstractTranscoder.java:156)
>       at org.apache.batik.apps.rasterizer.SVGConverter.transcode(SVGConverter.java:1001)
>       at org.apache.batik.apps.rasterizer.SVGConverter.execute(SVGConverter.java:717)
>       at org.apache.batik.apps.rasterizer.Main.execute(Main.java:938)
>       at org.apache.batik.apps.rasterizer.Main.main(Main.java:992)
> ... error (SVGConverter.error.while.rasterizing.file)
>
> i also will try to find another haedless system to reproduce the problem.
>
> but still, any help would be very much appreciated.
>
> thanks
> simon
>
>>
>>
>>>
>>> any hint would be very much appreciated.
>>>
>>
>> Hope this helps,
>>  Helder
>>
>>
>> [1] https://issues.apache.org/bugzilla/show_bug.cgi?id=42408
>> [2] http://xmlgraphics.apache.org/batik/download.cgi#Subversion+repository
>> [3] http://webkit.org/quality/reduction.html
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message