struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pbened...@apache.org
Subject svn commit: r569607 - in /struts/struts1/trunk/core/src: main/java/org/apache/struts/validator/validwhen/ test/java/org/apache/struts/validator/
Date Sat, 25 Aug 2007 03:55:11 GMT
Author: pbenedict
Date: Fri Aug 24 20:55:10 2007
New Revision: 569607

URL: http://svn.apache.org/viewvc?rev=569607&view=rev
Log:
STR-3088: Treat blank strings as *null*

Modified:
    struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenLexer.java
    struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.g
    struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.java
    struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.java
    struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.txt
    struts/struts1/trunk/core/src/test/java/org/apache/struts/validator/TestValidWhen.java

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenLexer.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenLexer.java?rev=569607&r1=569606&r2=569607&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenLexer.java
(original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenLexer.java
Fri Aug 24 20:55:10 2007
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.2: "ValidWhenParser.g" -> "ValidWhenLexer.java"$
+// $ANTLR 2.7.6 (2005-12-22): "ValidWhenParser.g" -> "ValidWhenLexer.java"$
 
 /*
  * $Id$

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.g
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.g?rev=569607&r1=569606&r2=569607&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.g
(original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.g
Fri Aug 24 20:55:10 2007
@@ -57,12 +57,12 @@
         boolean intCompare = true;
 	if ((v1 == null) || (v2 == null)) {
 		if (String.class.isInstance(v1)) {
-			if (((String) v1).length() == 0) {
+			if (((String) v1).trim().length() == 0) {
 				v1 = null;
 			}
 		}
 		if (String.class.isInstance(v2)) {
-			if (((String) v2).length() == 0) {
+			if (((String) v2).trim().length() == 0) {
 				v2 = null;
 			}
 		}

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.java?rev=569607&r1=569606&r2=569607&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.java
(original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParser.java
Fri Aug 24 20:55:10 2007
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.2: "ValidWhenParser.g" -> "ValidWhenParser.java"$
+// $ANTLR 2.7.6 (2005-12-22): "ValidWhenParser.g" -> "ValidWhenParser.java"$
 
 /*
  * $Id$
@@ -69,12 +69,12 @@
         boolean intCompare = true;
 	if ((v1 == null) || (v2 == null)) {
 		if (String.class.isInstance(v1)) {
-			if (((String) v1).length() == 0) {
+			if (((String) v1).trim().length() == 0) {
 				v1 = null;
 			}
 		}
 		if (String.class.isInstance(v2)) {
-			if (((String) v2).length() == 0) {
+			if (((String) v2).trim().length() == 0) {
 				v2 = null;
 			}
 		}

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.java?rev=569607&r1=569606&r2=569607&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.java
(original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.java
Fri Aug 24 20:55:10 2007
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.2: "ValidWhenParser.g" -> "ValidWhenParser.java"$
+// $ANTLR 2.7.6 (2005-12-22): "ValidWhenParser.g" -> "ValidWhenParser.java"$
 
 /*
  * $Id$

Modified: struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.txt
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.txt?rev=569607&r1=569606&r2=569607&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.txt
(original)
+++ struts/struts1/trunk/core/src/main/java/org/apache/struts/validator/validwhen/ValidWhenParserTokenTypes.txt
Fri Aug 24 20:55:10 2007
@@ -1,4 +1,4 @@
-// $ANTLR 2.7.2: ValidWhenParser.g -> ValidWhenParserTokenTypes.txt$
+// $ANTLR 2.7.6 (2005-12-22): ValidWhenParser.g -> ValidWhenParserTokenTypes.txt$
 ValidWhenParser    // output token vocab name
 DECIMAL_LITERAL=4
 HEX_LITERAL=5

Modified: struts/struts1/trunk/core/src/test/java/org/apache/struts/validator/TestValidWhen.java
URL: http://svn.apache.org/viewvc/struts/struts1/trunk/core/src/test/java/org/apache/struts/validator/TestValidWhen.java?rev=569607&r1=569606&r2=569607&view=diff
==============================================================================
--- struts/struts1/trunk/core/src/test/java/org/apache/struts/validator/TestValidWhen.java
(original)
+++ struts/struts1/trunk/core/src/test/java/org/apache/struts/validator/TestValidWhen.java
Fri Aug 24 20:55:10 2007
@@ -198,6 +198,14 @@
 
         // Null
         doParse("(*this* == null)", testBean, 0, "stringValue2", true);
+
+        // 0-length empty string
+        testBean.setStringValue2("");
+        doParse("(*this* == null)", testBean, 0, "stringValue2", true);
+
+        // N-length empty string
+        testBean.setStringValue2("  ");
+        doParse("(*this* == null)", testBean, 0, "stringValue2", true);
     }
 
     /**



Mime
View raw message