Skip to content

CXF-9107 Clean up coverity resource leaks and a javascript method typo#2253

Closed
cunningt wants to merge 2 commits intoapache:mainfrom
cunningt:CXF-9107
Closed

CXF-9107 Clean up coverity resource leaks and a javascript method typo#2253
cunningt wants to merge 2 commits intoapache:mainfrom
cunningt:CXF-9107

Conversation

@cunningt
Copy link
Contributor

@cunningt cunningt commented Feb 3, 2025

https://issues.apache.org/jira/browse/CXF-9107

Clean up coverity resource leaks (inputstream and resultset) and a javascript method typo

} else {
response = checkAdapter(response, type, anns, false);
}
realStream.close();
Copy link
Member

Choose a reason for hiding this comment

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

So this may not work: the stream is not created here and should not be closed here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we do this within a try-with-resources?

Copy link
Member

@reta reta Feb 5, 2025

Choose a reason for hiding this comment

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

I am pretty sure it is being done this way (higher in the stack), when the request / response body is being processed

Copy link
Member

Choose a reason for hiding this comment

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

@cunningt could you please revert this one change and we are good to go, as per spec:

The caller is responsible for ensuring that the input stream ends when the entity has been consumed. The implementation should not close the input stream.

gnodet added a commit to gnodet/cxf that referenced this pull request Mar 10, 2026
- Wrap InputStream in try-with-resources in
  PlugInClassLoader.getProperties()
- Wrap ResultSet in try-with-resources in
  RMTxStore.verifyTable()

Based on the valid parts of PR apache#2253 (CXF-9107).

Closes apache#2253
@gnodet
Copy link
Contributor

gnodet commented Mar 10, 2026

Superseded by #2943 which cherry-picks the two valid fixes (PlugInClassLoader and RMTxStore). The JavaScript typo fix was already merged via #2781, and the JSONProvider change was not applied per JAX-RS spec (the caller is responsible for closing the input stream).

@gnodet gnodet closed this Mar 10, 2026
reta pushed a commit that referenced this pull request Mar 10, 2026
- Wrap InputStream in try-with-resources in
  PlugInClassLoader.getProperties()
- Wrap ResultSet in try-with-resources in
  RMTxStore.verifyTable()

Based on the valid parts of PR #2253 (CXF-9107).

Closes #2253
reta pushed a commit that referenced this pull request Mar 10, 2026
- Wrap InputStream in try-with-resources in
  PlugInClassLoader.getProperties()
- Wrap ResultSet in try-with-resources in
  RMTxStore.verifyTable()

Based on the valid parts of PR #2253 (CXF-9107).

Closes #2253

(cherry picked from commit 1c66ea6)
reta pushed a commit that referenced this pull request Mar 11, 2026
- Wrap InputStream in try-with-resources in
  PlugInClassLoader.getProperties()
- Wrap ResultSet in try-with-resources in
  RMTxStore.verifyTable()

Based on the valid parts of PR #2253 (CXF-9107).

Closes #2253

(cherry picked from commit 1c66ea6)
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.

3 participants