struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From musa...@apache.org
Subject svn commit: r629504 - /struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java
Date Wed, 20 Feb 2008 15:26:20 GMT
Author: musachy
Date: Wed Feb 20 07:26:19 2008
New Revision: 629504

URL: http://svn.apache.org/viewvc?rev=629504&view=rev
Log:
WW-2500 JSONValidationInterceptor: IE chokes when evaling JSON string
* Add a comma to separate the fields, only when there are action errors

Modified:
    struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java

Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java?rev=629504&r1=629503&r2=629504&view=diff
==============================================================================
--- struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java
(original)
+++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/interceptor/validation/JSONValidationInterceptor.java
Wed Feb 20 07:26:19 2008
@@ -127,12 +127,13 @@
             //action errors
             if (validationAware.hasActionErrors()) {
                 sb.append("\"errors\":");
-                sb.append(buildArray(validationAware.getActionErrors()));
-                sb.append(",");
+                sb.append(buildArray(validationAware.getActionErrors()));               

             }
 
             //field errors
             if (validationAware.hasFieldErrors()) {
+                if (validationAware.hasActionErrors())
+                    sb.append(",");
                 sb.append("\"fieldErrors\": {");
                 Map<String, List<String>> fieldErrors = validationAware
                     .getFieldErrors();



Mime
View raw message