BulkFileAttributesReadInspection: cr fixes (IJ-CR-20279):

1. analyze all calls in method in one go
2. use UncheckedIOException instead of RuntimeException when wrapping into try catch
3. info level when try catch needed + no report in batch mode
4. updated description

GitOrigin-RevId: 0a2542b851fa32c5fde98725985f55079447b02b
This commit is contained in:
Artemiy Sartakov
2022-02-09 17:43:48 +07:00
committed by intellij-monorepo-bot
parent a43c389c46
commit bcca6ef32f
5 changed files with 77 additions and 56 deletions

View File

@@ -11,8 +11,8 @@ class Foo {
try {
BasicFileAttributes basicFileAttributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
return basicFileAttributes.isDirectory() && basicFileAttributes.isRegularFile();
throw new IOException("");
} catch (IOException e) {
} catch (Exception e) {
}
return false;
}
}

View File

@@ -9,7 +9,7 @@ class Foo {
try {
basicFileAttributes = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
} catch (IOException e) {
throw new RuntimeException(e);
throw new UncheckedIOException(e);
}
while (basicFileAttributes.isDirectory()) {
System.out.println(basicFileAttributes.isRegularFile());

View File

@@ -8,8 +8,8 @@ class Foo {
boolean printDirectory() {
try {
return file.isDirec<caret>tory() && file.isFile();
throw new IOException("");
} catch (IOException e) {
} catch (Exception e) {
}
return false;
}
}