Revision: 1115
          http://stripes.svn.sourceforge.net/stripes/?rev=1115&view=rev
Author:   bengunter
Date:     2009-03-11 20:12:03 +0000 (Wed, 11 Mar 2009)

Log Message:
-----------
Fixed STS-688. Validation errors are logged at DEBUG.

Modified Paths:
--------------
    trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java

Modified: 
trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java
===================================================================
--- trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java  
2009-03-06 05:23:24 UTC (rev 1114)
+++ trunk/stripes/src/net/sourceforge/stripes/controller/DispatcherHelper.java  
2009-03-11 20:12:03 UTC (rev 1115)
@@ -38,6 +38,7 @@
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.SortedSet;
 import java.util.TreeSet;
@@ -371,6 +372,7 @@
 
             // If there are still errors see if we need to lookup the 
resolution
             if (errors.size() > 0 && resolution == null) {
+                logValidationErrors(context);
                 resolution = context.getSourcePageResolution();
             }
         }
@@ -501,4 +503,22 @@
                      "what are hopefully obvious reasons!");
         }
     }
+
+    /** Log validation errors at DEBUG to help during development. */
+    public static final void logValidationErrors(ActionBeanContext context) {
+        Locale locale = context.getRequest().getLocale();
+        StringBuilder buf = new StringBuilder("The following validation errors 
need to be fixed:");
+        for (List<ValidationError> list : 
context.getValidationErrors().values()) {
+            for (ValidationError error : list) {
+                String fieldName = error.getFieldName();
+                if (ValidationErrors.GLOBAL_ERROR.equals(fieldName))
+                    fieldName = "GLOBAL";
+
+                buf.append("\n    -> [").append(fieldName).append("] ").append(
+                        error.getMessage(locale));
+            }
+        }
+
+        log.debug(buf);
+    }
 }


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Stripes-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-development

Reply via email to