Skip to content

Conversation

@rrousset-michelin
Copy link

No description provided.

@rrousset-michelin rrousset-michelin force-pushed the green-code-initiative/ISSUE_69 branch from d29ec24 to e43b26d Compare October 3, 2024 11:47
@dedece35 dedece35 linked an issue Oct 4, 2024 that may be closed by this pull request
@@ -0,0 +1,45 @@
package files;
Copy link
Member

Choose a reason for hiding this comment

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

please rename this test class with an explicit name corresponding to use case instead of "2"

Copy link
Member

Choose a reason for hiding this comment

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

I will done it if you want after the merge of this PR (if you don't have time to do it)

* The "try" should have been poped from the stack before entering here
*/
private void calledMethodWithoutTry() throws IOException {
FileWriter myWriter = new FileWriter("somefilepath");
Copy link
Member

Choose a reason for hiding this comment

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

sorry, but for me, this use case is an "non compliant" case.
This is a good example explaining that if the FileWriter is instanciated inside a private method, it must be protected with a try-with-resource. In this case, it must be done.
Sorry I can't accept the correction ... for me, the global algorithm must be refactored to manage this use case !

@sonarqubecloud
Copy link

@github-actions
Copy link

This PR has been automatically marked as stale because it has no activity for 30 days.
Please add a comment if you want to keep the issue open. Thank you for your contributions!

@github-actions github-actions bot added the stale label Nov 28, 2024
@sonarqubecloud
Copy link

Please retry analysis of this Pull-Request directly on SonarQube Cloud

@github-actions github-actions bot removed the stale label Dec 14, 2024
@github-actions
Copy link

This PR has been automatically marked as stale because it has no activity for 30 days.
Please add a comment if you want to keep the issue open. Thank you for your contributions!

@github-actions github-actions bot added the stale label Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NullPointer exception in eco code java Sonar plugin

2 participants