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

JNI GetEnv for JVMDI returns wrong class of error code and fails for current ver

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.4.2
    • 1.4.1
    • vm-legacy
    • None
    • mantis
    • generic
    • generic

      The JNI GetEnv function is supposed to return JNI error codes which
      are all negative numbers. Thus,

         if ((jvm->GetEnv((void **)&interface, version)) < 0) {
            ... error processing ...

      is the standard usage pattern. For JVMDI,

         if ((jvm->GetEnv((void **)&jvmdi, JVMDI_VERSION_1)) < 0) {
            ... error processing ...

      the error test will fail and an uninitialized interface pointer
      will be returned if debugging is not enabled,

          } else if (version == JVMDI_VERSION_1) {
            if (jvmdi::enabled()) {
              *penv = (void *)jvmdi::GetInterface_1(vm);
              return JNI_OK;
            } else {
              return JVMDI_ERROR_ACCESS_DENIED;
            }

      since the code returns a JVMDI error code which is a positive
      number and is not a JNI error code as specified. Note also that
      current versions (JVMDI_VERSION_1, JVMDI_VERSION_1_1, ...) cannot
      be specified (see how JNI and JVMPI handle this).

            busersunw Btplusnull User (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: