mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
make IG test light
This commit is contained in:
+7
-7
@@ -15,7 +15,7 @@ public class TooBroadCatchBlock{
|
||||
}
|
||||
} catch(FileNotFoundException e){
|
||||
e.printStackTrace();
|
||||
} catch(IOException e){
|
||||
} catch(<warning descr="'catch' of 'IOException' is too broad, masking exception 'EOFException'">IOException</warning> e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@@ -28,9 +28,9 @@ public class TooBroadCatchBlock{
|
||||
try {
|
||||
new URL(null);
|
||||
throw new NullPointerException();
|
||||
} catch (IOException e) {
|
||||
} catch (<warning descr="'catch' of 'IOException' is too broad, masking exception 'MalformedURLException'">IOException</warning> e) {
|
||||
|
||||
} catch (RuntimeException e) {
|
||||
} catch (<warning descr="'catch' of 'RuntimeException' is too broad, masking exception 'NullPointerException'">RuntimeException</warning> e) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public class TooBroadCatchBlock{
|
||||
if (c) {
|
||||
throw new IOException();
|
||||
}
|
||||
} catch (ObjectStreamException e) {
|
||||
} catch (<warning descr="'catch' of 'ObjectStreamException' is too broad, masking exceptions 'NotActiveException' and 'StreamCorruptedException'">ObjectStreamException</warning> e) {
|
||||
// Deal with ObjectStreamException (a subclass of IOException)...
|
||||
} catch (IOException e) {
|
||||
// Deal with IOException...
|
||||
@@ -60,7 +60,7 @@ public class TooBroadCatchBlock{
|
||||
void test() {
|
||||
try {
|
||||
try (java.io.FileInputStream in = new java.io.FileInputStream("asdf")) {}
|
||||
} catch (IOException e) {}
|
||||
} catch (<warning descr="'catch' of 'IOException' is too broad, masking exception 'FileNotFoundException'">IOException</warning> e) {}
|
||||
}
|
||||
|
||||
boolean m() {
|
||||
@@ -69,7 +69,7 @@ public class TooBroadCatchBlock{
|
||||
return new java.io.File("can_reset").isFile();
|
||||
} catch (FileNotFoundException e) {
|
||||
return false;
|
||||
} catch (Exception e ) {
|
||||
} catch (<warning descr="'catch' of 'Exception' is too broad, masking exception 'RuntimeException'">Exception</warning> e ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ public class TooBroadCatchBlock{
|
||||
try {
|
||||
new java.io.FileInputStream("");
|
||||
return new java.io.File("can_reset").isFile();
|
||||
} catch (Exception e ) {
|
||||
} catch (<warning descr="'catch' of 'Exception' is too broad, masking exception 'FileNotFoundException'">Exception</warning> e ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
|
||||
<problem>
|
||||
<file>TooBroadCatchBlock.java</file>
|
||||
<line>18</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Overly broad 'catch' block</problem_class>
|
||||
<description>''catch'' of <code>IOException</code> is too broad, masking exception 'EOFException' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TooBroadCatchBlock.java</file>
|
||||
<line>31</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Overly broad 'catch' block</problem_class>
|
||||
<description>''catch'' of <code>IOException</code> is too broad, masking exception 'MalformedURLException' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TooBroadCatchBlock.java</file>
|
||||
<line>33</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Overly broad 'catch' block</problem_class>
|
||||
<description>''catch'' of <code>RuntimeException</code> is too broad, masking exception 'NullPointerException' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TooBroadCatchBlock.java</file>
|
||||
<line>49</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Overly broad 'catch' block</problem_class>
|
||||
<description>''catch'' of <code>ObjectStreamException</code> is too broad, masking exceptions 'NotActiveException' and 'StreamCorruptedException' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TooBroadCatchBlock.java</file>
|
||||
<line>63</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Overly broad 'catch' block</problem_class>
|
||||
<description>'catch' of <code>IOException</code> is too broad, masking exception 'FileNotFoundException' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TooBroadCatchBlock.java</file>
|
||||
<line>72</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Overly broad 'catch' block</problem_class>
|
||||
<description>'catch' of <code>Exception</code> is too broad, masking exception 'RuntimeException' #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>TooBroadCatchBlock.java</file>
|
||||
<line>81</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Overly broad 'catch' block</problem_class>
|
||||
<description>'catch' of <code>Exception</code> is too broad, masking exception 'FileNotFoundException' #loc</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+17
-4
@@ -1,10 +1,23 @@
|
||||
package com.siyeh.ig.errorhandling;
|
||||
|
||||
import com.siyeh.ig.IGInspectionTestCase;
|
||||
import com.intellij.codeInspection.InspectionProfileEntry;
|
||||
import com.siyeh.ig.LightInspectionTestCase;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TooBroadCatchInspectionTest extends IGInspectionTestCase {
|
||||
public class TooBroadCatchInspectionTest extends LightInspectionTestCase {
|
||||
|
||||
public void test() throws Exception {
|
||||
doTest("com/siyeh/igtest/errorhandling/toobroadcatch", new TooBroadCatchInspection());
|
||||
public void testTooBroadCatchBlock() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionProfileEntry getInspection() {
|
||||
return new TooBroadCatchInspection();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/plugins/InspectionGadgets/test/com/siyeh/igtest/errorhandling/toobroadcatch";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user