xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mathieu Pedrero <mathieu.pedr...@gmail.com>
Subject Re: Unknown language: text/ecmascript [Precisions inside: problem with DOMUtilities]
Date Thu, 03 Sep 2009 09:06:55 GMT
Hi Everybody!

I created a new project on my IDE, only to make some test about this
problem, and i think I was right when I tought the DOMUtilities to be at the
roots of my problem.

To begin with, I guarante you that all the jar's of the dependency graph of
batik are included to the classpath of my new project:

#############################################
Begining of the code:
Here is the Constructor of a class (extending JFrame), called by the main
method in the Main class of my project. Nothig else is done
#############################################

    public Molasson() {
// This method (created by my IDE) creates and adds jpanel1 and jPanel2 to
the JFrame.
// I dont reprt it's source code, it's not important
        initComponents();

        this.setVisible(true);

        JFileChooser jfc = new JFileChooser();
        jfc.showOpenDialog(this);

//I create my two  test canvas

        JSVGCanvas canvas = new JSVGCanvas(), canvas2 = new JSVGCanvas();

//I set them dynamic

        canvas.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);
        canvas2.setDocumentState(JSVGCanvas.ALWAYS_DYNAMIC);

// I create the document I had to the first canvas

        Document document=null;

        String parser = XMLResourceDescriptor.getXMLParserClassName();
        SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);

        try {
            document =
f.createDocument(jfc.getSelectedFile().toURI().toString());
        } catch (IOException ex) {
            ex.printStackTrace();
        }

// I add this document to the canvas, and the canvas to the panel.
        canvas.setDocument(document);

        jPanel1.add(canvas);

        JOptionPane jop = new JOptionPane();

// This confirm dialog show itself, and no exception is thrown by my canvas!

        int n = jop.showConfirmDialog(this,"Premier affichage","Stop premier
affichage",jop.INFORMATION_MESSAGE);

// I try to "serialize" an "deserialize" my document (the same) with the
help of the DOMUtilities methods

        String documentString =
DOMUtilities.getXML(document.getDocumentElement());

        Document document2 = (Document)
DOMUtilities.parseXML(documentString,null,null,null,null,f);

//I set the new document to my canvas, and this canvas to the panel!

        canvas2.setDocument(document2);

        jPanel2.add(canvas2);

// The exception (I presented you in my precedent messages) is thrown :(


    }

########################################################"
End of my code
########################################################

When I try to make my document react, on the first canvas, the javascript is
executed. On the second canvas, the following exception is thrown:

########################################################
Exception stack trace
########################################################

java.lang.NullPointerException
    at
org.apache.batik.bridge.BridgeContext.getInterpreter(BridgeContext.java:566)
    at
org.apache.batik.bridge.BaseScriptingEnvironment.getInterpreter(BaseScriptingEnvironment.java:320)
    at
org.apache.batik.bridge.ScriptingEnvironment.runEventHandler(ScriptingEnvironment.java:391)
    at
org.apache.batik.bridge.ScriptingEnvironment$ScriptingEventListener.handleEvent(ScriptingEnvironment.java:1440)
    at
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:324)
    at
org.apache.batik.dom.events.EventSupport.fireEventListeners(EventSupport.java:366)
    at
org.apache.batik.dom.events.EventSupport.dispatchEvent(EventSupport.java:266)
    at
org.apache.batik.dom.AbstractNode.dispatchEvent(AbstractNode.java:1014)
    at
org.apache.batik.bridge.BridgeEventSupport$Listener.dispatchMouseEvent(BridgeEventSupport.java:403)
    at
org.apache.batik.bridge.BridgeEventSupport$Listener.mouseExited(BridgeEventSupport.java:279)
    at
org.apache.batik.gvt.event.AWTEventDispatcher.processMouseEvent(AWTEventDispatcher.java:628)
    at
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchMouseEvent(AWTEventDispatcher.java:518)
    at
org.apache.batik.gvt.event.AWTEventDispatcher.dispatchEvent(AWTEventDispatcher.java:399)
    at
org.apache.batik.gvt.event.AWTEventDispatcher.mouseMoved(AWTEventDispatcher.java:211)
    at
org.apache.batik.swing.svg.JSVGComponent$SVGListener$1MouseMovedRunnable.run(JSVGComponent.java:2261)
    at org.apache.batik.util.RunnableQueue.run(RunnableQueue.java:240)
    at java.lang.Thread.run(Thread.java:636)

###########################################################
End of the stack trace
###########################################################

Waiting for your advice, i'll continue tosearch bout this problem on my
side!

thanks a lot!

--
Mathieu Pedrero

Mime
View raw message