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

DOMUtilities#deepCloneDocument(Document, DOMImplementation) returns corrupted document

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Incomplete
    • 1.8
    • None
    • Bridge
    • None
    • Operating System: Windows XP
      Platform: Other

    Description

      A GMF client application is capable of substituting fill and stop colors if they
      are white or black with user customized colors. Color substitution is done
      manually by iterating through document node elements. Before the color switching
      is done the original SVGOMDocument is cloned using
      DOMUtilities.deepCloneDocument() method as following:

      DOMImplementation impl;
      impl = SVGDOMImplementation.getDOMImplementation();
      document = DOMUtilities.deepCloneDocument(document, impl);

      The end document is one used by GVTBuilder.build() which throws the following
      BridgeException with the code = "uri.malformed". Therefore, the image is not
      rendered. This is without color switching - the cloned document is untouched.
      Full stack trace is listed at the bottom.

      If the document is not cloned, no exceptions thrown and the image is rendered.

      The exception occurs for image: "SVG_gradient_noattr.svg"
      but doesn't occur for image: "SVG_flat.svg"
      (Both images will be attached)

      Since, I would expect cloned and the original documents to be handled in the
      same way by GVTBuilder#build(BridgeContext, SVGOMDocument), perhaps there is a
      bug somewhere in DOMUtilities.deepCloneDocument()?

      Would be nice to know what's special about image "SVG_gradient_noattr.svg"
      compared to "SVG_flat.svg"? Why the first one gives an exception and the second
      doesn't?

      Note: http://issues.apache.org/bugzilla/show_bug.cgi?id=40862 might be related
      to this one.

      Stack Trace:

      org.apache.batik.transcoder.TranscoderException: null
      Enclosed Exception:
      null:-1
      The URI "#linearGradient7288"
      specified on the element <linearGradient> is invalid

      at
      org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.ImageTranscoderEx.transcode(ImageTranscoderEx.java)

      at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown Source)

      at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode(Unknown Source)

      at
      org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.SVGImageConverter.setUpTranscoders(SVGImageConverter.java:148)

      at
      org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.SVGImageConverter.renderSVGtoSWTImage(SVGImageConverter.java:74)

      at
      org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.SVGImage.renderImage(SVGImage.java:68)

      at
      org.eclipse.gmf.runtime.draw2d.ui.render.internal.AbstractRenderedImage.getSWTImage(AbstractRenderedImage.java:130)

      at
      org.eclipse.gmf.runtime.draw2d.ui.render.internal.RenderHelper$1.run(RenderHelper.java:103)

      at java.lang.Thread.run(Thread.java:797)

      Attachments

        1. SVG_flat.svg
          10 kB
          Alex Boyko
        2. SVG_gradient_noattr.svg
          8 kB
          Alex Boyko

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            aboyko@ca.ibm.com Alex Boyko
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: