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 2017/03/22 08:26:12 UTC
svn commit: r1788065 - in /ofbiz/ofbiz-framework/trunk/applications:
accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
Author: jleroux
Date: Wed Mar 22 08:26:12 2017
New Revision: 1788065
URL: http://svn.apache.org/viewvc?rev=1788065&view=rev
Log:
No functional changes, use a multi exceptions catch I missed and format
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1788065&r1=1788064&r2=1788065&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java Wed Mar 22 08:26:12 2017
@@ -2688,10 +2688,13 @@ public class PaymentGatewayServices {
LocalDispatcher dispatcher = dctx.getDispatcher();
GenericValue userLogin = (GenericValue) context.get("userLogin");
- try (EntityListIterator eli = EntityQuery.use(delegator).from("OrderPaymentPreference")
- .where(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
+ try (EntityListIterator eli = EntityQuery.use(delegator)
+ .from("OrderPaymentPreference")
+ .where(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
EntityCondition.makeCondition("processAttempt", EntityOperator.GREATER_THAN, Long.valueOf(0)))
- .orderBy("orderId").queryIterator()) {
+ .orderBy("orderId")
+ .queryIterator()) {
+
List<String> processList = new LinkedList<String>();
if (eli != null) {
Debug.logInfo("Processing failed order re-auth(s)", module);
@@ -2728,7 +2731,8 @@ public class PaymentGatewayServices {
Timestamp oneWeekAgo = new Timestamp(calcCal.getTimeInMillis());
- try (EntityListIterator eli = EntityQuery.use(delegator).from("OrderPaymentPreference")
+ try (EntityListIterator eli = EntityQuery.use(delegator)
+ .from("OrderPaymentPreference")
.where(EntityCondition.makeCondition("needsNsfRetry", EntityOperator.EQUALS, "Y"),
EntityCondition.makeCondition(ModelEntity.STAMP_FIELD, EntityOperator.LESS_THAN_EQUAL_TO, oneWeekAgo))
.orderBy("orderId").queryIterator()) {
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1788065&r1=1788064&r2=1788065&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Wed Mar 22 08:26:12 2017
@@ -3529,18 +3529,12 @@ public class ShoppingCart implements Ite
return null;
}
}
-
- } catch (GenericEntityException gse) {
- Debug.logError(gse, module);
- return null;
- } catch (GenericServiceException gse) {
- Debug.logError(gse, module);
- return null;
+ } catch (GenericEntityException | GenericServiceException e) {
+ Debug.logError(e, module);
} catch (Exception e) {
Debug.logError(e, module);
return null;
}
-
return newProductId;
}
Re: Fwd: svn commit: r1788065 - in
/ofbiz/ofbiz-framework/trunk/applications:
accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGateway
Services.java
order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Jacopo,
Thanks for you review, this is indeed a good idea. I'll revisit related changes
Jacques
Le 23/03/2017 � 09:03, Jacopo Cappellato a �crit :
> Forwarding an email that I sent yesterday and seems to be lost in the net.
>
> Jacopo
>
> ---------- Forwarded message ----------
> From: Jacopo Cappellato <ja...@hotwaxsystems.com>
> Date: Wed, Mar 22, 2017 at 10:00 AM
> Subject: Re: svn commit: r1788065 - in
> /ofbiz/ofbiz-framework/trunk/applications:
> accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
> order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
> To: dev@ofbiz.apache.org
> Cc: commits@ofbiz.apache.org
>
>
> On Wed, Mar 22, 2017 at 9:26 AM, <jl...@apache.org> wrote:
>
>> ...
> + try (EntityListIterator eli = EntityQuery.use(delegator)
>> + .from("OrderPaymentPreference")
>> + .where(EntityCondition.makeCondition("statusId",
>> EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
>> EntityCondition.
>> makeCondition("processAttempt", EntityOperator.GREATER_THAN,
>> Long.valueOf(0)))
>> - .orderBy("orderId").queryIterator()) {
>> + .orderBy("orderId")
>> + .queryIterator()) {
>> +
>
> With code like the above, I think that embedding everything in the try
> clause makes the code a bit less readable.
> One option would be to split the entity query code in two lines:
>
> EntityQuery eq = EntityQuery.use(delegator)
> .from("OrderPaymentPreference")
> .where(EntityCondition.makeCondition("statusId",
> EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
> EntityCondition.makeCondition("processAttempt",
> EntityOperator.GREATER_THAN, Long.valueOf(0)))
> .orderBy("orderId");
>
> try (EntityListIterator eli = eq.queryIterator()) {
> ...
>
> Jacopo
>
Fwd: svn commit: r1788065 - in /ofbiz/ofbiz-framework/trunk/applications:
accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
Posted by Jacopo Cappellato <ja...@hotwaxsystems.com>.
Forwarding an email that I sent yesterday and seems to be lost in the net.
Jacopo
---------- Forwarded message ----------
From: Jacopo Cappellato <ja...@hotwaxsystems.com>
Date: Wed, Mar 22, 2017 at 10:00 AM
Subject: Re: svn commit: r1788065 - in
/ofbiz/ofbiz-framework/trunk/applications:
accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
To: dev@ofbiz.apache.org
Cc: commits@ofbiz.apache.org
On Wed, Mar 22, 2017 at 9:26 AM, <jl...@apache.org> wrote:
> ...
+ try (EntityListIterator eli = EntityQuery.use(delegator)
> + .from("OrderPaymentPreference")
> + .where(EntityCondition.makeCondition("statusId",
> EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
> EntityCondition.
> makeCondition("processAttempt", EntityOperator.GREATER_THAN,
> Long.valueOf(0)))
> - .orderBy("orderId").queryIterator()) {
> + .orderBy("orderId")
> + .queryIterator()) {
> +
With code like the above, I think that embedding everything in the try
clause makes the code a bit less readable.
One option would be to split the entity query code in two lines:
EntityQuery eq = EntityQuery.use(delegator)
.from("OrderPaymentPreference")
.where(EntityCondition.makeCondition("statusId",
EntityOperator.EQUALS, "PAYMENT_NOT_AUTH"),
EntityCondition.makeCondition("processAttempt",
EntityOperator.GREATER_THAN, Long.valueOf(0)))
.orderBy("orderId");
try (EntityListIterator eli = eq.queryIterator()) {
...
Jacopo