Repository navigation
Fixed Polaris reported CWE-404 - #1987
Open
hmadala001 wants to merge 1 commit into
Open
hmadala001 wants to merge 1 commit into
hmadala001 wants to merge 1 commit into
Conversation
hmadala001
requested review from
NiteshMehta,
adganta,
ashokrprogress,
prgs-rsingh,
rjrudin and
vishwach
as code owners
November 5, 2026 05:06
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Regression tests are missing for both changed InputStream overloads to verify underlying input cleanup when unconsumed or partially consumed streams are closed and UncheckedIOException when InputStream.close() fails.
1 open issue
What changed in this PR
This PR addresses Polaris-reported CWE-404 resource cleanup issues in the Java client library and its Jackson example.
Changes:
- Use try-with-resources for JSON generators and the example input stream.
- Close internally created JSON parsers when splitter streams are closed or stream setup fails.
| File | Description |
|---|---|
marklogic-client-api/src/main/java/com/marklogic/client/pojo/util/GenerateIndexConfig.java |
Ensure the configuration generator closes on failure. |
marklogic-client-api/src/main/java/com/marklogic/client/io/JacksonParserHandle.java |
Ensure generators close in both write implementations. |
marklogic-client-api/src/main/java/com/marklogic/client/datamovement/JSONSplitter.java |
Add parser cleanup handlers and setup-failure cleanup. |
examples/src/main/java/com/marklogic/client/example/handle/JacksonHandleExample.java |
Scope the example input stream with try-with-resources. |
Review effort: Balanced
| JsonParser jsonParser = new JsonFactory().createParser(input); | ||
| return split(jsonParser); | ||
| try { | ||
| return split(jsonParser).onClose(() -> closeParser(jsonParser)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.