-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b49
-
sparc
-
solaris_2.6
Name: apR10229 Date: 04/07/2004
Filed By : SPB JCK team (###@###.###)
JDK : Tiger-b45
JCK : 1.5
Platform[s] : Linux
switch/Mode :
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] : N/A
Specification excerpt:
======================
--------- J2SE API spec v.1.5 ---------
...
void abort()
Abort the loading of the document that is currently being loaded by the LSParser. If the LSParser is currently not busy, a call to this method does nothing.
...
---------- end-of-excerpt ---------------
Problem description
===================
Method org.w3c.dom.ls.LSParser.abort() throws unexpected RuntimeException while
parser is busy loading the document though this behavior is not specified in API Doc.
Minimized test:
===============
------- Test.java -------
import java.io.*;
import org.w3c.dom.ls.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
public class Test {
public static void main(String[] argv) {
Document doc = null;
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = builder.parse(new StringBufferInputStream("<ROOT></ROOT>"));
} catch (Throwable e) {
e.printStackTrace();
}
DOMImplementationLS implLS = (DOMImplementationLS) doc.getImplementation().getFeature("LS","3.0");
final LSParser parser = implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS,null);
final LSInput input = implLS.createLSInput();
try {
input.setByteStream(new PipedInputStream(new PipedOutputStream()));
} catch(IOException e) {
e.printStackTrace();
}
Thread t = new Thread(new Runnable() {
public void run() {
Document d = parser.parse(input);
}
});
try {
t.start();
t.join(1000);
} catch(InterruptedException ie) {
ie.printStackTrace();
}
try {
parser.abort();
} catch (Throwable e) {
System.out.println("Unexpected exception: "+e);
e.printStackTrace();
System.exit(-1);
}
}
}
------- end-of-Test.java -------
Minimized test output:
======================
<pav@hammer(pts/3).287> java Test
Unexpected exception: java.lang.RuntimeException
java.lang.RuntimeException
at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.<clinit>(AbstractDOMParser.java:200)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.<init>(DocumentBuilderImpl.java:111)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:99)
at Test.main(Test.java:9)
<pav@hammer(pts/3).288>
JCK test source location:
==========================
/java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
Specific Machine Info:
=====================
Linux hammer 2.4.23 #6 Jan 27 14:05:57 MSK 2004 i686 unknown unknown GNU/Linux
======================================================================
Filed By : SPB JCK team (###@###.###)
JDK : Tiger-b45
JCK : 1.5
Platform[s] : Linux
switch/Mode :
JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
Failing Test [s] : N/A
Specification excerpt:
======================
--------- J2SE API spec v.1.5 ---------
...
void abort()
Abort the loading of the document that is currently being loaded by the LSParser. If the LSParser is currently not busy, a call to this method does nothing.
...
---------- end-of-excerpt ---------------
Problem description
===================
Method org.w3c.dom.ls.LSParser.abort() throws unexpected RuntimeException while
parser is busy loading the document though this behavior is not specified in API Doc.
Minimized test:
===============
------- Test.java -------
import java.io.*;
import org.w3c.dom.ls.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
public class Test {
public static void main(String[] argv) {
Document doc = null;
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = builder.parse(new StringBufferInputStream("<ROOT></ROOT>"));
} catch (Throwable e) {
e.printStackTrace();
}
DOMImplementationLS implLS = (DOMImplementationLS) doc.getImplementation().getFeature("LS","3.0");
final LSParser parser = implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS,null);
final LSInput input = implLS.createLSInput();
try {
input.setByteStream(new PipedInputStream(new PipedOutputStream()));
} catch(IOException e) {
e.printStackTrace();
}
Thread t = new Thread(new Runnable() {
public void run() {
Document d = parser.parse(input);
}
});
try {
t.start();
t.join(1000);
} catch(InterruptedException ie) {
ie.printStackTrace();
}
try {
parser.abort();
} catch (Throwable e) {
System.out.println("Unexpected exception: "+e);
e.printStackTrace();
System.exit(-1);
}
}
}
------- end-of-Test.java -------
Minimized test output:
======================
<pav@hammer(pts/3).287> java Test
Unexpected exception: java.lang.RuntimeException
java.lang.RuntimeException
at com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser.<clinit>(AbstractDOMParser.java:200)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.<init>(DocumentBuilderImpl.java:111)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(DocumentBuilderFactoryImpl.java:99)
at Test.main(Test.java:9)
<pav@hammer(pts/3).288>
JCK test source location:
==========================
/java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
Specific Machine Info:
=====================
Linux hammer 2.4.23 #6 Jan 27 14:05:57 MSK 2004 i686 unknown unknown GNU/Linux
======================================================================