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

SVGGraphics2D.stream(*) corrupts created document.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 1.5
    • None
    • SVGGraphics2D
    • None
    • Operating System: All
      Platform: All

    Description

      The document created with an SVGGraphics2D object is corrupted(becomes empty)
      after invoking SVGGraphics.stream methods.The document must be explicitly set
      to root before streaming (using SVGGraphics2D.getRoot(Document ) ) unless it's
      lost. If this is the correct behavior, please update Javadoc (see BATIK-509).

      Code example:

      Document doc = ... ; // create a document with a dom implementation
      SVGGraphics2D svgG2d = new SVGGraphics2D(doc);

      //render into SVGGraphics2D object
      svgG2d.setPaint(...); svgG2d.fill(...) ....

      //stream the created Document, it works fine the first invocation
      svgG2d.stream(out, true); //out is a Writer

      //BUG-- spits an empty document. the created document is lost.
      svgG2d.stream(out,true);

      remark:

      To fix this problem, one can add the following code before streaming the document:

      Element root = doc.getDocumentElement();
      svgG2d.getRoot(root);

      Attachments

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            chaker_nakhli@yahoo.com Chaker Nakhli
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: