Hi Alberto,

There is a bug in Batik 1.5 that causes the NullPointerException. This fixed in CVS. As you figured out, adding a call to setPrecision works around the issue. However, if you get the latest code from CVS, you'll find that the default will work (i.e., the default precision works and there is no need to call setPrecision unless desired).

Vincent.

Alberto Gobbi wrote:

Hi,
I have started to use batik it is a great tool!!!

I ran into a nullpointer exception in SVGGeneratorContext.doubleString with simple code like:

  public void createSVG(OutputStream out) throws IOException
  {  // Get a DOMImplementation
     DOMImplementation domImpl = GenericDOMImplementation.getDOMImplementation();

     // Create an instance of org.w3c.dom.Document
     Document document = domImpl.createDocument(null, "svg", null);

     // Create an instance of the SVG Generator
     SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
     //svgGenerator.getGeneratorContext().setPrecision(4);

     draw(svgGenerator);
     svgGenerator.stream(new OutputStreamWriter(out, "UTF-8"), true);
  }

and finaly figured out that I had to add a line like:
        svgGenerator.getGeneratorContext().setPrecision(4);

I think it would be a good idea to have a call to setPrecision in SVGGeneratorContext.createDefault because that would prevent the exception.

Alberto


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]








--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to