-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b76
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8136006 | emb-9 | Brian Burkhalter | P4 | Resolved | Fixed | team |
A DESCRIPTION OF THE REQUEST :
The message included in the IllegalArgumentException thrown from Java.nio's Buffer class is "null".
JUSTIFICATION :
A message in the exception thrown would make it easier to understand what went wrong when trying to set the position or the limit of the Buffer.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Simple message describing what went wrong.
ACTUAL -
"null" message.
---------- BEGIN SOURCE ----------
Not in a test case format, but you'll get the idea...
public static void main(String[] args) throws InterruptedException {
System.out.println("Java version: " + System.getProperty("java.version"));
System.out.println("==== Test #1 ====");
try {
ByteBuffer bb = ByteBuffer.allocateDirect(1024);
bb.position(1025);
} catch (IllegalArgumentException e) {
System.out.println("Caught exception of type : " + e.getClass());
System.out.println("With Message: " + e.getMessage());
e.printStackTrace();
}
Thread.sleep(100);
System.out.println("==== Test #2 ====");
try {
ByteBuffer bb = ByteBuffer.allocateDirect(1024);
bb.limit(1025);
} catch (IllegalArgumentException e) {
System.out.println("Caught exception of type : " + e.getClass());
System.out.println("With Message: " + e.getMessage());
e.printStackTrace();
}
}
Which outputs:
Java version: 1.8.0_25
==== Test #1 ====
Caught exception of type : class java.lang.IllegalArgumentException
With Message: null
java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:244)
at BufferEnhTest.main(BufferEnhTest.java:13)
==== Test #2 ====
Caught exception of type : class java.lang.IllegalArgumentException
With Message: null
java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:275)
at BufferEnhTest.main(BufferEnhTest.java:26)
---------- END SOURCE ----------
The message included in the IllegalArgumentException thrown from Java.nio's Buffer class is "null".
JUSTIFICATION :
A message in the exception thrown would make it easier to understand what went wrong when trying to set the position or the limit of the Buffer.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Simple message describing what went wrong.
ACTUAL -
"null" message.
---------- BEGIN SOURCE ----------
Not in a test case format, but you'll get the idea...
public static void main(String[] args) throws InterruptedException {
System.out.println("Java version: " + System.getProperty("java.version"));
System.out.println("==== Test #1 ====");
try {
ByteBuffer bb = ByteBuffer.allocateDirect(1024);
bb.position(1025);
} catch (IllegalArgumentException e) {
System.out.println("Caught exception of type : " + e.getClass());
System.out.println("With Message: " + e.getMessage());
e.printStackTrace();
}
Thread.sleep(100);
System.out.println("==== Test #2 ====");
try {
ByteBuffer bb = ByteBuffer.allocateDirect(1024);
bb.limit(1025);
} catch (IllegalArgumentException e) {
System.out.println("Caught exception of type : " + e.getClass());
System.out.println("With Message: " + e.getMessage());
e.printStackTrace();
}
}
Which outputs:
Java version: 1.8.0_25
==== Test #1 ====
Caught exception of type : class java.lang.IllegalArgumentException
With Message: null
java.lang.IllegalArgumentException
at java.nio.Buffer.position(Buffer.java:244)
at BufferEnhTest.main(BufferEnhTest.java:13)
==== Test #2 ====
Caught exception of type : class java.lang.IllegalArgumentException
With Message: null
java.lang.IllegalArgumentException
at java.nio.Buffer.limit(Buffer.java:275)
at BufferEnhTest.main(BufferEnhTest.java:26)
---------- END SOURCE ----------
- backported by
-
JDK-8136006 (bf) Buffer.position and other methods should include detail in IAE
-
- Resolved
-
- duplicates
-
JDK-8160959 IllegalArgumentException thrown from position() is hard to understand
-
- Closed
-
-
JDK-8206446 Better error messages on `Buffer.position` and `Buffer.limit`
-
- Closed
-
- relates to
-
JDK-8132795 Bug ID accidentally omitted from top level regression test in fix for JDK-8065556
-
- Closed
-