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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 24
    • 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.

            Unassigned Unassigned
            lbourges Laurent Bourgès
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: