Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
The specification of JNI function GetDirectBufferCapacity() reads:
"Returns the capacity in bytes of the memory region associated with the buffer. Returns -1 if the given object is not a direct java.nio.Buffer, or if JNI access to direct buffers is not supported by this virtual machine. "
However it returns 0 for non-byte views of a direct buffer, i.e. buffers obtained like this:
ByteBuffer.allocateDirect(100).asCharBuffer();
Surprisingly, RI behaves in the same way; I found related bugreport [1] against Sun's JDK which has really vague evaluation. Briefly, it says that they don't want to spend efforts fixing this bug untill real use case exists and unaligned view buffers aren't supposed to work (at least on some architectures like sparc) anyway. How do you like that?
I see no problem to fix this in Harmony and suppose we should follow the spec here.
[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4528170
Attachments
Issue Links
- is part of
-
HARMONY-3591 [classlib][nio] Can't run simple 3D HWA application using lwjgl library
- Resolved