[jira] [Created] (BATIK-1228) NPE in SVGGen not working due to non-registered image writers

"Ansgar Radermacher (JIRA)" <[email protected]> Fri, 1 Jun 2018 09:24:00 +0000 (UTC)
Newsgroups gmane.text.xml.batik.devel
Message-ID <[email protected]>
Ansgar Radermacher created BATIK-1228:
-----------------------------------------

             Summary: NPE in SVGGen not working due to non-registered image writers
                 Key: BATIK-1228
                 URL: https://issues.apache.org/jira/browse/BATIK-1228
             Project: Batik
          Issue Type: Bug
          Components: SVGGraphics2D, Utilities
    Affects Versions: 1.9
         Environment: Eclipse
            Reporter: Ansgar Radermacher


There is an NPE in class ImageHandlerBase64 encoder in the 1.9.1 build for Eclipse photon in the following code (which gets triggered by a "File->Save as Image" in Papyrus).

ImageWriter writer = ImageWriterRegistry.getInstance().getWriterFor("image/png");
writer.writeImage(buf, os);

...

No ImageWriter is registered for "image/png", i.e writer is null after the assignment. The ImageIOPNGImageWriter (and others) from the batik codec package are not "visible" for the class Service in utils which it used by the ImageWriterRegistry to detect available writers.

This is due to a missing dependency from batik.util to batik.codec, as proposed in [https://bz.apache.org/bugzilla/show_bug.cgi?id=44682] and [https://stackoverflow.com/questions/16138850/batik-svggraphics2d-nullpointerexception-when-drawing-image].  However, this solution is not possible (at least not on Eclipse level), since batik.codec also depends on batik.util, i.e. would introduce a dependency cycle.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)