You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Danny Ayers <da...@virgilio.it> on 2002/08/20 18:13:04 UTC

J2SE version issue?

Hi,
I have some code that builds a Document more or less like this :

DOMImplementation impl = SVGDOMImplementation.getDOMImplementation();
String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
Document doc = impl.createDocument(svgNS, "svg", null);

This runs fine with Java SDK 1.3.1 and 1.4 on this Win2k machine, but gives
a null pointer exception on a Win98 machine running 1.3.0.

Can anyone please confirm whether or not this really is a J2SE version issue
(I can't update the other JDK just yet).

I first encountered this error quite a while ago, and have updated the Batik
libs several times since, currently running from the latest cvs versions.

Error, libraries used & test source below.

Thanks,
Danny.

----
output on 1.3.0 :

SVGDOMImplementation.getDOMImplementation() =
org.apache.batik.dom.svg.SVGDOMImp
lementation@42719c
SVGDOMImplementation.SVG_NAMESPACE_URI = http://www.w3.org/2000/svg
java.lang.NullPointerException
        at org.apache.batik.dom.AbstractAttr.setNodeValue(Unknown Source)
        at org.apache.batik.dom.AbstractAttr.setValue(Unknown Source)
        at
org.apache.batik.dom.svg.AbstractElement$ExtendedNamedNodeHashMap.set
UnspecifiedAttribute(Unknown Source)
        at
org.apache.batik.dom.svg.AbstractElement.setUnspecifiedAttribute(Unkn
own Source)
        at
org.apache.batik.dom.svg.AttributeInitializer.resetAttribute(Unknown
Source)
        at
org.apache.batik.dom.svg.AttributeInitializer.initializeAttributes(Un
known Source)
        at
org.apache.batik.dom.svg.AbstractElement.initializeAttributes(Unknown
 Source)
        at org.apache.batik.dom.svg.AbstractElement.<init>(Unknown Source)
        at org.apache.batik.dom.svg.SVGOMElement.<init>(Unknown Source)
        at org.apache.batik.dom.svg.SVGStylableElement.<init>(Unknown
Source)
        at org.apache.batik.dom.svg.SVGOMSVGElement.<init>(Unknown Source)
        at
org.apache.batik.dom.svg.SVGDOMImplementation$SvgElementFactory.creat
e(Unknown Source)
        at
org.apache.batik.dom.svg.SVGDOMImplementation.createElementNS(Unknown
 Source)
        at org.apache.batik.dom.svg.SVGOMDocument.createElementNS(Unknown
Source
)
        at
org.apache.batik.dom.svg.SVGDOMImplementation.createDocument(Unknown
Source)
        at BCrash.<init>(BCrash.java:52)
        at BCrash.main(BCrash.java:63)

----
batch file used for launching :

set
ctp=batik-svg-dom.jar;batik-dom.jar;batik-util.jar;batik-css.jar;batik-ext.j
ar;batik-xml.jar
java -classpath .;%ctp% BCrash
------
test source :


import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.StringWriter;
import java.io.Writer;
import java.util.List;

import org.apache.batik.dom.svg.SAXSVGDocumentFactory;
import org.apache.batik.dom.svg.SVGDOMImplementation;
import org.apache.batik.dom.svg.SVGOMDocument;

import org.apache.batik.dom.*;

import org.apache.batik.dom.svg.SVGStyleSheetProcessingInstruction;
import org.apache.batik.transcoder.Transcoder;
import org.apache.batik.transcoder.TranscoderInput;
import org.apache.batik.transcoder.TranscoderOutput;
import org.apache.batik.transcoder.svg2svg.SVGTranscoder;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import com.isacat.svolgo.base.AbstractGraph;
import com.isacat.svolgo.layout.LayoutConstants;
import com.isacat.svolgo.model.Adjunct;
import com.isacat.svolgo.model.Edge;
import com.isacat.svolgo.model.Vertex;

public class BCrash {

	/**
	 * Constructor for BCrash.
	 */
	public BCrash() {
			SVGDOMImplementation impl;
		String svgNS = SVGDOMImplementation.SVG_NAMESPACE_URI;
		Document doc;
		try {
			impl =
				(SVGDOMImplementation) SVGDOMImplementation
					.getDOMImplementation();
			System.err.println(
				"\n\nSVGDOMImplementation.getDOMImplementation() = "
					+ SVGDOMImplementation.getDOMImplementation());
			System.err.println(
				"SVGDOMImplementation.SVG_NAMESPACE_URI = "
					+ SVGDOMImplementation.SVG_NAMESPACE_URI);
			doc = impl.createDocument(svgNS, "svg", null);

			System.err.println("doc = " + doc);
				System.err.println("root = " + doc.getDocumentElement());
		}
		catch (Exception exception) {
			exception.printStackTrace();
		}
	}

public static void main(String[] args){
	new BCrash();
}
}

----------------------------------

---
Danny Ayers
<stuff> http://www.isacat.net </stuff>

Idea maps for the Semantic Web
http://ideagraph.net


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