You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2016/01/14 22:23:01 UTC

svn commit: r1724691 - in /ofbiz/branches/release15.12: ./ applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy

Author: jleroux
Date: Thu Jan 14 21:23:00 2016
New Revision: 1724691

URL: http://svn.apache.org/viewvc?rev=1724691&view=rev
Log:
"Applied fix from trunk for revision: 1724689  " 
------------------------------------------------------------------------
r1724689 | jleroux | 2016-01-14 22:19:26 +0100 (jeu. 14 janv. 2016) | 30 lignes

Fixes "Exception when sending an order confirmation email" reported by Eric Kingston at https://issues.apache.org/jira/browse/OFBIZ-6792

Receive the following exception while placing an order through the ecommerce application.....

groovy.lang.MissingPropertyException: No such property: response for class: CompanyHeader

Following is the relevant portion of the stack trace...

at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50) ~[groovy-all-2.2.1.jar:2.2.1]
at org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49) ~[groovy-all-2.2.1.jar:2.2.1]
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231) ~[groovy-all-2.2.1.jar:2.2.1]
at CompanyHeader.run(CompanyHeader.groovy:48) ~[?:?]

...

Apparently, the response object is not available within the context when the sendOrderConfirmation service is run.  

Steps to reproduce the exception....

1.  Checkout OFBiz 14.12 Release (revision was 1722928 at the time of checkout).
2.  Run the default build.
3.  Load the demo data.
4.  Start the OFBiz instance (it will use the OOTB default derby db of course).
5.  Within a browser goto URL..  http://localhost:8080/ecommerce 
6.  Proceed to place an order adding at least one item to the cart.
7.  While checking out you may or may not have to create an account.  I created an account for this test.
8.  Proceed through all the checkout steps and submit the order.

Monitor the log and you will see the exception occur within a few seconds.  This exception doesn't occur in the OFBiz 13.07 release branch.  In fact, the response object is not referenced at all in the CompanyHeader.groovy from the 13.07 branch.  Whoever inserted the code that references the response object within the CompanyHeader.groovy script, must have neglected to test the changes with the ecommerce application.  I only found the error while migrating our instance of OFBiz to the 14.12 release.  Our custom ecommerce application employs the sendOrderConfirmation service the same way the OOTB ecommerce application does.

------------------------------------------------------------------------


Modified:
    ofbiz/branches/release15.12/   (props changed)
    ofbiz/branches/release15.12/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy

Propchange: ofbiz/branches/release15.12/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jan 14 21:23:00 2016
@@ -9,4 +9,4 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/trunk:1722712,1724402,1724411,1724566
+/ofbiz/trunk:1722712,1724402,1724411,1724566,1724689

Modified: ofbiz/branches/release15.12/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy?rev=1724691&r1=1724690&r2=1724691&view=diff
==============================================================================
--- ofbiz/branches/release15.12/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy (original)
+++ ofbiz/branches/release15.12/applications/order/webapp/ordermgr/WEB-INF/actions/order/CompanyHeader.groovy Thu Jan 14 21:23:00 2016
@@ -44,11 +44,15 @@ fromPartyId = parameters.fromPartyId;
 
 if (!orderHeader && orderId) {
     orderHeader = from("OrderHeader").where("orderId", orderId).queryOne();
-    if (parameters.facilityId) {
-        UtilHttp.setContentDisposition(response, "PickSheet" + orderId + ".pdf");
-    } else {
-        UtilHttp.setContentDisposition(response, orderId + ".pdf");
-    }
+    try {
+        if (parameters.facilityId) {
+            UtilHttp.setContentDisposition(response, "PickSheet" + orderId + ".pdf");
+        } else {
+            UtilHttp.setContentDisposition(response, orderId + ".pdf");
+        }
+    } catch (MissingPropertyException e) {
+        // This hack for OFBIZ-6792 to avoid "groovy.lang.MissingPropertyException: No such property: response for class: CompanyHeader" when response does exist (in sendOrderConfirmation service)
+    }    
 } else if (shipmentId) {
     shipment = from("Shipment").where("shipmentId", shipmentId).queryOne();
     orderHeader = shipment.getRelatedOne("PrimaryOrderHeader", false);
@@ -56,7 +60,11 @@ if (!orderHeader && orderId) {
 
 if (!invoice && invoiceId)    {
     invoice = from("Invoice").where("invoiceId", invoiceId).queryOne();
-    UtilHttp.setContentDisposition(response, invoiceId + ".pdf");
+    try {
+        UtilHttp.setContentDisposition(response, invoiceId + ".pdf");
+    } catch (MissingPropertyException e) {
+        // This hack for OFBIZ-6792 to avoid "groovy.lang.MissingPropertyException: No such property: response for class: CompanyHeader" when response does exist (in sendOrderConfirmation service)
+    }    
 }
 
 if (!returnHeader && returnId) {