harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexey Varlamov (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-3638) [classlib][nio] JNI function GetDirectBufferCapacity() returns 0 on non-byte views of a direct buffer
Date Thu, 12 Apr 2007 15:20:32 GMT
[classlib][nio] JNI function GetDirectBufferCapacity() returns 0 on non-byte views of a direct
buffer
-----------------------------------------------------------------------------------------------------

                 Key: HARMONY-3638
                 URL: https://issues.apache.org/jira/browse/HARMONY-3638
             Project: Harmony
          Issue Type: Bug
          Components: Classlib, Non-bug differences from RI
            Reporter: Alexey Varlamov
            Priority: Minor


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

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message