I ran into this problem before. I had to put in a Thread.sleep(200) between calling JSVGCanvas.stopProcessing() and JSVGCanvas.setDocument().
Michael Bishop -----Original Message----- From: Marc Doerflinger [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 13, 2007 7:45 AM To: batik-users@xmlgraphics.apache.org Subject: nullpointer exception when loading new svgdocument into jsvgcanvas -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 hello folks! im running batik 1.6 and after all troubles i went thru getting this thing to run i thought its working and stable. but for some strange reason sometimes when i load a new svgdocument into the canvas i get the following exception (happens about 1 in 50 loads): 118453 [main] ERROR com.diligentit.util.DefaultApp - org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at org.eclipse.swt.SWT.error(SWT.java:3374) at org.eclipse.swt.SWT.error(SWT.java:3297) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java: 126) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971) at com.diligentit.cctv.workplace.App.run(App.java:150) at com.diligentit.cctv.workplace.App.main(App.java:33) Caused by: java.lang.NullPointerException at org.apache.batik.swing.svg.JSVGComponent.stopThenRun(Unknown Source) at org.apache.batik.swing.svg.JSVGComponent.setSVGDocument(Unknown Source) at org.apache.batik.swing.svg.JSVGComponent.setDocument(Unknown Source) at com.diligentit.svgviewer.SVGViewerSWT$DocumentSetter.run(SVGViewerSWT.ja va:443) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java: 123) ... 4 more i always reuse my jsvgcanvas and use the following commands to load the new svg document into the canvas (and yes the document i load is set): svgCanvas.stopProcessing(); svgCanvas.setDocument(_document); svgCanvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC); svgCanvas.flushImageCache(); line 443 in the exception is the line where the setDocument() instruction is. do i do anything wrong when loading a new document onto the canvas? any ideas what could go wrong? the "Unknown Source" line in the exception irritate me a bit, they make it hard to track down the error. does anyone has similar problems? thanks, marc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGb9ik6mRZxtk0FrcRAhWHAKDatp7cY5umn3wVTF9JEkibZ9pAPwCg17K6 d3dkejBUzsu6t8ZxfTRKomE= =Z3oX -----END PGP SIGNATURE----- --------------------------------------------------------------------- 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]