mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
[java] replace default catch block template (IDEA-161593)
`throw e` won't fix the compilation error, comment - is not really better than empty catch block. GitOrigin-RevId: ea002c332900b032392e766f3dd13fe3258ad49c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
12cce2b05b
commit
724ed16f6f
@@ -1 +1 @@
|
||||
${EXCEPTION}.printStackTrace();
|
||||
throw new RuntimeException(${EXCEPTION});
|
||||
@@ -19,7 +19,7 @@ class Client {
|
||||
try {
|
||||
a.acting(s);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class a {
|
||||
g();
|
||||
} catch (Error e) {
|
||||
} catch (Exception e) {
|
||||
<caret><selection>e.printStackTrace();</selection>
|
||||
<caret><selection>throw new RuntimeException(e);</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class a {
|
||||
g();
|
||||
// comment after
|
||||
} catch (Exception e) {
|
||||
<caret><selection>e.printStackTrace();</selection>
|
||||
<caret><selection>throw new RuntimeException(e);</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class Test {
|
||||
foo();
|
||||
} catch (MyException1 e) {
|
||||
} catch (MyException2 e) {
|
||||
<caret><selection>e.printStackTrace();</selection>
|
||||
<caret><selection>throw new RuntimeException(e);</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ class Test {
|
||||
void m() {
|
||||
try (MyResource r = new MyResource()) {
|
||||
} catch (IOException e) {
|
||||
<selection>e.printStackTrace();</selection>
|
||||
<selection>throw new RuntimeException(e);</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class Test {
|
||||
r.doSomething();
|
||||
} catch (E1 ignore) {
|
||||
} catch (E2 e) {
|
||||
<selection>e.printStackTrace();</selection>
|
||||
<selection>throw new RuntimeException(e);</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,9 +11,9 @@ class Test {
|
||||
void m() {
|
||||
try (MyResource r = new MyResource()) {
|
||||
} catch (E1 e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
} catch (E2 e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,9 +12,9 @@ class CatchExceptions {
|
||||
try {
|
||||
foo();
|
||||
} catch (FileNotFoundException e) {
|
||||
<selection>e.printStackTrace();</selection>
|
||||
<selection><caret>throw new RuntimeException(e);</selection>
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ class Foo {
|
||||
try {
|
||||
System.out.println(s);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class Foo {
|
||||
try {
|
||||
System.out.println(Integer.parseInt(s));
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ class C {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
} catch( Exception e) {
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ExTest {
|
||||
try {
|
||||
a = new String[]{maybeThrow("")};
|
||||
} catch (Ex e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.out.println(a);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class C {
|
||||
try {
|
||||
S = getString();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ class C {
|
||||
try {
|
||||
in = new FileInputStream("");
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ class C {
|
||||
try {
|
||||
if(foo() && foo())
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ExTest {
|
||||
try {
|
||||
return ExTest.maybeThrow(t);
|
||||
} catch (Ex e) {
|
||||
<selection>e.printStackTrace();</selection>
|
||||
<selection>throw new RuntimeException(e);</selection>
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ExTest {
|
||||
try {
|
||||
ExTest.maybeThrow(t);
|
||||
} catch (Ex e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ public class Test {
|
||||
try {
|
||||
foo = bar();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
foo.toString();
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class Test {
|
||||
// This is comment"
|
||||
int i = 1;
|
||||
} catch (Exception e) {
|
||||
<caret><selection>e.printStackTrace();</selection>
|
||||
<caret><selection>throw new RuntimeException(e);</selection>
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ class Test {
|
||||
// This is comment"
|
||||
int i = 1;
|
||||
} catch (Exception e) {
|
||||
<caret><selection>e.printStackTrace();</selection>
|
||||
<caret><selection>throw new RuntimeException(e);</selection>
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ class Test {
|
||||
try {
|
||||
I i = ExceptionTest::foo;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ class ModuleATest {
|
||||
try {
|
||||
foo();
|
||||
} catch (final Smth ex1) {
|
||||
ex1.printStackTrace();
|
||||
throw new RuntimeException(ex1);
|
||||
}
|
||||
Exception ex1 = null;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ class C {
|
||||
/*1*/
|
||||
throw new /*2*/RuntimeException("a")/*3*/;/*4*/
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
default -> "";
|
||||
|
||||
@@ -6,7 +6,7 @@ class C {
|
||||
try {
|
||||
yield "a" + "b";
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ public class Foo {
|
||||
try {
|
||||
new Object()
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ public class Foo {
|
||||
try {
|
||||
Object obj = new Object()<caret>
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ public class Foo {
|
||||
try {
|
||||
doAct() + "aaa"
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ public class Foo {
|
||||
try {
|
||||
doAct()
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
int i=0;
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ public class Foo {
|
||||
try {
|
||||
doAct()<caret>
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ public class Foo {
|
||||
try {
|
||||
doAct()
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class Test {
|
||||
try {
|
||||
foo();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ class Test {
|
||||
try {
|
||||
a = foo();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
System.out.println(a);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class ChangeSignatureTest {
|
||||
try {
|
||||
bar();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,7 @@ class ChangeSignatureTest {
|
||||
try {
|
||||
bar();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ class High {
|
||||
} catch (IllegalAccessException | InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ class AAA {
|
||||
try {
|
||||
System.out.println(System.in.read());
|
||||
} c<caret>atch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ class Foo {
|
||||
try {
|
||||
new AddException().foo();
|
||||
} catch (java.io.IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user