-
Bug
-
Resolution: Fixed
-
P3
-
1.3.0
-
tiger
-
sparc
-
solaris_8
XML processor can have ErrorHandler, EntityResolver, ContentHandler,
DTDHandler set to null in Sax 2.0.1.
###@###.### 2003-08-19
------------------------------------------------
Tue Aug 26 11:35:08 EDT 2003 G. Todd Miller :
I tried to verify this bug in Tiger, but it appears to be still broken.
Here is a sample program to demonstrate the null pointer exception:
import org.w3c.dom.*;
import org.xml.sax.*;
import org.w3c.dom.ls.*;
import javax.xml.parsers.*;
public class Test {
public static void main(String[] args){
Test app = new Test();
app.run();
}
public void run() {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader reader = sp.getXMLReader();
reader.setErrorHandler(null); // SAX 2.0.1 allows
reader.setContentHandler(null); // SAX 2.0.1 allows
reader.setEntityResolver(null); // SAX 2.0.1 allows
reader.setDTDHandler(null); // SAX 2.0.1 allows
}
catch (ParserConfigurationException e){
System.out.println("ParserConfigurationException thrown");
}
catch (SAXException e){
System.out.println("SAXException thrown");
}
catch (NullPointerException e){
System.out.println("NullPointerException thrown");
e.printStackTrace();
}
}
}
---- Output from running with Tiger ----
% java -version
java version "1.5.0-internal"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-internal-_14_aug_2003_22_01)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b15, mixed mode)
% javac Test.java
% java -cp . Test
NullPointerException thrown
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.setErrorHandler(AbstractSAXParser.java:1291)
at Test.run(Test.java:16)
at Test.main(Test.java:9)
DTDHandler set to null in Sax 2.0.1.
###@###.### 2003-08-19
------------------------------------------------
Tue Aug 26 11:35:08 EDT 2003 G. Todd Miller :
I tried to verify this bug in Tiger, but it appears to be still broken.
Here is a sample program to demonstrate the null pointer exception:
import org.w3c.dom.*;
import org.xml.sax.*;
import org.w3c.dom.ls.*;
import javax.xml.parsers.*;
public class Test {
public static void main(String[] args){
Test app = new Test();
app.run();
}
public void run() {
try {
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader reader = sp.getXMLReader();
reader.setErrorHandler(null); // SAX 2.0.1 allows
reader.setContentHandler(null); // SAX 2.0.1 allows
reader.setEntityResolver(null); // SAX 2.0.1 allows
reader.setDTDHandler(null); // SAX 2.0.1 allows
}
catch (ParserConfigurationException e){
System.out.println("ParserConfigurationException thrown");
}
catch (SAXException e){
System.out.println("SAXException thrown");
}
catch (NullPointerException e){
System.out.println("NullPointerException thrown");
e.printStackTrace();
}
}
}
---- Output from running with Tiger ----
% java -version
java version "1.5.0-internal"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-internal-_14_aug_2003_22_01)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b15, mixed mode)
% javac Test.java
% java -cp . Test
NullPointerException thrown
java.lang.NullPointerException
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.setErrorHandler(AbstractSAXParser.java:1291)
at Test.run(Test.java:16)
at Test.main(Test.java:9)
- relates to
-
JDK-4912448 Some XMLReader.setXXX() methods incorrectly throw NullPointerException
-
- Closed
-