-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b90
-
generic
-
generic
When any Exception is wrapped into an XMLStreamException, message of the original exception is not forwarded up to the stack. This results into a null message where developer doesn't have a clue about what has gone wrong.
-----------------------------------------------------------------
import javax.xml.stream.*;
import java.io.*;
import junit.framework.TestCase;
import junit.textui.TestRunner;
public class ExceptionTest extends TestCase{
public ExceptionTest(String name) {
super(name);
}
public static void main(String [] args) {
TestRunner.run(ExceptionTest.class);
}
public void testException(){
final String EXPECTED_OUTPUT = "Test XMLStreamException";
try{
Exception ex = new IOException("Test XMLStreamException");
throw new XMLStreamException(ex);
} catch(XMLStreamException e){
assertTrue("XMLStreamException does not contain the message " +
"of the wrapped exception",
e.getMessage().contains(EXPECTED_OUTPUT));
}
}
}
-------------------------------------------------------------------------------
-----------------------------------------------------------------
import javax.xml.stream.*;
import java.io.*;
import junit.framework.TestCase;
import junit.textui.TestRunner;
public class ExceptionTest extends TestCase{
public ExceptionTest(String name) {
super(name);
}
public static void main(String [] args) {
TestRunner.run(ExceptionTest.class);
}
public void testException(){
final String EXPECTED_OUTPUT = "Test XMLStreamException";
try{
Exception ex = new IOException("Test XMLStreamException");
throw new XMLStreamException(ex);
} catch(XMLStreamException e){
assertTrue("XMLStreamException does not contain the message " +
"of the wrapped exception",
e.getMessage().contains(EXPECTED_OUTPUT));
}
}
}
-------------------------------------------------------------------------------