You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2018/06/06 11:24:38 UTC
svn commit: r1833012 -
/tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
Author: markt
Date: Wed Jun 6 11:24:38 2018
New Revision: 1833012
URL: http://svn.apache.org/viewvc?rev=1833012&view=rev
Log:
SpotBugs: Remove unreachable code
Modified:
tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
Modified: tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java?rev=1833012&r1=1833011&r2=1833012&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/IntrospectionUtils.java Wed Jun 6 11:24:38 2018
@@ -320,24 +320,19 @@ public final class IntrospectionUtils {
return methods;
}
- @SuppressWarnings("null") // Neither params nor methodParams can be null
- // when comparing their lengths
+ @SuppressWarnings("null") // params cannot be null when comparing lengths
public static Method findMethod(Class<?> c, String name,
Class<?> params[]) {
Method methods[] = findMethods(c);
- if (methods == null)
- return null;
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals(name)) {
Class<?> methodParams[] = methods[i].getParameterTypes();
- if (methodParams == null)
- if (params == null || params.length == 0)
- return methods[i];
- if (params == null)
- if (methodParams == null || methodParams.length == 0)
- return methods[i];
- if (params.length != methodParams.length)
+ if (params == null && methodParams.length == 0) {
+ return methods[i];
+ }
+ if (params.length != methodParams.length) {
continue;
+ }
boolean found = true;
for (int j = 0; j < params.length; j++) {
if (params[j] != methodParams[j]) {
@@ -345,8 +340,9 @@ public final class IntrospectionUtils {
break;
}
}
- if (found)
+ if (found) {
return methods[i];
+ }
}
}
return null;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org