• Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 9
    • None
    • hotspot

      The specification for GetString[UTF]Chars is ambiguous ( the Sheng Liang JNI book is at odds with the online specification ). It is not clear if there is a JNI pending exception if the function returns NULL.
      To ensure that an exception is thrown the following pattern (or similar) needs to be used.

            if (obj == NULL) {
                if (!(*env)->ExceptionCheck(env))
                    JNU_ThrowOutOfMemoryError(env, NULL);
                return NULL;
           }

      Since both out of memory and throwing exceptions is rare supplying extra code to check
      for conditions that do not occur is wasteful.

      Please clarify the JNI specification.

            Unassigned Unassigned
            rriggs Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: