-
Bug
-
Resolution: Fixed
-
P2
-
6
-
b86
-
generic
-
generic
the spec states:
public String[][] getZoneStrings()
...
The value returned is a two-dimensional array of strings of size n by m, where m is at least 5.
a test text:
--------------------
import java.text.DateFormatSymbols;
public class Test {
public static void main( String[] args ){
DateFormatSymbols obj = new DateFormatSymbols();
String[][] zs = {
{ "GMT", "AA", "BB" }
};
obj.setZoneStrings(zs);
for( String[] s : obj.getZoneStrings() ){
if( s.length < 5 ){
System.out.println( "m = " + s.length );
System.out.println( "specification violation:\nThe value returned is a two-dimensional array of strings of size n by m, where m is at least 5." );
return;
}
}
System.out.println("OK");
}
}
--------------------
There are at least 3 ways to solve this problem:
- to throw IllegalArgumentException in setZoneStrings()
- appropriately modify array passed in setZoneStrings() before returning from getZoneStrings()
- to change the spec
public String[][] getZoneStrings()
...
The value returned is a two-dimensional array of strings of size n by m, where m is at least 5.
a test text:
--------------------
import java.text.DateFormatSymbols;
public class Test {
public static void main( String[] args ){
DateFormatSymbols obj = new DateFormatSymbols();
String[][] zs = {
{ "GMT", "AA", "BB" }
};
obj.setZoneStrings(zs);
for( String[] s : obj.getZoneStrings() ){
if( s.length < 5 ){
System.out.println( "m = " + s.length );
System.out.println( "specification violation:\nThe value returned is a two-dimensional array of strings of size n by m, where m is at least 5." );
return;
}
}
System.out.println("OK");
}
}
--------------------
There are at least 3 ways to solve this problem:
- to throw IllegalArgumentException in setZoneStrings()
- appropriately modify array passed in setZoneStrings() before returning from getZoneStrings()
- to change the spec