xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kenneth B. Harwood" <run10ks...@comcast.net>
Subject loadSVGDocument generates NullPointerException
Date Thu, 11 Aug 2005 20:46:03 GMT
My system configuration:

Batik 1.6
J2SE 5.0/JApplet
Windows 2K Pro

Problem description:

I create a JSVGCanvas, initially "blank" (no SVG file
displayed) then I put the instance in a new thread.
I then start() the Thread.  Each time my program 
reaches the following block:

public void run() {
      try {
            jSVGCanvas.loadSVGDocument("http://www.mydomain.com/default.svg"); //NPE THROWN
        } catch (Exception expn) {
            System.out.println("Error loading SVG file.");


I get a NullPointerException.  Here's the entire stackTrace:

 at com.mydomain.run(myclass.java:38)
 at java.lang.Thread.run(Unknown Source)

I catch the Exception so I continue on.  What happens next 
depends on my mouse clicks.  For example, after experiencing
a ModifyThreadGroup error (a problem for another day) I *can* 
get my SVG file to appear.  After that, I can even load a different 
SVG file in response to a Menu click (see below).

Sometimes, depending on my mouse click sequence, when I try 
to load an SVG in response to a Menu Action, I get this sort of 
lengthy NPE error:

 at java.util.Properties$LineReader.readLine(Unknown Source)
 at java.util.Properties.load(Unknown Source)
 at org.apache.batik.util.XMLResourceDescriptor.getParserProps(Unknown Source)
 at org.apache.batik.util.XMLResourceDescriptor.getXMLParserClassName(Unknown Source)
 at org.apache.batik.swing.svg.JSVGComponent$BridgeUserAgent.getXMLParserClassName(Unknown
 at org.apache.batik.swing.svg.JSVGComponent$BridgeUserAgentWrapper.getXMLParserClassName(Unknown
 at org.apache.batik.bridge.DocumentLoader.<init>(Unknown Source)
 at org.apache.batik.swing.svg.JSVGComponent$1.run(Unknown Source)
 at org.apache.batik.swing.svg.JSVGComponent.stopThenRun(Unknown Source)
 at org.apache.batik.swing.svg.JSVGComponent.loadSVGDocument(Unknown Source)  <<<<<<<<<
 at myclass.jMenuItem2Chosen(myclass.java:104)
 at myclass.access$100(myclass.java:17)
 at myclass.$3.actionPerformed(myclass.java:88)
 at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
 at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
 at javax.swing.AbstractButton.doClick(Unknown Source)
 at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
 at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
 at java.awt.Component.processMouseEvent(Unknown Source)
 at javax.swing.JComponent.processMouseEvent(Unknown Source)
 at java.awt.Component.processEvent(Unknown Source)
 at java.awt.Container.processEvent(Unknown Source)
 at java.awt.Component.dispatchEventImpl(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Window.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)

BTW, my design calls for potentially multiple JSVGCanvas's; each
one runs in its own thread.  I think my thread-related stuff if O.K.
although I am certainly *NOT* a Java guru.  Still, when I run the 
loadSVGDocument code in a very simple test (not using a separate 
thread) the SVG file comes up *No Problem*. [scratching my head]

I've reviewed the Batik-users archive.  I've see plenty of individual
messages regarding NPE, plenty related to loadSVGDocument, but 
*nothing* related to both.

Ideas?  Suggestions?


 - Ken H.
View raw message