FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
FindClass won't find an array class using the method specified in the documentation.
e.g. This doesn't work: cls = (*env)->FindClass(env, "[java/lang/Integer" );
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run C code below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If you uncomment those 5 lines of code I would expect it to output "hurray it works as specified".
ACTUAL -
It can't find "[java/lang/Integer".
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
#include <jni.h>
main()
{
JNIEnv* env;
JavaVM* jvm;
JavaVMInitArgs vm_args = {0};
jint res;
jclass cls = 0;
vm_args.version = JNI_VERSION_1_2;
res = JNI_CreateJavaVM(&jvm, (void**)&env,&vm_args);
// Uncommenting the following lines causes the other FindClass calls to fail.
// cls = (*env)->FindClass(env, "[java/lang/Integer" );
// if ( cls == 0 ) {
// printf( "Can't find [java/lang/Integer\n");
// }
// else { printf("hurray it works as specified");}
cls = (*env)->FindClass(env, "[Ljava/lang/Integer;" );
if ( cls == 0 ) {
printf( "Can't find [Ljava/lang/Integer;\n");
}
else {
printf( "Can find [Ljava/lang/Integer;\n" );
}
cls = (*env)->FindClass(env, "java/lang/Integer" );
if ( cls == 0 ) {
printf( "Can't find java/lang/Integer\n");
}
else {
printf( "Can find java/lang/Integer\n" );
}
cls = (*env)->FindClass(env, "Ljava/lang/Integer;" );
if ( cls == 0 ) {
printf( "Can't find Ljava/lang/Integer;\n");
}
else {
printf( "Can find Ljava/lang/Integer;\n" );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can use:
cls = (*env)->FindClass(env, "[Ljava/lang/Integer;" );
###@###.### 2005-1-11 04:46:16 GMT
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
FindClass won't find an array class using the method specified in the documentation.
e.g. This doesn't work: cls = (*env)->FindClass(env, "[java/lang/Integer" );
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run C code below.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
If you uncomment those 5 lines of code I would expect it to output "hurray it works as specified".
ACTUAL -
It can't find "[java/lang/Integer".
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
#include <jni.h>
main()
{
JNIEnv* env;
JavaVM* jvm;
JavaVMInitArgs vm_args = {0};
jint res;
jclass cls = 0;
vm_args.version = JNI_VERSION_1_2;
res = JNI_CreateJavaVM(&jvm, (void**)&env,&vm_args);
// Uncommenting the following lines causes the other FindClass calls to fail.
// cls = (*env)->FindClass(env, "[java/lang/Integer" );
// if ( cls == 0 ) {
// printf( "Can't find [java/lang/Integer\n");
// }
// else { printf("hurray it works as specified");}
cls = (*env)->FindClass(env, "[Ljava/lang/Integer;" );
if ( cls == 0 ) {
printf( "Can't find [Ljava/lang/Integer;\n");
}
else {
printf( "Can find [Ljava/lang/Integer;\n" );
}
cls = (*env)->FindClass(env, "java/lang/Integer" );
if ( cls == 0 ) {
printf( "Can't find java/lang/Integer\n");
}
else {
printf( "Can find java/lang/Integer\n" );
}
cls = (*env)->FindClass(env, "Ljava/lang/Integer;" );
if ( cls == 0 ) {
printf( "Can't find Ljava/lang/Integer;\n");
}
else {
printf( "Can find Ljava/lang/Integer;\n" );
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
You can use:
cls = (*env)->FindClass(env, "[Ljava/lang/Integer;" );
###@###.### 2005-1-11 04:46:16 GMT
- relates to
-
JDK-6392502 FindClass behaviour contradicts with specs
-
- Closed
-