[tomcat] branch 8.5.x updated: Polish. Spacing. Back-port clean-up from 9.0.x. Add Javadoc.

2019-09-16 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 6f36dd2  Polish. Spacing. Back-port clean-up from 9.0.x. Add Javadoc.
6f36dd2 is described below

commit 6f36dd2f349eeceb129d210341f7a7ce36100770
Author: Mark Thomas 
AuthorDate: Mon Sep 16 09:59:20 2019 +0100

Polish. Spacing. Back-port clean-up from 9.0.x. Add Javadoc.
---
 .../org/apache/tomcat/util/IntrospectionUtils.java | 39 ++
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/java/org/apache/tomcat/util/IntrospectionUtils.java 
b/java/org/apache/tomcat/util/IntrospectionUtils.java
index 10fafa8..5058088 100644
--- a/java/org/apache/tomcat/util/IntrospectionUtils.java
+++ b/java/org/apache/tomcat/util/IntrospectionUtils.java
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.tomcat.util;
 
 import java.lang.reflect.InvocationTargetException;
@@ -32,7 +31,6 @@ import org.apache.tomcat.util.security.PermissionCheck;
  */
 public final class IntrospectionUtils {
 
-
 private static final Log log = LogFactory.getLog(IntrospectionUtils.class);
 
 /**
@@ -343,24 +341,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]) {
@@ -368,8 +361,9 @@ public final class IntrospectionUtils {
 break;
 }
 }
-if (found)
+if (found) {
 return methods[i];
+}
 }
 }
 return null;
@@ -476,6 +470,23 @@ public final class IntrospectionUtils {
 }
 
 
+/**
+ * Checks to see if the specified class is an instance of or assignable 
from
+ * the specified type. The class clazz, all its superclasses,
+ * interfaces and those superinterfaces are tested for a match against
+ * the type name type.
+ *
+ * This is similar to instanceof or {@link 
Class#isAssignableFrom}
+ * except that the target type will not be resolved into a Class
+ * object, which provides some security and memory benefits.
+ *
+ * @param clazz The class to test for a match.
+ * @param type The name of the type that clazz must be.
+ *
+ * @return true if the clazz tested is an
+ * instance of the specified type,
+ * false otherwise.
+ */
 public static boolean isInstance(Class clazz, String type) {
 if (type.equals(clazz.getName())) {
 return true;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



[tomcat] branch 8.5.x updated: Polish. Spacing.

2019-09-10 Thread markt
This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/8.5.x by this push:
 new 45b3f9b  Polish. Spacing.
45b3f9b is described below

commit 45b3f9b87480e2f6ca0e21c2591e5d350c5dafc2
Author: Mark Thomas 
AuthorDate: Tue Sep 10 20:57:57 2019 +0100

Polish. Spacing.
---
 java/org/apache/tomcat/util/http/parser/AcceptEncoding.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/java/org/apache/tomcat/util/http/parser/AcceptEncoding.java 
b/java/org/apache/tomcat/util/http/parser/AcceptEncoding.java
index ee145c6..ba92702 100644
--- a/java/org/apache/tomcat/util/http/parser/AcceptEncoding.java
+++ b/java/org/apache/tomcat/util/http/parser/AcceptEncoding.java
@@ -14,7 +14,6 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-
 package org.apache.tomcat.util.http.parser;
 
 import java.io.IOException;


-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org