Adding NOPMD tags for various empty catch blocks
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1089736 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4c690103f1
commit
d6fe7f6789
|
@ -117,7 +117,7 @@ public class SerializationUtils {
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) { // NOPMD
|
||||||
// ignore close exception
|
// ignore close exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,7 +173,7 @@ public class SerializationUtils {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
in.close();
|
in.close();
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) { // NOPMD
|
||||||
// ignore close exception
|
// ignore close exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,20 +203,20 @@ public class ExceptionUtils {
|
||||||
Method method = null;
|
Method method = null;
|
||||||
try {
|
try {
|
||||||
method = throwable.getClass().getMethod(methodName, (Class[]) null);
|
method = throwable.getClass().getMethod(methodName, (Class[]) null);
|
||||||
} catch (NoSuchMethodException ignored) {
|
} catch (NoSuchMethodException ignored) { // NOPMD
|
||||||
// exception ignored
|
// exception ignored
|
||||||
} catch (SecurityException ignored) {
|
} catch (SecurityException ignored) { // NOPMD
|
||||||
// exception ignored
|
// exception ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
if (method != null && Throwable.class.isAssignableFrom(method.getReturnType())) {
|
if (method != null && Throwable.class.isAssignableFrom(method.getReturnType())) {
|
||||||
try {
|
try {
|
||||||
return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
|
return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY);
|
||||||
} catch (IllegalAccessException ignored) {
|
} catch (IllegalAccessException ignored) { // NOPMD
|
||||||
// exception ignored
|
// exception ignored
|
||||||
} catch (IllegalArgumentException ignored) {
|
} catch (IllegalArgumentException ignored) { // NOPMD
|
||||||
// exception ignored
|
// exception ignored
|
||||||
} catch (InvocationTargetException ignored) {
|
} catch (InvocationTargetException ignored) { // NOPMD
|
||||||
// exception ignored
|
// exception ignored
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,8 +504,8 @@ public class NumberUtils {
|
||||||
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
|
&& (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) {
|
||||||
try {
|
try {
|
||||||
return createLong(numeric);
|
return createLong(numeric);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) { // NOPMD
|
||||||
//Too big for a long
|
// Too big for a long
|
||||||
}
|
}
|
||||||
return createBigInteger(numeric);
|
return createBigInteger(numeric);
|
||||||
|
|
||||||
|
@ -521,7 +521,7 @@ public class NumberUtils {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) { // NOPMD
|
||||||
// ignore the bad number
|
// ignore the bad number
|
||||||
}
|
}
|
||||||
//$FALL-THROUGH$
|
//$FALL-THROUGH$
|
||||||
|
@ -532,12 +532,12 @@ public class NumberUtils {
|
||||||
if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) {
|
if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) { // NOPMD
|
||||||
// ignore the bad number
|
// ignore the bad number
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return createBigDecimal(numeric);
|
return createBigDecimal(numeric);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) { // NOPMD
|
||||||
// ignore the bad number
|
// ignore the bad number
|
||||||
}
|
}
|
||||||
//$FALL-THROUGH$
|
//$FALL-THROUGH$
|
||||||
|
@ -557,12 +557,12 @@ public class NumberUtils {
|
||||||
//Must be an int,long,bigint
|
//Must be an int,long,bigint
|
||||||
try {
|
try {
|
||||||
return createInteger(str);
|
return createInteger(str);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) { // NOPMD
|
||||||
// ignore the bad number
|
// ignore the bad number
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return createLong(str);
|
return createLong(str);
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) { // NOPMD
|
||||||
// ignore the bad number
|
// ignore the bad number
|
||||||
}
|
}
|
||||||
return createBigInteger(str);
|
return createBigInteger(str);
|
||||||
|
@ -575,7 +575,7 @@ public class NumberUtils {
|
||||||
if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) {
|
if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) { // NOPMD
|
||||||
// ignore the bad number
|
// ignore the bad number
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
@ -583,7 +583,7 @@ public class NumberUtils {
|
||||||
if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) {
|
if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) {
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
} catch (NumberFormatException nfe) {
|
} catch (NumberFormatException nfe) { // NOPMD
|
||||||
// ignore the bad number
|
// ignore the bad number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -261,7 +261,7 @@ public class ConstructorUtils {
|
||||||
Constructor<T> ctor = cls.getConstructor(parameterTypes);
|
Constructor<T> ctor = cls.getConstructor(parameterTypes);
|
||||||
MemberUtils.setAccessibleWorkaround(ctor);
|
MemberUtils.setAccessibleWorkaround(ctor);
|
||||||
return ctor;
|
return ctor;
|
||||||
} catch (NoSuchMethodException e) { /* SWALLOW */
|
} catch (NoSuchMethodException e) { // NOPMD - Swallow
|
||||||
}
|
}
|
||||||
Constructor<T> result = null;
|
Constructor<T> result = null;
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class FieldUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return field;
|
return field;
|
||||||
} catch (NoSuchFieldException ex) {
|
} catch (NoSuchFieldException ex) { // NOPMD
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ public class FieldUtils {
|
||||||
+ "; a matching field exists on two or more implemented interfaces.");
|
+ "; a matching field exists on two or more implemented interfaces.");
|
||||||
}
|
}
|
||||||
match = test;
|
match = test;
|
||||||
} catch (NoSuchFieldException ex) {
|
} catch (NoSuchFieldException ex) { // NOPMD
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,8 @@ public class FieldUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return field;
|
return field;
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) { // NOPMD
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ abstract class MemberUtils {
|
||||||
&& isPackageAccess(m.getDeclaringClass().getModifiers())) {
|
&& isPackageAccess(m.getDeclaringClass().getModifiers())) {
|
||||||
try {
|
try {
|
||||||
o.setAccessible(true);
|
o.setAccessible(true);
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) { // NOPMD
|
||||||
// ignore in favor of subsequent IllegalAccessException
|
// ignore in favor of subsequent IllegalAccessException
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,7 +465,7 @@ public class MethodUtils {
|
||||||
try {
|
try {
|
||||||
method = interfaces[i].getDeclaredMethod(methodName,
|
method = interfaces[i].getDeclaredMethod(methodName,
|
||||||
parameterTypes);
|
parameterTypes);
|
||||||
} catch (NoSuchMethodException e) {
|
} catch (NoSuchMethodException e) { // NOPMD
|
||||||
/*
|
/*
|
||||||
* Swallow, if no method is found after the loop then this
|
* Swallow, if no method is found after the loop then this
|
||||||
* method returns null.
|
* method returns null.
|
||||||
|
@ -511,7 +511,7 @@ public class MethodUtils {
|
||||||
Method method = cls.getMethod(methodName, parameterTypes);
|
Method method = cls.getMethod(methodName, parameterTypes);
|
||||||
MemberUtils.setAccessibleWorkaround(method);
|
MemberUtils.setAccessibleWorkaround(method);
|
||||||
return method;
|
return method;
|
||||||
} catch (NoSuchMethodException e) { /* SWALLOW */
|
} catch (NoSuchMethodException e) { /* SWALLOW - NOPMD */
|
||||||
}
|
}
|
||||||
// search through all methods
|
// search through all methods
|
||||||
Method bestMatch = null;
|
Method bestMatch = null;
|
||||||
|
|
|
@ -345,7 +345,7 @@ public class ExtendedMessageFormat extends MessageFormat {
|
||||||
if ((c == START_FMT || c == END_FE) && result.length() > 0) {
|
if ((c == START_FMT || c == END_FE) && result.length() > 0) {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(result.toString());
|
return Integer.parseInt(result.toString());
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) { // NOPMD
|
||||||
// we've already ensured only digits, so unless something
|
// we've already ensured only digits, so unless something
|
||||||
// outlandishly large was specified we should be okay.
|
// outlandishly large was specified we should be okay.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue