And if you are interested here is with |-Xlint:unchecked and -Xlint:deprecation|
C:\projectASF-Mars\ofbiz>gradlew build
:compileJava
C:\projectASF-Mars\ofbiz\framework\base\src\main\java\org\apache\ofbiz\base\test\GenericTestCaseBase.java:353: warning: [unchecked] Possible heap
pollution from parameterized vararg type T
public static <T> List<T> list(T... list) {
^
where T is a type-variable:
T extends Object declared in method <T>list(T...)
C:\projectASF-Mars\ofbiz\framework\base\src\main\java\org\apache\ofbiz\base\test\GenericTestCaseBase.java:363: warning: [unchecked] Possible heap
pollution from parameterized vararg type T
public static <T> Set<T> set(T... list) {
^
where T is a type-variable:
T extends Object declared in method <T>set(T...)
C:\projectASF-Mars\ofbiz\framework\base\src\main\java\org\apache\ofbiz\base\util\UtilGenerics.java:159: warning: [unchecked] Possible heap pollution
from parameterized vararg type Object
public static <K, Object> Map<K, Object> toMap(Class<K> keyType, Object...
data) {
^
where Object,K are type-variables:
Object extends java.lang.Object declared in method
<K,Object>toMap(Class<K>,Object...)
K extends java.lang.Object declared in method
<K,Object>toMap(Class<K>,Object...)
C:\projectASF-Mars\ofbiz\framework\entity\src\main\java\org\apache\ofbiz\entity\condition\EntityCondition.java:59: warning: [unchecked] Possible heap
pollution from parameterized vararg type T
public static <T extends EntityCondition> EntityConditionList<T>
makeCondition(EntityJoinOperator operator, T... conditionList) {
^
where T is a type-variable:
T extends EntityCondition declared in method
<T>makeCondition(EntityJoinOperator,T...)
C:\projectASF-Mars\ofbiz\framework\entity\src\main\java\org\apache\ofbiz\entity\condition\EntityCondition.java:63: warning: [unchecked] Possible heap
pollution from parameterized vararg type T
public static <T extends EntityCondition> EntityConditionList<T>
makeCondition(T... conditionList) {
^
where T is a type-variable:
T extends EntityCondition declared in method <T>makeCondition(T...)
C:\projectASF-Mars\ofbiz\framework\entity\src\main\java\org\apache\ofbiz\entity\condition\EntityFieldMap.java:50: warning: [unchecked] Possible heap
pollution from parameterized vararg type V
public <V> EntityFieldMap(EntityComparisonOperator<?,?> compOp,
EntityJoinOperator joinOp, V... keysValues) {
^
where V is a type-variable:
V extends Object declared in constructor
<V>EntityFieldMap(EntityComparisonOperator<?,?>,EntityJoinOperator,V...)
C:\projectASF-Mars\ofbiz\framework\entity\src\main\java\org\apache\ofbiz\entity\connection\DebugManagedDataSource.java:34: warning: [unchecked]
<T#1>unwrap(Class<T#1>) in PoolingDataSource implements <T#2>unw
rap(Class<T#2>) in Wrapper
public class DebugManagedDataSource extends ManagedDataSource {
^
return type requires unchecked conversion from Object to T#2
where T#1,T#2 are type-variables:
T#1 extends Object declared in method <T#1>unwrap(Class<T#1>)
T#2 extends Object declared in method <T#2>unwrap(Class<T#2>)
C:\projectASF-Mars\ofbiz\framework\entity\src\main\java\org\apache\ofbiz\entity\connection\DebugManagedDataSource.java:39: warning: [unchecked]
unchecked call to ManagedDataSource(ObjectPool<C>,TransactionReg
istry) as a member of the raw type ManagedDataSource
super(pool, transactionRegistry);
^
where C is a type-variable:
C extends Connection declared in class ManagedDataSource
C:\projectASF-Mars\ofbiz\framework\entity\src\main\java\org\apache\ofbiz\entity\util\EntityUtil.java:357:
warning: [unchecked] unchecked cast
T newValue = (T) value.clone();
^
required: T
found: Object
where T is a type-variable:
T extends GenericEntity declared in method
<T>localizedOrderBy(Collection<T>,List<String>,Locale)
C:\projectASF-Mars\ofbiz\framework\service\src\main\java\org\apache\ofbiz\service\ServiceUtil.java:650: warning: [unchecked] Possible heap pollution
from parameterized vararg type T
public static <T extends Object> Map<String, Object> makeContext(T... args)
{
^
where T is a type-variable:
T extends Object declared in method <T>makeContext(T...)
C:\projectASF-Mars\ofbiz\framework\widget\src\main\java\org\apache\ofbiz\widget\renderer\fo\ScreenFopViewHandler.java:143: warning: [unchecked]
unchecked call to put(K,V) as a member of the raw type Map
foUserAgent.getRendererOptions().put(PDFEncryptionOption.ENCRYPTION_PARAMS,
pdfEncryptionParams);
^
where K,V are type-variables:
K extends Object declared in interface Map
V extends Object declared in interface Map
C:\projectASF-Mars\ofbiz\applications\workeffort\src\main\java\org\apache\ofbiz\workeffort\workeffort\WorkEffortServices.java:377: warning:
[unchecked] unchecked conversion
calendarEntryByDateRangeList = new LinkedList();
^
required: List<Map<String,Object>>
found: LinkedList
C:\projectASF-Mars\ofbiz\applications\accounting\src\main\java\org\apache\ofbiz\accounting\payment\PaymentGatewayServices.java:3063: warning:
[unchecked] unchecked method invocation: method makeValue in inter
face Delegator is applied to given types
GenericValue orderPaymentPref =
delegator.makeValue("OrderPaymentPreference", new HashMap());
^
required: String,Map<String,? extends Object>
found: String,HashMap
C:\projectASF-Mars\ofbiz\applications\accounting\src\main\java\org\apache\ofbiz\accounting\payment\PaymentGatewayServices.java:3063: warning:
[unchecked] unchecked conversion
GenericValue orderPaymentPref =
delegator.makeValue("OrderPaymentPreference", new HashMap());
^
required: Map<String,? extends Object>
found: HashMap
C:\projectASF-Mars\ofbiz\applications\humanres\src\main\java\org\apache\ofbiz\humanres\HumanResEvents.java:168:
warning: [unchecked] unchecked cast
Map<String , Object> partyGroup = (Map<String, Object>)
params.get("partyGroup");
^
required: Map<String,Object>
found: Object
C:\projectASF-Mars\ofbiz\applications\order\src\main\java\org\apache\ofbiz\order\order\OrderServices.java:5962: warning: [unchecked] unchecked method
invocation: method makeValidContext in class DispatchConte
xt is applied to given types
Map<String, Object> cancelOrderInventoryReservationMap =
dctx.makeValidContext("cancelOrderInventoryReservation", "IN", context);
^
required: String,String,Map<String,? extends Object>
found: String,String,Map
C:\projectASF-Mars\ofbiz\applications\order\src\main\java\org\apache\ofbiz\order\order\OrderServices.java:5962:
warning: [unchecked] unchecked conversion
Map<String, Object> cancelOrderInventoryReservationMap =
dctx.makeValidContext("cancelOrderInventoryReservation", "IN", context);
^
required: Map<String,? extends Object>
found: Map
C:\projectASF-Mars\ofbiz\applications\order\src\main\java\org\apache\ofbiz\order\order\OrderServices.java:5962:
warning: [unchecked] unchecked conversion
Map<String, Object> cancelOrderInventoryReservationMap =
dctx.makeValidContext("cancelOrderInventoryReservation", "IN", context);
^
required: Map<String,Object>
found: Map
C:\projectASF-Mars\ofbiz\applications\order\src\main\java\org\apache\ofbiz\order\order\OrderServices.java:5965: warning: [unchecked] unchecked method
invocation: method makeValidContext in class DispatchConte
xt is applied to given types
Map<String, Object> deleteOrderItemShipGroupAssocMap =
dctx.makeValidContext("deleteOrderItemShipGroupAssoc", "IN", context);
^
required: String,String,Map<String,? extends Object>
found: String,String,Map
C:\projectASF-Mars\ofbiz\applications\order\src\main\java\org\apache\ofbiz\order\order\OrderServices.java:5965:
warning: [unchecked] unchecked conversion
Map<String, Object> deleteOrderItemShipGroupAssocMap =
dctx.makeValidContext("deleteOrderItemShipGroupAssoc", "IN", context);
^
required: Map<String,? extends Object>
found: Map
C:\projectASF-Mars\ofbiz\applications\order\src\main\java\org\apache\ofbiz\order\order\OrderServices.java:5965:
warning: [unchecked] unchecked conversion
Map<String, Object> deleteOrderItemShipGroupAssocMap =
dctx.makeValidContext("deleteOrderItemShipGroupAssoc", "IN", context);
^
required: Map<String,Object>
found: Map
C:\projectASF-Mars\ofbiz\applications\marketing\src\main\java\org\apache\ofbiz\marketing\tracking\TrackingCodeEvents.java:288: warning: [unchecked]
unchecked method invocation: method setTrail in class Catego
ryWorker is applied to given types
CategoryWorker.setTrail(request, new LinkedList());
^
required: ServletRequest,List<String>
found: HttpServletRequest,LinkedList
C:\projectASF-Mars\ofbiz\applications\marketing\src\main\java\org\apache\ofbiz\marketing\tracking\TrackingCodeEvents.java:288: warning: [unchecked]
unchecked conversion
CategoryWorker.setTrail(request, new LinkedList());
^
required: List<String>
found: LinkedList
23 warnings
:createBaseTestServiceProviderJar
:processResources UP-TO-DATE
:classes
:jar UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test UP-TO-DATE
:check UP-TO-DATE
:build UP-TO-DATE
BUILD SUCCESSFUL
Total time: 31.716 secs
C:\projectASF-Mars\ofbiz>
Jacques
Le 16/09/2016 à 16:41, Jacques Le Roux a écrit :
Sorry, I used locally tools/test.bat which is
svn up && gradlew cleanAll eclipse loadDefault testIntegration
And it works perfectly
It also compiles w/o problems with "gradlew clean build":
C:\projectASF-Mars\ofbiz>gradlew clean build
:clean
:compileJava
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:createBaseTestServiceProviderJar
:processResources
:classes
:jar
:assemble
:compileTestJava
:processTestResources UP-TO-DATE
:testClasses
:test
:check
:build
BUILD SUCCESSFUL
Total time: 46.61 secs
C:\projectASF-Mars\ofbiz>
Again thanks for your help
Jacques
Le 16/09/2016 à 16:28, Taher Alkhateeb a écrit :
Jacques it seems you don't get it. The problem is not an OS problem. The
problem is in your code, it's all wrong on many levels. And by the way, the
system does not even compile (on windows and linux!)
On Fri, Sep 16, 2016 at 5:21 PM, Jacques Le Roux <
jacques.le.r...@les7arts.com> wrote:
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("-transacti
onDate").queryIterator())
{
GenericValue trans;
while (remainingBalance.compareTo(Fi
nAccountHelper.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.getTimeInMil
lis());
- EntityListIterator eli = null;
- try {
- eli = EntityQuery.use(delegator).
from("OrderPaymentPreference")
- .where(EntityCondition.makeCon
dition("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;