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

rendering a GeneralPath with NaN as a point outputs a corrupt SVG path

    XMLWordPrintableJSON

Details

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

    Description

      Using the SVGGraphics2D with the following code:

      public void paint(Graphics2D g2d)

      { GeneralPath gp = new GeneralPath(); gp.moveTo(0,0); gp.lineTo(100,100); // OOPS!!! gp.lineTo(Double.NaN,Double.NaN); g2d.draw(gp); }

      The presence of the NaN in the path will cause the SVG output to contain an invalid/corrupt path i.e.:

      <path style="fill:none;" d="M0 0 L100 100 L� �"/>

      Full test case added as an attachment.

      I fully understand that this is not something one would normally do, but the lack of any exception/error was a surprise.

      Attachments

        1. TestSVGGen.java
          1 kB
          Andy Wilcock

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            andrew_wilcock@mentorg.com Andy Wilcock
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: