JNI uses of ExceptionOccurred() treated as if function returns a bool

XMLWordPrintable

    • Type: Bug
    • Resolution: Delivered
    • Priority: P4
    • 24
    • Affects Version/s: 24
    • Component/s: core-libs
    • None

      As JNI ExceptionOccured(env) returns a jthrowable reference that should be freed by DeleteLocalRef(jthrowable), it should not be used to test if an exception is pending but use JNI ExceptionCheck(env) instead that returns a boolean.

      I used JetBrains CLion to quickly check all OpenJDK src/ folder using the pattern 'if.*ExceptionOccurred' and found 235 invalid cases.

      As this problem is low level (leak) and very wide-spread, I cannot deal with such a large patch myself.

        There are no Sub-Tasks for this issue.

            Assignee:
            Justin Lu
            Reporter:
            Laurent Bourgès
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: