Skip to content

Cleanup of IOException leftovers after update to jackson3#1244

Merged
stevehu merged 3 commits into
networknt:masterfrom
afiluba:fix/jackson3_exception_changed
Apr 20, 2026
Merged

Cleanup of IOException leftovers after update to jackson3#1244
stevehu merged 3 commits into
networknt:masterfrom
afiluba:fix/jackson3_exception_changed

Conversation

@afiluba
Copy link
Copy Markdown
Contributor

@afiluba afiluba commented Apr 15, 2026

To keep backward compatiblity with version 2.x catch JacksonException and rethrow as SchemaException

This is an proposition to fix #1243

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a Jackson 3 migration regression where invalid JSON passed to SchemaRegistry.getSchema() can escape as JacksonException instead of being wrapped in the library’s SchemaException, aiming to preserve the 2.x behavior described in #1243.

Changes:

  • Catch tools.jackson.core.JacksonException in SchemaRegistry.getSchema(...) and rethrow as SchemaException.
  • Update Schema input deserialization to convert JacksonException into the prior UncheckedIOException shape.
  • Adjust NodeReader/implementations and tests to align with the updated exception flow.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
src/main/java/com/networknt/schema/SchemaRegistry.java Wrap JacksonException from schema parsing into SchemaException in getSchema(...).
src/main/java/com/networknt/schema/Schema.java Preserve prior validate(...) exception contract by converting Jackson parse failures into UncheckedIOException.
src/main/java/com/networknt/schema/serialization/NodeReader.java Changes NodeReader method signatures by removing throws IOException.
src/main/java/com/networknt/schema/serialization/DefaultNodeReader.java Updates implementations to match the new NodeReader signature.
src/main/java/com/networknt/schema/serialization/BasicNodeReader.java Updates implementations/imports to match the new NodeReader signature.
src/test/java/com/networknt/schema/SchemaRegistryTest.java Adds regression test asserting invalid JSON schema input yields SchemaException.
src/test/java/com/networknt/schema/serialization/DefaultNodeReaderTest.java Removes now-unnecessary throws IOException from tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/com/networknt/schema/serialization/NodeReader.java
Comment thread src/main/java/com/networknt/schema/SchemaRegistry.java Outdated
Comment thread src/main/java/com/networknt/schema/SchemaRegistry.java Outdated
Comment thread src/main/java/com/networknt/schema/Schema.java Outdated
Comment thread src/main/java/com/networknt/schema/Schema.java Outdated
Comment thread src/test/java/com/networknt/schema/SchemaRegistryTest.java Outdated
@afiluba afiluba changed the title Avoid SchemaRegistry.getSchema() to emit JacksonException Cleanup of IOException leftovers after update to jackson3 Apr 16, 2026
@stevehu stevehu requested a review from Copilot April 17, 2026 13:39
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/com/networknt/schema/SchemaRegistry.java
@stevehu stevehu merged commit 331ced5 into networknt:master Apr 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JacksonException emited from SchemaRegistry. getSchema() on invalid json

4 participants