| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
JWTParser was wrapping malformed JSON errors in a JWTDecodeException without keeping the original IOException as the cause. This change passes the original IOException through so callers can inspect the root cause. It also adds a regression test for malformed JSON parsing.
| Back | FazBrowse Home | New Git URL |
Changes
JWTParser.parsePayload and JWTParser.parseHeader catch the Jackson IOException
thrown while parsing a token's JSON, but rethrow it as a JWTDecodeException without
passing the original exception as the cause. As a result, Jackson's parsing details,
including the message and source location, are lost from the exception chain.
This PR forwards the caught IOException as the cause:
that builds the same message and passes the cause through.
only getCause() on the parse-failure path changes from null to the underlying Jackson exception.
Before:
After:
References
Found via static analysis: PMD's PreserveStackTrace rule flags both catch sites.
No related support ticket or community post.
Testing
Added JWTParserTest.shouldPreserveCauseWhenParsingInvalidJson, which asserts the thrown
JWTDecodeException's cause is the underlying IOException.
Ran the full module suite with ./gradlew :java-jwt:test: 680 tests, 0 failures
This change adds unit test coverage
This change has been tested on the latest version of the platform/language
Checklist