mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-27 00:07:04 +07:00
IOStreamConstructorInspection: do not suggest fix in cases when FileNotFoundException is already handled (IDEA-288738)
GitOrigin-RevId: f55d0d899196a9db2fc9dfc2ab01fc7c5edb51bf
This commit is contained in:
1 parent
0d90827381
commit
a028df8220
5 files changed
+87
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
// "Replace with 'Files.newInputStream'" "true"
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
class Foo {
|
||||
void test(String str) {
|
||||
try {
|
||||
if (str.length() < 3) throw new FileNotFoundException("e");
|
||||
try (InputStream in = Files.newInputStream(Paths.get(str))) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Don't know what happened");
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
System.out.println("file not found exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'Files.newInputStream'" "false"
|
||||
import java.io.*;
|
||||
|
||||
class Foo {
|
||||
void test(String str) {
|
||||
try(InputStream in = new FileInputStream(s<caret>tr)) {
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
System.out.println("file not found exception");
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Don't know what happened");
|
||||
}
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'Files.newInputStream'" "false"
|
||||
import java.io.*;
|
||||
|
||||
class Foo {
|
||||
void test(String str) {
|
||||
try(InputStream in = new FileInputStream(s<caret>tr)) {
|
||||
}
|
||||
catch (FileNotFoundException | RuntimeException e) {
|
||||
System.out.println("file not found exception");
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Don't know what happened");
|
||||
}
|
||||
}
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// "Replace with 'Files.newInputStream'" "true"
|
||||
import java.io.*;
|
||||
|
||||
class Foo {
|
||||
void test(String str) {
|
||||
try {
|
||||
if (str.length() < 3) throw new FileNotFoundException("e");
|
||||
try (InputStream in = new FileInputStream(st<caret>r)) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
System.out.println("Don't know what happened");
|
||||
}
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
System.out.println("file not found exception");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user