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

NPE in SVGGen not working due to non-registered image writers

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 1.9
    • Fix Version/s: None
    • Component/s: SVGGraphics2D, Utilities
    • Labels:
      None
    • Environment:
      Eclipse

      Description

      There is an NPE in class ImageHandlerBase64Encoder (in batik-svggen) 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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ansgar Ansgar Radermacher
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: