Vincent Hardy wrote:

Hello Daniel,

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.

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). 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.


Thanks, Vincent.

Daniel Noll wrote:

Snippet of code from our application...

// Get a new SVG drawing context.
DOMImplementation domImpl = SVGDOMImplementation.getDOMImplementation();
SVGDocument document = (SVGDocument) domImpl.createDocument(null, "svg", null);
SVGGraphics2D svg = new SVGGraphics2D(document);


   // Render the drawing and store it in the session.
   OurRenderer.render(svg);

   // Load the SVG viewer and view the SVG.
   JSVGComponent view = new JSVGComponent();
   view.setSVGDocument(document);
   gui.setView(view);

When running:

java.lang.NullPointerException
at org.apache.batik.bridge.BaseScriptingEnvironment.isDynamicDocument(Unknown Source)
at org.apache.batik.bridge.UpdateManager.isDynamicDocument(Unknown Source)
at org.apache.batik.swing.svg.JSVGComponent.setSVGDocument(Unknown Source)
at [my code above]


Anybody have any ideas? I've tried moving setSVGDocument to after the view is displayed,
but this makes no difference.


Daniel



---------------------------------------------------------------------
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]






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



Reply via email to