Author: markt
Date: Tue Sep 18 09:20:46 2012
New Revision: 1387068
URL: http://svn.apache.org/viewvc?rev=1387068&view=rev
Log:
Code clean-up
- suppress a FindBugs warning
- suppress an Eclipse warning
- add 'final' as prompted by the UCDetector
Modified:
tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java
tomcat/trunk/res/findbugs/filter-false-positives.xml
Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java?rev=1387068&r1=1387067&r2=1387068&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java
(original)
+++ tomcat/trunk/java/org/apache/tomcat/util/digester/CallMethodRule.java Tue
Sep 18 09:20:46 2012
@@ -108,7 +108,7 @@ public class CallMethodRule extends Rule
this.paramTypes[i] = String.class;
}
}
-
+ this.paramClassNames = null;
}
/**
@@ -193,8 +193,9 @@ public class CallMethodRule extends Rule
if (paramTypes == null) {
this.paramTypes = new Class[paramCount];
for (int i = 0; i < this.paramTypes.length; i++) {
- this.paramTypes[i] = "abc".getClass();
+ this.paramTypes[i] = String.class;
}
+ this.paramClassNames = null;
} else {
// copy the parameter class names into an array
// the classes will be loaded when the digester is set
@@ -261,7 +262,7 @@ public class CallMethodRule extends Rule
if (paramTypes == null) {
this.paramTypes = new Class[paramCount];
for (int i = 0; i < this.paramTypes.length; i++) {
- this.paramTypes[i] = "abc".getClass();
+ this.paramTypes[i] = String.class;
}
} else {
this.paramTypes = new Class[paramTypes.length];
@@ -269,7 +270,7 @@ public class CallMethodRule extends Rule
this.paramTypes[i] = paramTypes[i];
}
}
-
+ this.paramClassNames = null;
}
@@ -287,12 +288,12 @@ public class CallMethodRule extends Rule
* top of the digester object stack. The default value of zero
* means the target object is the one on top of the stack.
*/
- protected int targetOffset = 0;
+ protected final int targetOffset;
/**
* The method name to call on the parent object.
*/
- protected String methodName = null;
+ protected final String methodName;
/**
@@ -300,7 +301,7 @@ public class CallMethodRule extends Rule
* If this value is zero, a single parameter will be collected from the
* body of this element.
*/
- protected int paramCount = 0;
+ protected final int paramCount;
/**
@@ -312,7 +313,7 @@ public class CallMethodRule extends Rule
* The names of the classes of the parameters to be collected.
* This attribute allows creation of the classes to be postponed until the
digester is set.
*/
- protected String paramClassNames[] = null;
+ protected final String paramClassNames[];
/**
* Should <code>MethodUtils.invokeExactMethod</code> be used for
reflection.
@@ -419,6 +420,7 @@ public class CallMethodRule extends Rule
* @param name the local name if the parser is namespace aware, or just
* the element name otherwise
*/
+ @SuppressWarnings("null") // parameters can't trigger NPE
@Override
public void end(String namespace, String name) throws Exception {
@@ -456,7 +458,7 @@ public class CallMethodRule extends Rule
parameters[0] = bodyText;
if (paramTypes.length == 0) {
paramTypes = new Class[1];
- paramTypes[0] = "abc".getClass();
+ paramTypes[0] = String.class;
}
}
Modified: tomcat/trunk/res/findbugs/filter-false-positives.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/res/findbugs/filter-false-positives.xml?rev=1387068&r1=1387067&r2=1387068&view=diff
==============================================================================
--- tomcat/trunk/res/findbugs/filter-false-positives.xml (original)
+++ tomcat/trunk/res/findbugs/filter-false-positives.xml Tue Sep 18 09:20:46
2012
@@ -237,6 +237,12 @@
<Bug code="ST" />
</Match>
<Match>
+ <!-- NPE is desired as it indicates an error condition -->
+ <Class name="org.apache.tomcat.util.digester.CallMethodRule"/>
+ <Method name="end"/>
+ <Bug code="NP" />
+ </Match>
+ <Match>
<!-- Test really is for the same object rather than equality -->
<Class name="org.apache.tomcat.util.digester.Digester"/>
<Or>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]