-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SONARJAVA-2473 Ignore exception messages when computing flows for S20…
…95, S2222 and S3546 (#1686)
- Loading branch information
Showing
6 changed files
with
83 additions
and
34 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
26 changes: 26 additions & 0 deletions
26
java-frontend/src/test/files/se/UnclosedResourcesCheckWithoutExceptionMessages.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.foo; | ||
|
||
import java.io.FileWriter; | ||
import java.io.Writer; | ||
import java.util.List; | ||
|
||
abstract class A { | ||
void foo(List<A> elements) { | ||
for (A element : elements) { | ||
try { | ||
String packageName = substring(element.name(), "."); | ||
|
||
Writer writer = new FileWriter(""); // Noncompliant | ||
|
||
put("packageName", packageName); | ||
|
||
writer.close(); | ||
} catch (Exception e) { | ||
} | ||
} | ||
} | ||
|
||
abstract String substring(String str, String separator); | ||
abstract String name(); | ||
abstract void put(String s, Object o); | ||
} |
This file contains 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