You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ma...@apache.org on 2008/08/14 10:18:11 UTC

svn commit: r685804 - /myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java

Author: matzew
Date: Thu Aug 14 01:18:10 2008
New Revision: 685804

URL: http://svn.apache.org/viewvc?rev=685804&view=rev
Log:
TRINIDAD-1179 - Custom message & custom hint message of the length validator not displayed when the minimum attribute is specified and the maximum is not

Thanks to Anita Anandan for the patch

Modified:
    myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java

Modified: myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java?rev=685804&r1=685803&r2=685804&view=diff
==============================================================================
--- myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java (original)
+++ myfaces/trinidad/branches/1.2.9.1-branch/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java Thu Aug 14 01:18:10 2008
@@ -6,9 +6,9 @@
  *  to you under the Apache License, Version 2.0 (the
  *  "License"); you may not use this file except in compliance
  *  with the License.  You may obtain a copy of the License at
- * 
+ *
  *  http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  *  Unless required by applicable law or agreed to in writing,
  *  software distributed under the License is distributed on an
  *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -61,6 +61,11 @@
   {
     int max = getMaximum();
     int min = getMinimum();
+    // If min is specified, and max is not, it implies that max is Integer.MAX_VALUE
+    if (min > 0 && max == 0)
+    {
+      max = Integer.MAX_VALUE;
+    }
 
     // Only pass down the messages that are relevant to this
     // validator instance, based on the min and max
@@ -100,7 +105,7 @@
       detail = getMessageDetailMaximum();
       hint = getHintMaximum();
     }
-    
+
     Map<String, String> cMessages = null;
     if ((detail != null) || (hint != null))
     {
@@ -114,13 +119,13 @@
     return _getTrLengthValidator(context, component, max, min, cMessages);
 
   }
-  
+
   public String getClientLibrarySource(
    FacesContext context)
   {
     return null;
   }
-  
+
   private static String _getTrLengthValidator(
     FacesContext context,
     UIComponent component,
@@ -159,4 +164,4 @@
 
   private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "TrLengthValidator()" );
 
-}
\ No newline at end of file
+}