-
Bug
-
Resolution: Fixed
-
P4
-
1.1
-
beta
-
generic
-
solaris_7
Name: vtR10009 Date: 12/07/2000
JAXP 1.1 method TransformerException.initCause(Throwable) doesn't throw
IllegalStateException for instance that was created with TransformerException(Exception)
constructor as well as it throws this exception for instance that was created with
TransformerException(String) constructor. See log below.
This contradicts JAXP 1.1 spec.
JAXP 1.1 spec reads:
" This method can be called at most once. It is generally called from within the
constructor, or immediately after creating the throwable. If this throwable was
created with TransformerException(Exception) or TransformerException(String,Exception),
this method cannot be called even once.
Throws:
IllegalStateException - if this throwable was created with
TransformerException(Exception) or TransformerException(String,Exception),
or this method has already been called on this throwable."
This bug presents in build jaxp-1.1ea2-b15-30_nov_2000 and affects the new test in
TCK JAXP 1.1.
------------------------------------test.java-----------------------------
public class test {
public static void main(String argv[]) {
String mess = "Message string";
Throwable cause;
Exception ex1 = new Exception(mess);
Exception ex2 = new Exception(mess);
TransformerException tePreInit = new TransformerException(ex1);
TransformerException teNotInit = new TransformerException(mess);
try{
teNotInit.initCause(ex2);
}catch(IllegalStateException ilStEx){
System.out.println("Allert."+ilStEx.getMessage());
}
try {
cause=tePreInit.initCause(ex2);
}catch(IllegalStateException ilStEx){
System.out.println("Ok."+ilStEx.getMessage());
System.exit(0);
}
System.out.println("Cause can't be overwritten. "
+"IllegalStateException wasn't thrown. "
+tePreInit.getCause().getMessage());
}
}
---------------------------------------------------------------------------
---------------------------------------------------------------------------
novo101:tests$ $JDK13/bin/java test
Allert.Can't overwrite cause
Cause can't be overwritten. IllegalStateException wasn't thrown. Message string
---------------------------------------------------------------------------
======================================================================