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

Gradients with an href that points to nothing throw an NPE

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: 1.7
    • Fix Version/s: None
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      Operating System:
      Platform: PC

      Description

      If the xlink:href attribute on a gradient points to a non-existent element, an NPE is thrown when rendering.

      For example:

      <radialGradient id="MyGradient" xlink:href="#Nonexistent">
      <stop offset="0%" stop-color="green" />
      <stop offset="50%" stop-color="blue" />
      <stop offset="100%" stop-color="red" />
      </radialGradient>

      thows:

      java.lang.NullPointerException
      at org.apache.batik.bridge.SVGUtilities.getChainableAttributeNS(SVGUtilities.java:255)
      at org.apache.batik.bridge.AbstractSVGGradientElementBridge.createPaint(AbstractSVGGradientElementBridge.java:92)
      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.SVGRectElementBridge.createShapePainter(SVGRectElementBridge.java:153)
      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.build(GVTBuilder.java:82)
      at org.apache.batik.swing.svg.GVTTreeBuilder.run(GVTTreeBuilder.java:96)

        Attachments

        1. test_gradient06_badhref.svg
          1.0 kB
          Paul LeBeau
        2. test_gradient06_badhref.svg
          1.0 kB
          Paul LeBeau

          Activity

            People

            • Assignee:
              batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
              Reporter:
              paul.lebeau@gmail.com Paul LeBeau
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: