Duration(java.lang.String lexicalRepresentation) throws StringIndexOutOfBoundsException when 'lexicalRepresentation' is a blank string ""
but according to the spec this case should throw java.lang.IllegalArgumentException
Test Program - Test1.java
-----------------------------------------------------------------------------
import javax.xml.datatype.Duration;
public class Test1 {
Test1() {}
// main()
public static void main(String[] argv) {
Test1 test1 = new Test1();
test1.checkDuration01();
} //end main()
// test for constructor Duration(java.lang.String lexicalRepresentation)
// lexRepresentation - invalid blank string "" - should throw IllegalArgumentException
private void checkDuration01() {
String lexRepresentation = "" ;
try{
Duration duration01 = new Duration(lexRepresentation);
System.out.println(" Expected IllegalArgumentException not thrown - checkDuration01() failed ");
}catch( NullPointerException npe){
System.out.println(" NPE thrown - checkDuration01() failed ");
}catch( IllegalArgumentException iae){
System.out.println(" Expected IllegalArgumentException thrown - checkDuration01() passed ");
}catch( StringIndexOutOfBoundsException sioobe ){
System.out.println(" StringIndexOutOfBoundsException thrown - checkDuration01() failed "+sioobe.getMessage());
}catch( Exception e){
System.out.println(" Exception thrown - checkDuration01() failed " );
}
}
}
-----------------------------------------------------------------------------
---------------------------------
verified in Tiger 1.5.0-beta2-b44
###@###.### 2004-03-30
---------------------------------
but according to the spec this case should throw java.lang.IllegalArgumentException
Test Program - Test1.java
-----------------------------------------------------------------------------
import javax.xml.datatype.Duration;
public class Test1 {
Test1() {}
// main()
public static void main(String[] argv) {
Test1 test1 = new Test1();
test1.checkDuration01();
} //end main()
// test for constructor Duration(java.lang.String lexicalRepresentation)
// lexRepresentation - invalid blank string "" - should throw IllegalArgumentException
private void checkDuration01() {
String lexRepresentation = "" ;
try{
Duration duration01 = new Duration(lexRepresentation);
System.out.println(" Expected IllegalArgumentException not thrown - checkDuration01() failed ");
}catch( NullPointerException npe){
System.out.println(" NPE thrown - checkDuration01() failed ");
}catch( IllegalArgumentException iae){
System.out.println(" Expected IllegalArgumentException thrown - checkDuration01() passed ");
}catch( StringIndexOutOfBoundsException sioobe ){
System.out.println(" StringIndexOutOfBoundsException thrown - checkDuration01() failed "+sioobe.getMessage());
}catch( Exception e){
System.out.println(" Exception thrown - checkDuration01() failed " );
}
}
}
-----------------------------------------------------------------------------
---------------------------------
verified in Tiger 1.5.0-beta2-b44
###@###.### 2004-03-30
---------------------------------