Author: musachy
Date: Tue Nov 10 18:10:53 2009
New Revision: 834575

URL: http://svn.apache.org/viewvc?rev=834575&view=rev
Log:
remove "model." from the key fields only if they do start with that, and the 
action is modeldriven (assuming that because it is model driven the error keys 
will start with "model." is not ok)

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=834575&r1=834574&r2=834575&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
 Tue Nov 10 18:10:53 2009
@@ -146,8 +146,9 @@
                     .entrySet()) {
                     sb.append("\"");
                     //if it is model driven, remove "model." see WW-2721
-                    sb.append(validationAware instanceof ModelDriven ? 
fieldError.getKey().substring(6)
-                            : fieldError.getKey());
+                    String fieldErrorKey = fieldError.getKey();
+                    sb.append(((validationAware instanceof ModelDriven) &&  
fieldErrorKey.startsWith("model."))? fieldErrorKey.substring(6)
+                            : fieldErrorKey);
                     sb.append("\":");
                     sb.append(buildArray(fieldError.getValue()));
                     sb.append(",");


Reply via email to