Thanks Taher for support,

Tests pass locally on Windows 7 with java version "1.8.0_101"

------------------------------------------------------------------------------------------------------------------------------------------------------
2016-09-16 15:07:08,916 |main                 |ContainerLoader               
|I| Stopped container component-container-test

Trying to override old definition of datatype junitreport
:testIntegration

BUILD SUCCESSFUL

Total time: 6 mins 56.874 secs
C:\projectASF-Mars\ofbiz>java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

------------------------------------------------------------------------------------------------------------------------------------------------------
But not locally on Ubuntu 13.10 with java version "1.8.0_91"

BUILD FAILED

Total time: 9 mins 30.59 secs
jacques@jacques-VirtualBox:~/asfprojects/ofbiz$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
------------------------------------------------------------------------------------------------------------------------------------------------------

Nor on "our" Buildbot which uses Ubuntu 10.4.x (LTS) with 1.8.0_40
------------------------------------------------------------------------------------------------------------------------------------------------------

Certainly another Windows quirk

Seriously, I tried to update the JDK locally using
sudo apt-get install oracle-java8-installer
it says I have the latest.

Infra can offer a custom Debian for java version "1.8.0_102", but this needs 
more investigation, and is on its way

Jacques

Le 16/09/2016 à 14:09, Taher Alkhateeb a écrit :
Jacques are you even compiling (let alone testing) before committing? Do
you know what you're doing here?

On Fri, Sep 16, 2016 at 2:53 PM, <jler...@apache.org> wrote:

Author: jleroux
Date: Fri Sep 16 11:53:27 2016
New Revision: 1761023

URL: http://svn.apache.org/viewvc?rev=1761023&view=rev
Log:
Improves: Use try-with-resources statement wherever it's possible
(OFBIZ-8202)

These are a non functional changes for the accounting component

Modified:
     ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/finaccount/FinAccountServices.java
     ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/payment/PaymentGatewayServices.java

Modified: ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/finaccount/FinAccountServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/
accounting/src/main/java/org/apache/ofbiz/accounting/
finaccount/FinAccountServices.java?rev=1761023&r1=1761022&
r2=1761023&view=diff
============================================================
==================
--- ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/finaccount/FinAccountServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/finaccount/FinAccountServices.java Fri Sep 16
11:53:27 2016
@@ -376,10 +376,7 @@ public class FinAccountServices {
                          EntityCondition.makeCondition("finAccountId",
EntityOperator.EQUALS, finAccountId));
                  EntityCondition condition = 
EntityCondition.makeCondition(exprs,
EntityOperator.AND);

-                EntityListIterator eli = null;
-                try {
-                    eli = EntityQuery.use(delegator).
from("FinAccountTrans").where(condition).orderBy("-transactionDate").
queryIterator();
-
+                try (EntityListIterator eli  = EntityQuery.use(delegator).
from("FinAccountTrans").where(condition).orderBy("-transactionDate").queryIterator())
{
                      GenericValue trans;
                      while (remainingBalance.compareTo(FinAccountHelper.ZERO)
< 0 && (trans = eli.next()) != null) {
                          String orderId = trans.getString("orderId");
@@ -475,14 +472,6 @@ public class FinAccountServices {
                  } catch (GeneralException e) {
                      Debug.logError(e, module);
                      return ServiceUtil.returnError(e.getMessage());
-                } finally {
-                    if (eli != null) {
-                        try {
-                            eli.close();
-                        } catch (GenericEntityException e) {
-                            Debug.logWarning(e, module);
-                        }
-                    }
                  }

                  // check to make sure we balanced out

Modified: ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/
accounting/src/main/java/org/apache/ofbiz/accounting/payment/
PaymentGatewayServices.java?rev=1761023&r1=1761022&r2=1761023&view=diff
============================================================
==================
--- ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/trunk/applications/accounting/src/main/java/org/
apache/ofbiz/accounting/payment/PaymentGatewayServices.java Fri Sep 16
11:53:27 2016
@@ -2688,16 +2688,10 @@ public class PaymentGatewayServices {
          LocalDispatcher dispatcher = dctx.getDispatcher();
          GenericValue userLogin = (GenericValue) context.get("userLogin");

-        // get a list of all payment prefs still pending
-        List<EntityExpr> exprs = UtilMisc.toList(
EntityCondition.makeCondition("statusId", EntityOperator.EQUALS,
"PAYMENT_NOT_AUTH"),
-                EntityCondition.makeCondition("processAttempt",
EntityOperator.GREATER_THAN, Long.valueOf(0)));
-
-        EntityListIterator eli = null;
-        try {
-            eli = EntityQuery.use(delegator).
from("OrderPaymentPreference")
+        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);
@@ -2717,14 +2711,6 @@ public class PaymentGatewayServices {
              }
          } catch (GenericEntityException e) {
              Debug.logError(e, module);
-        } finally {
-            if (eli != null) {
-                try {
-                    eli.close();
-                } catch (GenericEntityException e) {
-                    Debug.logError(e, module);
-                }
-            }
          }

          return ServiceUtil.returnSuccess();
@@ -2741,12 +2727,11 @@ public class PaymentGatewayServices {
          calcCal.add(Calendar.WEEK_OF_YEAR, -1);
          Timestamp oneWeekAgo = new Timestamp(calcCal.getTimeInMillis());

-        EntityListIterator eli = null;
-        try {
-            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();
+
+        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()) {

              List<String> processList = new LinkedList<String>();
              if (eli != null) {
@@ -2767,14 +2752,6 @@ public class PaymentGatewayServices {
              }
          } catch (GenericEntityException e) {
              Debug.logError(e, module);
-        } finally {
-            if (eli != null) {
-                try {
-                    eli.close();
-                } catch (GenericEntityException e) {
-                    Debug.logError(e, module);
-                }
-            }
          }
          return ServiceUtil.returnSuccess();
      }
@@ -2837,7 +2814,7 @@ public class PaymentGatewayServices {
      }

      public static boolean checkAuthValidity(GenericValue
orderPaymentPreference, String paymentConfig) {
-       Delegator delegator = orderPaymentPreference.getDelegator();
+        Delegator delegator = orderPaymentPreference.getDelegator();
          Timestamp authTime = PaymentGatewayServices.getAuthTime(
orderPaymentPreference);
          if (authTime == null) {
              return false;




Reply via email to