Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8083439 | emb-9 | Chris Plummer | P4 | Resolved | Fixed | master |
Tried on Solaris 9 JDK 1.5.0_01-ea-b03.
See the following testcase:
import java.lang.reflect.Array;
public class Test2 {
public static void main (String args[]) {
Object[] objArray = {new Integer(Integer.MAX_VALUE), new
Integer(Integer.MIN_VALUE)};
for(int i=0; i<Array.getLength(objArray); i++){
System.out.println(Array.get(objArray,i));
System.out.println(Array.getInt(objArray,i));
}
}
}
Output :
2147483647
Exception in thread "main" java.lang.IllegalArgumentException: Argument
is not an array
at java.lang.reflect.Array.getInt(Native Method)
at Test2.main(Test2.java:8)
The Exception message that it is throwing "Argument is not an
array", is misleading to the user as the argument is an array.
Not only for getInt, it behaves the same way for getBoolean, getByte, getFloat, getChar, getDouble, getLong and getShort.
###@###.### 2004-11-05 04:17:05 GMT
See the following testcase:
import java.lang.reflect.Array;
public class Test2 {
public static void main (String args[]) {
Object[] objArray = {new Integer(Integer.MAX_VALUE), new
Integer(Integer.MIN_VALUE)};
for(int i=0; i<Array.getLength(objArray); i++){
System.out.println(Array.get(objArray,i));
System.out.println(Array.getInt(objArray,i));
}
}
}
Output :
2147483647
Exception in thread "main" java.lang.IllegalArgumentException: Argument
is not an array
at java.lang.reflect.Array.getInt(Native Method)
at Test2.main(Test2.java:8)
The Exception message that it is throwing "Argument is not an
array", is misleading to the user as the argument is an array.
Not only for getInt, it behaves the same way for getBoolean, getByte, getFloat, getChar, getDouble, getLong and getShort.
###@###.### 2004-11-05 04:17:05 GMT
- backported by
-
JDK-8083439 (reflect) Misleading detail string in IllegalArgumentException thrown by Array.get<Type>
-
- Resolved
-