-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JDK 16 Illegal reflective access for Throwable.setCause()
with PropertyNamingStrategy.UPPER_CAMEL_CASE
#3275
Comments
Hmmh. This may be tricky, due to the way Some thoughts, notes:
If so, the challenge here is, I think, that This also looks like it could possibly be fixed in a patch after 2.13.0 is released (which I intend to do this week), not requiring a minor version update (that is, I think fix does not require API changes). |
I'm getting this error with AWS KMS SDK and Java 17
|
@gsinghlulu I would need a fully reproduction to know what happens; stack trace alone is not enoigh. |
This exception is thrown we try to decrypt a text that was encrypted using a key which application do not have access. Root cause of this exception is |
Looking at the original report, the issue is wrt attempts to deserialize an Exception, during which I am not quite sure how to proceed with this: my first instinct is to try to suppress the failure (well, very first thing is JDK17-specific test case but after that) for this specific setter. |
I found something interesting, there are 2 cause properties showing up for
|
See my comments in FasterXML#3275
I raise a PR to workaround the issue. It's working for Java 17. Please review |
@gsinghlulu This is not really related to the issue reported here is it? Could you please file a separate issue if not related to the original issue -- PR can be attached to that one. |
Though my issue is with AWS SDK it is because they are using
Refer |
@gsinghlulu ah! Ok, I should paid closer attention there. Ok I can see how things might go there... hmmh. ... but perhaps it is, as you mentioned, from I think I will have another look here: thank you for providing the potential fix, as well as explaining it -- and apologies for misunderstanding it first. |
Hmmh. The most confusing aspect is the alleged method |
@cowtowncoder it is a package-private method that was introduced in java 12: https://code.yawk.at/java/17/java.base/java/lang/Throwable.java?diff=/java/11/java.base/java/lang/Throwable.java#java.lang.Throwable%23setCause(java.lang.Throwable) |
@cowtowncoder Yes I agree it's not an optimal fix, but rather a workaround. The uppercase Cause is coming from the |
@yawkat Ok. Just didn't see it in JDK javadocs; I guess only public (and maybe @gsinghlulu yes, correct on both accounts. I think fix is along the right lines; will see if we could first remove |
Throwable.setCause()
with PropertyNamingStrategy.UPPER_CAMEL_CASE
Ok, yes, JDK 12 added This specific issue now fixed in 2.13 (for 2.13.4, then 2.14.0). |
(Cherry-pick of FasterXML@2f60d39)
Describe the bug
Mapping a json string to an instance of RuntimeException with JDK 16 (which defaults to denying illegal reflective access) while using UPPER_CAMEL_CASE property naming strategy, fails with:
This manifests in parts of the AWS v1 SDK when an error is received from the AWS API endpoints. Note example report: #2464 (comment)
The simplified reproduce case below is based on what the failing AWS SDK code is doing internally in
com.amazonaws.transform.JsonErrorUnmarshaller.unmarshall
.Version information
2.12.3, 2.12.5, 2.13.0-rc2
To Reproduce
Execute this code without any
--add-opens
params and with default--illegal-access
setting of deny.Expected behavior
It is expected that the code above would throw a RuntimeException with a message of "This is my runtime exception message". This is what happens when working around the issue with java parameter
--add-opens java.base/java.lang=ALL-UNNAMED
Additional context
Using java parameter
--illegal-access=debug
results in the following additional info:Note that the issue does not manifest without
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.UPPER_CAMEL_CASE);
The text was updated successfully, but these errors were encountered: