[
https://issues.apache.org/jira/browse/BATIK-736?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16518358#comment-16518358
]
Tilman Hausherr commented on BATIK-736:
---------------------------------------
{quote}Yes there should be checks in there, I think. I'm not sure what
behaviour makes
sense for a GraphicsConfiguration on SVGGraphics2D, since it doesn't work on a
raster image. So for now I'll leave getDeviceConfiguration() returning null.
{quote}
In Apache PDFBox, we call
{{graphics.getDeviceConfiguration().getDevice().getType();}} to find out
whether a graphics context is a printer and got an NPE. I'll open an issue
later, change our code accordingly, and will link this one to it.
> NullPointerException when painting GraphicsNode onto Graphics2D impl with no
> associated DeviceConfiguration (i.e. SVGGraphics2D)
> --------------------------------------------------------------------------------------------------------------------------------
>
> Key: BATIK-736
> URL: https://issues.apache.org/jira/browse/BATIK-736
> Project: Batik
> Issue Type: Bug
> Components: GVT
> Affects Versions: 1.7
> Environment: Operating System: All
> Platform: All
> Reporter: Thomas Behr
> Assignee: Batik Developer's Mailing list
> Attachments: GraphicsUtil.java
>
>
> When painting org.apache.batik.gvt.GraphicsNode uses utility class
> org.apache.batik.ext.awt.image.GraphicsUtil. This utility fails to check for
> null return values from Graphics2D.getDeviceConfiguration in at least two
> places.
> Steps two reproduce:
> Create a GraphicsNode from a SVGDocument, paint onto SVGGraphics2D (or any
> other Graphics2D impl whose getDeviceConfiguration returns null)
> java.lang.NullPointerException
> at
> org.apache.batik.ext.awt.image.GraphicsUtil.getDestination(GraphicsUtil.java:498)
> at
> org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorModel(GraphicsUtil.java:511)
> at
> org.apache.batik.ext.awt.image.GraphicsUtil.getDestinationColorSpace(GraphicsUtil.java:533)
> at
> org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:131)
> at
> org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(GraphicsUtil.java:451)
> at
> org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:522)
> at
> org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:159)
> at
> org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:488)
> at
> org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:159)
> at
> org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(CanvasGraphicsNode.java:158)
> at
> org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:488)
> at
> org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(CompositeGraphicsNode.java:159)
> at
> org.apache.batik.gvt.AbstractGraphicsNode.paint(AbstractGraphicsNode.java:488)
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]