svn commit: r589977 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r589977 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java

jonesde
Author: jonesde
Date: Tue Oct 30 00:19:17 2007
New Revision: 589977

URL: http://svn.apache.org/viewvc?rev=589977&view=rev
Log:
Based on feedback from Adrian changed to merge error messages instead of overwriting them; part of OFBIZ-1237

Modified:
    ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java?rev=589977&r1=589976&r2=589977&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/eca/ServiceEcaAction.java Tue Oct 30 00:19:17 2007
@@ -24,6 +24,7 @@
 import javolution.util.FastMap;
 
 import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilMisc;
 import org.ofbiz.base.util.UtilValidate;
 import org.ofbiz.service.DispatchContext;
 import org.ofbiz.service.GenericServiceException;
@@ -133,12 +134,18 @@
 
         // use the result to update the result fields
         if (resultToResult) {
-            result.putAll(dctx.getModelService(selfService).makeValid(actionResult, ModelService.OUT_PARAM, false, null));
+         Map normalizedActionResult = dctx.getModelService(selfService).makeValid(actionResult, ModelService.OUT_PARAM, false, null);
+         // don't copy over the error messages, use the combining code to do that later
+         normalizedActionResult.remove(ModelService.ERROR_MESSAGE);
+         normalizedActionResult.remove(ModelService.ERROR_MESSAGE_LIST);
+         normalizedActionResult.remove(ModelService.ERROR_MESSAGE_MAP);
+            result.putAll(normalizedActionResult);
         }
 
         // if we aren't ignoring errors check it here...
         boolean success = true;
-        if (actionResult != null) {
+        // don't do this if resultToResult, will already be copied over
+        if (actionResult != null && !resultToResult) {
             if (!ignoreFailure) {
                 if (ModelService.RESPOND_FAIL.equals(actionResult.get(ModelService.RESPONSE_MESSAGE))) {
                     if (result != null) {
@@ -157,7 +164,8 @@
             }
         }
 
-        if (result != null && !success) {
+        // copy/combine error messages on error/failure (!success) or on resultToResult to combine any error info coming out, regardless of success status
+        if (!success || resultToResult) {
             String errorMessage = (String) actionResult.get(ModelService.ERROR_MESSAGE);
             List<? extends Object> errorMessageList = UtilGenerics.checkList(actionResult.get(ModelService.ERROR_MESSAGE_LIST));
             Map<String, ? extends Object> errorMessageMap = UtilGenerics.checkMap(actionResult.get(ModelService.ERROR_MESSAGE_MAP));