Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4132668

(jni) JNI function FindClass throws NoSuchMethodError

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: ouC59006 Date: 04/27/98



      JDK1.1.6N and JDK-1.2beta4-C fail to pass JCK test fncl00103.

      In concise form of the test (see source code below), FindClass of JDK1.1.6N
      throws NoSuchMethodError, while it should throw NoClassDefFoundError:

      > java -fullversion
      java full version "JDK1.1.6N"
      > java -verify javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103
      java.lang.NoSuchMethodError: $Á?
      at javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103.main(fncl00103.java:10)
      >

      When run with JDK-1.2beta4-C, the same example produces the
      following output:

      > java -fullversion
      java full version "JDK-1.2beta4-C"
      > java -verify javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103
      Exception in thread "main" java.lang.StringIndexOutOfBoundsException
      at java.lang.ClassLoader.findSystemClass0(Native Method)
      at java.lang.ClassLoader.findSystemClass(ClassLoader.java:370)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:234)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:232)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:192)
      at javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103.Nat1(Native Method)
      at javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103.main(fncl00103.java:10)
      >

      Note that JDK-1.2beta3-N successfully passes the test:

      > java -fullversion
      java full version "JDK-1.2beta3-N"
      > java -verify javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103
      java.lang.NoClassDefFoundError: $Á?
      at javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103.Nat1(Native Method)
      at javasoft.sqe.tests.vm.fncl001.fncl00103.fncl00103.main(fncl00103.java:10)
      >

      --------------------fncl00103.java----------------------
      package javasoft.sqe.tests.vm.fncl001.fncl00103;

      public class fncl00103 {
      native int Nat1();
      public static void main(String argv[]) {
      try {
      System.loadLibrary("jckjni");
      }
      catch ( UnsatisfiedLinkError e ) {}
      new fncl00103().Nat1();
      }
      }
      --------------------fncl00103.c----------------------
      #include "jckjni.h"

      JNIEXPORT void JNICALL Java_javasoft_sqe_tests_vm_fncl001_fncl00103_fncl00103_Nat1(
      JNIEnv *env, jobject obj) {
      static char s[] = { (char)36, (char)-61, (char)-127,
      (char)-32, (char)-90, (char)-122, 0 };
      (*env) -> FindClass(env, s);
      }
      --------------------------------------------------------------------------------

      ======================================================================

            Unassigned Unassigned
            oulyankisunw Oleg Ulyankin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: