Integrated: 8275344: -Xcheck:jni produces some warnings in the LCMS.c
Sergey Bylokhov
serb at openjdk.java.net
Fri Oct 22 03:08:07 UTC 2021
On Sun, 17 Oct 2021 00:09:12 GMT, Sergey Bylokhov <serb at openjdk.org> wrote:
> The newly added test MTTransformReplacedProfile(yeah that test again) produce some warning if check:jni is enabled:
>
> WARNING in native method: JNI call made with exception pending
> at sun.java2d.cmm.lcms.LCMS.setTagDataNative(java.desktop at 17-internal/Native Method)
> at sun.java2d.cmm.lcms.LCMSProfile.setTag(java.desktop at 17-internal/LCMSProfile.java:82)
> at sun.java2d.cmm.lcms.LCMS.setTagData(java.desktop at 17-internal/LCMS.java:84)
>
>
> The root cause is in the "errorHandler", which is called by the lcms library and where we throw a CMSException. So when we get an error code from some lcms API and try to throw the CMSException it is might be already thrown in the "errorHandler".
>
> The fix contains two parts:
> * If an exception already occurred we skip the creation of the CMSException. So the first error will be reported to the user.
> * If an exception already occurred we DO NOT skip the creation of the IllegalArgumentException, because it is required by the specification to be thrown. But we use the initial exception as a "cause" for the new IllegalArgumentException. Note that it is also possible to just clear an occurred exception before the creation of the IllegalArgumentException. Any thoughts about it?
>
> The second part changed the stack trace which will get the user, an example:
>
> old:
>
> java.lang.IllegalArgumentException: Can not write tag data.
> at java.desktop/sun.java2d.cmm.lcms.LCMS.setTagDataNative(Native Method)
> at java.desktop/sun.java2d.cmm.lcms.LCMSProfile.setTag(LCMSProfile.java:82)
> at java.desktop/sun.java2d.cmm.lcms.LCMS.setTagData(LCMS.java:84)
> at java.desktop/java.awt.color.ICC_Profile.setData(ICC_Profile.java:1132)
> at SetDataTest$TestCase.doTest(SetDataTest.java:77)
> at SetDataTest.main(SetDataTest.java:140)
>
> new:
>
> java.lang.IllegalArgumentException: Can not write tag data.
> at java.desktop/sun.java2d.cmm.lcms.LCMS.setTagDataNative(Native Method)
> at java.desktop/sun.java2d.cmm.lcms.LCMSProfile.setTag(LCMSProfile.java:82)
> at java.desktop/sun.java2d.cmm.lcms.LCMS.setTagData(LCMS.java:92)
> at java.desktop/java.awt.color.ICC_Profile.setData(ICC_Profile.java:1114)
> at SetDataTest$TestCase.doTest(SetDataTest.java:77)
> at SetDataTest.main(SetDataTest.java:140)
> Caused by: java.awt.color.CMMException: LCMS error 8: Unknown tag type 'AAAA' found.
> ... 6 more
This pull request has now been integrated.
Changeset: c978ca87
Author: Sergey Bylokhov <serb at openjdk.org>
URL: https://git.openjdk.java.net/jdk/commit/c978ca87de2d9152345dfd85983278c42bb28cd3
Stats: 67 lines in 2 files changed: 47 ins; 1 del; 19 mod
8275344: -Xcheck:jni produces some warnings in the LCMS.c
Reviewed-by: azvegint, prr, kizune
-------------
PR: https://git.openjdk.java.net/jdk/pull/5975
More information about the client-libs-dev
mailing list