From d6fe7f67896642373a9c1fe3e2d75076d29b8e0c Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Thu, 7 Apr 2011 04:39:33 +0000 Subject: [PATCH] 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 --- .../commons/lang3/SerializationUtils.java | 4 ++-- .../lang3/exception/ExceptionUtils.java | 10 +++++----- .../apache/commons/lang3/math/NumberUtils.java | 18 +++++++++--------- .../lang3/reflect/ConstructorUtils.java | 2 +- .../commons/lang3/reflect/FieldUtils.java | 7 ++++--- .../commons/lang3/reflect/MemberUtils.java | 2 +- .../commons/lang3/reflect/MethodUtils.java | 4 ++-- .../lang3/text/ExtendedMessageFormat.java | 2 +- 8 files changed, 25 insertions(+), 24 deletions(-) diff --git a/src/main/java/org/apache/commons/lang3/SerializationUtils.java b/src/main/java/org/apache/commons/lang3/SerializationUtils.java index a86636a04..bd8238ae7 100644 --- a/src/main/java/org/apache/commons/lang3/SerializationUtils.java +++ b/src/main/java/org/apache/commons/lang3/SerializationUtils.java @@ -117,7 +117,7 @@ public class SerializationUtils { if (out != null) { out.close(); } - } catch (IOException ex) { + } catch (IOException ex) { // NOPMD // ignore close exception } } @@ -173,7 +173,7 @@ public class SerializationUtils { if (in != null) { in.close(); } - } catch (IOException ex) { + } catch (IOException ex) { // NOPMD // ignore close exception } } diff --git a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java index bc9d135e6..f4c451ca8 100644 --- a/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java +++ b/src/main/java/org/apache/commons/lang3/exception/ExceptionUtils.java @@ -203,20 +203,20 @@ public class ExceptionUtils { Method method = null; try { method = throwable.getClass().getMethod(methodName, (Class[]) null); - } catch (NoSuchMethodException ignored) { + } catch (NoSuchMethodException ignored) { // NOPMD // exception ignored - } catch (SecurityException ignored) { + } catch (SecurityException ignored) { // NOPMD // exception ignored } if (method != null && Throwable.class.isAssignableFrom(method.getReturnType())) { try { return (Throwable) method.invoke(throwable, ArrayUtils.EMPTY_OBJECT_ARRAY); - } catch (IllegalAccessException ignored) { + } catch (IllegalAccessException ignored) { // NOPMD // exception ignored - } catch (IllegalArgumentException ignored) { + } catch (IllegalArgumentException ignored) { // NOPMD // exception ignored - } catch (InvocationTargetException ignored) { + } catch (InvocationTargetException ignored) { // NOPMD // exception ignored } } diff --git a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java index d12ce6872..438f43e97 100644 --- a/src/main/java/org/apache/commons/lang3/math/NumberUtils.java +++ b/src/main/java/org/apache/commons/lang3/math/NumberUtils.java @@ -504,8 +504,8 @@ public class NumberUtils { && (numeric.charAt(0) == '-' && isDigits(numeric.substring(1)) || isDigits(numeric))) { try { return createLong(numeric); - } catch (NumberFormatException nfe) { - //Too big for a long + } catch (NumberFormatException nfe) { // NOPMD + // Too big for a long } return createBigInteger(numeric); @@ -521,7 +521,7 @@ public class NumberUtils { return f; } - } catch (NumberFormatException nfe) { + } catch (NumberFormatException nfe) { // NOPMD // ignore the bad number } //$FALL-THROUGH$ @@ -532,12 +532,12 @@ public class NumberUtils { if (!(d.isInfinite() || (d.floatValue() == 0.0D && !allZeros))) { return d; } - } catch (NumberFormatException nfe) { + } catch (NumberFormatException nfe) { // NOPMD // ignore the bad number } try { return createBigDecimal(numeric); - } catch (NumberFormatException e) { + } catch (NumberFormatException e) { // NOPMD // ignore the bad number } //$FALL-THROUGH$ @@ -557,12 +557,12 @@ public class NumberUtils { //Must be an int,long,bigint try { return createInteger(str); - } catch (NumberFormatException nfe) { + } catch (NumberFormatException nfe) { // NOPMD // ignore the bad number } try { return createLong(str); - } catch (NumberFormatException nfe) { + } catch (NumberFormatException nfe) { // NOPMD // ignore the bad number } return createBigInteger(str); @@ -575,7 +575,7 @@ public class NumberUtils { if (!(f.isInfinite() || (f.floatValue() == 0.0F && !allZeros))) { return f; } - } catch (NumberFormatException nfe) { + } catch (NumberFormatException nfe) { // NOPMD // ignore the bad number } try { @@ -583,7 +583,7 @@ public class NumberUtils { if (!(d.isInfinite() || (d.doubleValue() == 0.0D && !allZeros))) { return d; } - } catch (NumberFormatException nfe) { + } catch (NumberFormatException nfe) { // NOPMD // ignore the bad number } diff --git a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java index d92cd06ad..b2888e96b 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java @@ -261,7 +261,7 @@ public class ConstructorUtils { Constructor ctor = cls.getConstructor(parameterTypes); MemberUtils.setAccessibleWorkaround(ctor); return ctor; - } catch (NoSuchMethodException e) { /* SWALLOW */ + } catch (NoSuchMethodException e) { // NOPMD - Swallow } Constructor result = null; /* diff --git a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java index bec9ef3e1..34309a6ec 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/FieldUtils.java @@ -106,7 +106,7 @@ public class FieldUtils { } } return field; - } catch (NoSuchFieldException ex) { + } catch (NoSuchFieldException ex) { // NOPMD // ignore } } @@ -127,7 +127,7 @@ public class FieldUtils { + "; a matching field exists on two or more implemented interfaces."); } match = test; - } catch (NoSuchFieldException ex) { + } catch (NoSuchFieldException ex) { // NOPMD // ignore } } @@ -176,7 +176,8 @@ public class FieldUtils { } } return field; - } catch (NoSuchFieldException e) { + } catch (NoSuchFieldException e) { // NOPMD + // ignore } return null; } diff --git a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java index 5156e6b0f..b1abd7d2f 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MemberUtils.java @@ -60,7 +60,7 @@ abstract class MemberUtils { && isPackageAccess(m.getDeclaringClass().getModifiers())) { try { o.setAccessible(true); - } catch (SecurityException e) { + } catch (SecurityException e) { // NOPMD // ignore in favor of subsequent IllegalAccessException } } diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java index 03d4bc395..fbaf6df70 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java @@ -465,7 +465,7 @@ public class MethodUtils { try { method = interfaces[i].getDeclaredMethod(methodName, parameterTypes); - } catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { // NOPMD /* * Swallow, if no method is found after the loop then this * method returns null. @@ -511,7 +511,7 @@ public class MethodUtils { Method method = cls.getMethod(methodName, parameterTypes); MemberUtils.setAccessibleWorkaround(method); return method; - } catch (NoSuchMethodException e) { /* SWALLOW */ + } catch (NoSuchMethodException e) { /* SWALLOW - NOPMD */ } // search through all methods Method bestMatch = null; diff --git a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java index 0e6a7b206..af9de89ff 100644 --- a/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java +++ b/src/main/java/org/apache/commons/lang3/text/ExtendedMessageFormat.java @@ -345,7 +345,7 @@ public class ExtendedMessageFormat extends MessageFormat { if ((c == START_FMT || c == END_FE) && result.length() > 0) { try { return Integer.parseInt(result.toString()); - } catch (NumberFormatException e) { + } catch (NumberFormatException e) { // NOPMD // we've already ensured only digits, so unless something // outlandishly large was specified we should be okay. }