commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1652497 - /commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/GenericValidatorImpl.java
Date Fri, 16 Jan 2015 19:23:38 GMT
Author: sebb
Date: Fri Jan 16 19:23:38 2015
New Revision: 1652497

URL: http://svn.apache.org/r1652497
Log:
Simplify

Modified:
    commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/GenericValidatorImpl.java

Modified: commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/GenericValidatorImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/GenericValidatorImpl.java?rev=1652497&r1=1652496&r2=1652497&view=diff
==============================================================================
--- commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/GenericValidatorImpl.java
(original)
+++ commons/proper/validator/trunk/src/test/java/org/apache/commons/validator/GenericValidatorImpl.java
Fri Jan 16 19:23:38 2015
@@ -200,7 +200,7 @@ public class GenericValidatorImpl {
         Object form = validator.getParameterValue(Validator.BEAN_PARAM);
         String value = null;
         boolean required = false;
-        if (isString(bean)) {
+        if (isStringOrNull(bean)) {
             value = (String) bean;
         } else {
             value = ValidatorUtils.getValueAsString(bean, field.getProperty());
@@ -265,13 +265,11 @@ public class GenericValidatorImpl {
         return true;
     }
   
-  private static Class<?> stringClass = new String().getClass();
-
-  private static boolean isString(Object o) {
+  private static boolean isStringOrNull(Object o) {
     if (o == null) {
-        return true;
+        return true; // TODO this condition is not exercised by any tests currently
     }
-    return (stringClass.isInstance(o));
+    return (o instanceof String);
   }
       
 }                                                         



Mime
View raw message