[java] AvoidPrintStackTrace - fix tests and deprecation warning
This commit is contained in:
@ -188,7 +188,7 @@ Avoid printStackTrace(); use a logger call instead.
|
||||
//PrimaryExpression[
|
||||
( PrimaryPrefix[Name[contains(@Image,'printStackTrace')]]
|
||||
| PrimarySuffix[@Image='printStackTrace']
|
||||
)/following-sibling::*[1][self::PrimarySuffix/Arguments[@ArgumentCount=0]]
|
||||
)/following-sibling::*[1][self::PrimarySuffix/Arguments[@Size=0]]
|
||||
]
|
||||
]]>
|
||||
</value>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<test-code>
|
||||
<description>simple failure</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<expected-linenumbers>4</expected-linenumbers>
|
||||
<expected-linenumbers>5</expected-linenumbers>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
void bar() {
|
||||
@ -38,10 +38,12 @@ public class Foo {
|
||||
<test-code>
|
||||
<description>pos in call chain #2437</description>
|
||||
<expected-problems>1</expected-problems>
|
||||
<expected-linenumbers>5</expected-linenumbers>
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
void bar() {
|
||||
try {} catch (Exception e) {
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
e.getCause().printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -55,7 +57,8 @@ public class Foo {
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
void bar() {
|
||||
try {} catch (Exception e) {
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
e.getCause().printStackTrace;
|
||||
}
|
||||
}
|
||||
@ -69,7 +72,8 @@ public class Foo {
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
void bar() {
|
||||
try {} catch (Exception e) {
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace;
|
||||
}
|
||||
}
|
||||
@ -83,7 +87,8 @@ public class Foo {
|
||||
<code><![CDATA[
|
||||
public class Foo {
|
||||
void bar() {
|
||||
try {} catch (Exception e) {
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace(e);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user