harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy, Jing Lv (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-1156) [DRLVM][JNI]GetByteArrayRegion differs from RI in throwing ArrayIndexOutOfBoundsException.
Date Tue, 15 Aug 2006 03:51:30 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-1156?page=comments#action_12428032 ] 
Jimmy, Jing Lv commented on HARMONY-1156:

    Yes, I have a simple test putting in the mailing-list.
    The test:
class test
    private native void testjni(byte[] bs);
    public void usejni(){
        testjni(new byte[512]);
    public static void main(String args[]){
        new test().usejni();
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class test */

#ifndef _Included_test
#define _Included_test
#ifdef __cplusplus
extern "C" {
 * Class:     test
 * Method:    testjni
 * Signature: ([B)V
JNIEXPORT void JNICALL Java_test_testjni
  (JNIEnv *, jobject, jbyteArray);

#ifdef __cplusplus
#include "test.h"
JNIEXPORT void JNICALL Java_test_testjni
  (JNIEnv * env, jobject obj,jbyteArray array){
      jsize length = (*env)->GetArrayLength(env, array);
      jbyte* buf = (jbyte*)malloc(sizeof(jbyte)*jsize);
      (*env)->GetByteArrayRegion(env,array,jsize, 0, buf);

(magic number 512 can be any integer greater than or equals to zero)
And compile test.c to testjni.dll:
cl -I$JAVAPATH\include -I$JAVAPATH\include\win32 -LD test.c -Fetestjni.dll
(JAVAPATH is the path of java)

> [DRLVM][JNI]GetByteArrayRegion differs from RI in throwing ArrayIndexOutOfBoundsException.
> ------------------------------------------------------------------------------------------
>                 Key: HARMONY-1156
>                 URL: http://issues.apache.org/jira/browse/HARMONY-1156
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Jimmy, Jing Lv
>         Assigned To: Geir Magnusson Jr
>            Priority: Critical
> Hi,
>     JNI method GetByteArrayRegion(byte[],offset,count) throws ArrayIndexOutOfBoundsException
if the given offset is equal to length of byte array and the given count is zero. This is
different from RI (it returns immediately).

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


View raw message