xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Noll <dan...@nuix.com.au>
Subject Re: NullPointerException in JSVG
Date Mon, 07 Jul 2003 00:05:51 GMT

Hi.

Vincent Hardy wrote:
 > Which version of Batik are you using? Also, could you run the code in 
debug mode
 > (you can set debug=on in build.properties) so that we get the line 
numbers in the stack trace.

We're on 1.5 beta 2.  If there is a bug of this nature which was fixed 
in a later version we
might switch, otherwise the policy is to only upgrade if necessary.

Thomas DeWeese wrote:
 > I looked at this.  The real problem is that the line:
 >
 > SVGGraphics2D svg = new SVGGraphics2D(document);
 >
 > Does not automaticlly put the generated SVG in 'document'.  It simply 
tells
 > it to use 'document' as an element factory.  As a result you are 
passing a totally
 > empty document to the JSVGCanvas (it doesn't even have a root element).

Okay, this is what confused me, because if I printed out the svg it 
would work,
since the svg object does contain the image, but the document doesn't.  
Right...

 > This is what causes the NPE.  I've fixed this local, although it 
won't do you much good
 > because what you really want to do is add the line:
 >
 > document.appendChild(svg.getRoot());
 >
 > before calling setSVGDocument on the canvas.

Now, I tried doing this, and now I get...

org.w3c.dom.DOMException: The current node (type: 9, name: #document) do 
not allow children of the given type (type: 1, name: svg)
    at 
org.apache.batik.dom.AbstractNode.createDOMException(AbstractNode.java:368)
    at 
org.apache.batik.dom.AbstractDocument.checkChildType(AbstractDocument.java:509)
    at 
org.apache.batik.dom.AbstractParentNode.checkAndRemove(AbstractParentNode.java:419)
    at 
org.apache.batik.dom.AbstractParentNode.appendChild(AbstractParentNode.java:190)
    at [my code]

I'll look into this a bit further and report back if I figure out what 
was happening.

Daniel



---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-users-help@xml.apache.org


Mime
View raw message