Re: [ofbiz-framework] branch trunk updated: Improved: Handle remaining checkstyle errors (OFBIZ-12169)

2021-05-25 Thread Jacques Le Roux

Hi,

Thanks to nmancus1's help at https://github.com/checkstyle/checkstyle/issues/10012, I finally don't know if it's a checkstyle config issue or a bug in 
checkstyle. I doubt it's the later.


As I wrote there I'm unsure about what to do. Maybe the best is to keep the current checkstyle config and "fix" the "issues" by hand. A bit tedious 
but consistent with our checkstyle history.


What do you think?

Thanks

Jacques

Le 17/05/2021 à 11:51, Jacques Le Roux a écrit :

Hi,

I send a bug report: Whitespaces at the head of line before a cast and after an instanceof or an "enhanced for" results to "'(' should be on the 
previous line"error · Issue #10012 · checkstyle/checkstyle (github.com) 


BTW, I have compared our checkstyle.xml[0] with the one for Sun from the checkstyle team[1] and they look quite dissimilar. At least at 1st glance 
comparing with WinMerge. And when using Checkstyle CLI there are much more errors reported with the Sun config from checkstyle team[1]. As code 
quality also matter, I believe we should later check that, not a priority of course...


[0] in config/checkstyle, initially created by Mathieu at 
https://issues.apache.org/jira/browse/OFBIZ-11251
[1] 
https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/sun_checks.xml

HTH

Jacques

Le 04/05/2021 à 19:52, jler...@apache.org a écrit :

Hi Team,

I have been working on 
https://checkstyle.sourceforge.io/config_whitespace.html#MethodParamPad

I could fix few issues in code. But there are still some cases that can't be handled by changing code, notably when a casting is necessary, and not 
only.


I believe there is an error in checkstyle code. If you look at the URL above and the errors reported, you will see that the errors don't belong to 
the tokens to check.


We can use this solution 
https://stackoverflow.com/questions/45109089/checkstyle-can-i-change-the-should-be-on-the-previous-line-rule-of-meth#answer-45109414

But I believe we should rather discuss with checkstyle team if a report is not 
appropriate.

What do you think?

Thanks

Jacques

Le 04/05/2021 à 10:36, jler...@apache.org a écrit :

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
  new 45f50c9  Improved: Handle remaining checkstyle errors (OFBIZ-12169)
45f50c9 is described below

commit 45f50c910d64c12a2601164fbc64a4a02ef1d833
Author: Jacques Le Roux 
AuthorDate: Tue May 4 10:34:52 2021 +0200

 Improved: Handle remaining checkstyle errors (OFBIZ-12169)
  This handles the "'(' should be on the previous line?" rule of 
MethodParamPad
  Actually not completely, because there are still some cases that 
can't be
 handled by changing code, notably when a casting is necessary. I believe 
there
 is an error in checkstyle code. I'll discuss that in dev ML before sending
 checkstyle team a report.
---
.../java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java | 4 ++--
.../java/org/apache/ofbiz/order/order/OrderReturnServices.java | 3 ++-
.../java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java | 4 ++--
build.gradle | 2 +-
.../common/src/main/java/org/apache/ofbiz/common/CommonEvents.java | 7 +++
.../main/java/org/apache/ofbiz/webapp/control/ContextFilter.java | 2 +-
.../src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java | 2 +-
  7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

index 9c956e8..7ee585a 100644
--- 
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
+++ 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
@@ -457,8 +457,8 @@ public class InvoiceServices {
  Map createInvoiceItemContext = new 
HashMap<>();
  createInvoiceItemContext.put("invoiceId", invoiceId);
createInvoiceItemContext.put("invoiceItemSeqId", invoiceItemSeqId);
- createInvoiceItemContext.put("invoiceItemTypeId", getInvoiceItemType(delegator, 
(orderItem.getString("orderItemTypeId")),
-    (product == null ? null : product.getString("productTypeId")), 
invoiceType, "INV_FPROD_ITEM"));
+ createInvoiceItemContext.put("invoiceItemTypeId", getInvoiceItemType(delegator, 
orderItem.getString("orderItemTypeId"),
+    product == null ? null : product.getString("productTypeId"), 
invoiceType, "INV_FPROD_ITEM"));
  createInvoiceItemContext.put("description", 
orderItem.get("itemDescription"));
  createInvoiceItemContext.put("quantity", billingQuantity);
  

Re: [ofbiz-framework] branch trunk updated: Improved: Handle remaining checkstyle errors (OFBIZ-12169)

2021-05-17 Thread Jacques Le Roux

Hi,

I send a bug report: Whitespaces at the head of line before a cast and after an instanceof or an "enhanced for" results to "'(' should be on the 
previous line"error · Issue #10012 · checkstyle/checkstyle (github.com) 


BTW, I have compared our checkstyle.xml[0] with the one for Sun from the checkstyle team[1] and they look quite dissimilar. At least at 1st glance 
comparing with WinMerge. And when using Checkstyle CLI there are much more errors reported with the Sun config from checkstyle team[1]. As code 
quality also matter, I believe we should later check that, not a priority of course...


[0] in config/checkstyle, initially created by Mathieu at 
https://issues.apache.org/jira/browse/OFBIZ-11251
[1] 
https://raw.githubusercontent.com/checkstyle/checkstyle/master/src/main/resources/sun_checks.xml

HTH

Jacques

Le 04/05/2021 à 19:52, jler...@apache.org a écrit :

Hi Team,

I have been working on 
https://checkstyle.sourceforge.io/config_whitespace.html#MethodParamPad

I could fix few issues in code. But there are still some cases that can't be handled by changing code, notably when a casting is necessary, and not 
only.


I believe there is an error in checkstyle code. If you look at the URL above and the errors reported, you will see that the errors don't belong to 
the tokens to check.


We can use this solution 
https://stackoverflow.com/questions/45109089/checkstyle-can-i-change-the-should-be-on-the-previous-line-rule-of-meth#answer-45109414

But I believe we should rather discuss with checkstyle team if a report is not 
appropriate.

What do you think?

Thanks

Jacques

Le 04/05/2021 à 10:36, jler...@apache.org a écrit :

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
  new 45f50c9  Improved: Handle remaining checkstyle errors (OFBIZ-12169)
45f50c9 is described below

commit 45f50c910d64c12a2601164fbc64a4a02ef1d833
Author: Jacques Le Roux 
AuthorDate: Tue May 4 10:34:52 2021 +0200

 Improved: Handle remaining checkstyle errors (OFBIZ-12169)
  This handles the "'(' should be on the previous line?" rule of 
MethodParamPad
  Actually not completely, because there are still some cases that 
can't be
 handled by changing code, notably when a casting is necessary. I believe 
there
 is an error in checkstyle code. I'll discuss that in dev ML before sending
 checkstyle team a report.
---
.../java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java | 4 ++--
.../java/org/apache/ofbiz/order/order/OrderReturnServices.java | 3 ++-
.../java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java | 4 ++--
build.gradle | 2 +-
.../common/src/main/java/org/apache/ofbiz/common/CommonEvents.java | 7 +++
.../main/java/org/apache/ofbiz/webapp/control/ContextFilter.java | 2 +-
.../src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java | 2 +-
  7 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java

index 9c956e8..7ee585a 100644
--- 
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
+++ 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
@@ -457,8 +457,8 @@ public class InvoiceServices {
  Map createInvoiceItemContext = new 
HashMap<>();
  createInvoiceItemContext.put("invoiceId", invoiceId);
createInvoiceItemContext.put("invoiceItemSeqId", invoiceItemSeqId);
- createInvoiceItemContext.put("invoiceItemTypeId", getInvoiceItemType(delegator, 
(orderItem.getString("orderItemTypeId")),
-    (product == null ? null : product.getString("productTypeId")), 
invoiceType, "INV_FPROD_ITEM"));
+ createInvoiceItemContext.put("invoiceItemTypeId", getInvoiceItemType(delegator, 
orderItem.getString("orderItemTypeId"),
+    product == null ? null : product.getString("productTypeId"), 
invoiceType, "INV_FPROD_ITEM"));
  createInvoiceItemContext.put("description", 
orderItem.get("itemDescription"));
  createInvoiceItemContext.put("quantity", billingQuantity);
  createInvoiceItemContext.put("amount", billingAmount);
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java 
b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java

index d8b469b..17f43b2 100644
--- 
a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
+++ 
b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
@@ 

Re: [ofbiz-framework] branch trunk updated: Improved: Handle remaining checkstyle errors (OFBIZ-12169)

2021-05-04 Thread jler...@apache.org

Hi Team,

I have been working on 
https://checkstyle.sourceforge.io/config_whitespace.html#MethodParamPad

I could fix few issues in code. But there are still some cases that can't be 
handled by changing code, notably when a casting is necessary, and not only.

I believe there is an error in checkstyle code. If you look at the URL above and the errors reported, you will see that the errors don't belong to the 
tokens to check.


We can use this solution 
https://stackoverflow.com/questions/45109089/checkstyle-can-i-change-the-should-be-on-the-previous-line-rule-of-meth#answer-45109414

But I believe we should rather discuss with checkstyle team if a report is not 
appropriate.

What do you think?

Thanks

Jacques

Le 04/05/2021 à 10:36, jler...@apache.org a écrit :

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
  new 45f50c9  Improved: Handle remaining checkstyle errors (OFBIZ-12169)
45f50c9 is described below

commit 45f50c910d64c12a2601164fbc64a4a02ef1d833
Author: Jacques Le Roux 
AuthorDate: Tue May 4 10:34:52 2021 +0200

 Improved: Handle remaining checkstyle errors (OFBIZ-12169)
 
 This handles the "'(' should be on the previous line?" rule of MethodParamPad
 
 Actually not completely, because there are still some cases that can't be

 handled by changing code, notably when a casting is necessary. I believe 
there
 is an error in checkstyle code. I'll discuss that in dev ML before sending
 checkstyle team a report.
---
  .../java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java  | 4 ++--
  .../java/org/apache/ofbiz/order/order/OrderReturnServices.java | 3 ++-
  .../java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java | 4 ++--
  build.gradle   | 2 +-
  .../common/src/main/java/org/apache/ofbiz/common/CommonEvents.java | 7 +++
  .../main/java/org/apache/ofbiz/webapp/control/ContextFilter.java   | 2 +-
  .../src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java  | 2 +-
  7 files changed, 12 insertions(+), 12 deletions(-)

diff --git 
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
index 9c956e8..7ee585a 100644
--- 
a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
+++ 
b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
@@ -457,8 +457,8 @@ public class InvoiceServices {
  Map createInvoiceItemContext = new 
HashMap<>();
  createInvoiceItemContext.put("invoiceId", invoiceId);
  createInvoiceItemContext.put("invoiceItemSeqId", 
invoiceItemSeqId);
-createInvoiceItemContext.put("invoiceItemTypeId", 
getInvoiceItemType(delegator, (orderItem.getString("orderItemTypeId")),
-(product == null ? null : product.getString("productTypeId")), 
invoiceType, "INV_FPROD_ITEM"));
+createInvoiceItemContext.put("invoiceItemTypeId", 
getInvoiceItemType(delegator, orderItem.getString("orderItemTypeId"),
+product == null ? null : product.getString("productTypeId"), 
invoiceType, "INV_FPROD_ITEM"));
  createInvoiceItemContext.put("description", 
orderItem.get("itemDescription"));
  createInvoiceItemContext.put("quantity", billingQuantity);
  createInvoiceItemContext.put("amount", billingAmount);
diff --git 
a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
 
b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
index d8b469b..17f43b2 100644
--- 
a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
+++ 
b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderReturnServices.java
@@ -1325,7 +1325,8 @@ public class OrderReturnServices {
  orderPayPrefDetails.put("orderPaymentPreference", 
orderPayPref);
  orderPayPrefDetails.put("availableTotal", 
orderPayPrefAvailableTotal);
  if (prefSplitMap.containsKey(paymentMethodTypeId)) {
-
(prefSplitMap.get(paymentMethodTypeId)).add(orderPayPrefDetails);
+List> paymentMethodTypeIds = 
prefSplitMap.get(paymentMethodTypeId);
+paymentMethodTypeIds.add(orderPayPrefDetails);
  } else {
  prefSplitMap.put(paymentMethodTypeId, 
UtilMisc.toList(orderPayPrefDetails));
  }
diff --git