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 bf26955 Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
bf26955 is described below
commit bf269556a4615d2641767b75551e202cbe55a9f4
Author: Jacques Le Roux <[email protected]>
AuthorDate: Thu Dec 9 11:55:40 2021 +0100
Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
In UspsServices::uspsPriorityMailInternationalLabel better complete fixes
for
product possible null dereferencements
---
.../shipment/thirdparty/usps/UspsServices.java | 26 +++++++++++-----------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git
a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
index 2bcb5b2..6dac81b 100644
---
a/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
+++
b/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/usps/UspsServices.java
@@ -1642,19 +1642,19 @@ public class UspsServices {
if (product != null) {
UtilXml.addChildElementValue(itemDetail, "Description",
product.getString("productName"), packageDocument);
- }
- UtilXml.addChildElementValue(itemDetail, "Quantity",
shipmentPackageContent.getBigDecimal("quantity")
- .setScale(0, RoundingMode.CEILING).toPlainString(),
packageDocument);
- String packageContentValue =
ShipmentWorker.getShipmentPackageContentValue(shipmentPackageContent).setScale(2,
- RoundingMode.HALF_UP).toPlainString();
- UtilXml.addChildElementValue(itemDetail, "Value",
packageContentValue, packageDocument);
- BigDecimal productWeight =
ProductWorker.getProductWeight(product, "WT_lbs", delegator, dispatcher);
- Integer[] productPoundsOunces =
convertPoundsToPoundsOunces(productWeight);
- UtilXml.addChildElementValue(itemDetail, "NetPounds",
productPoundsOunces[0].toString(), packageDocument);
- UtilXml.addChildElementValue(itemDetail, "NetOunces",
productPoundsOunces[1].toString(), packageDocument);
- UtilXml.addChildElementValue(itemDetail, "HSTariffNumber", "",
packageDocument);
- if (originGeo != null) {
- UtilXml.addChildElementValue(itemDetail,
"CountryOfOrigin", originGeo.getString("geoName"), packageDocument);
+ UtilXml.addChildElementValue(itemDetail, "Quantity",
shipmentPackageContent.getBigDecimal("quantity")
+ .setScale(0,
RoundingMode.CEILING).toPlainString(), packageDocument);
+ String packageContentValue =
ShipmentWorker.getShipmentPackageContentValue(shipmentPackageContent)
+ .setScale(2, RoundingMode.HALF_UP).toPlainString();
+ UtilXml.addChildElementValue(itemDetail, "Value",
packageContentValue, packageDocument);
+ BigDecimal productWeight =
ProductWorker.getProductWeight(product, "WT_lbs", delegator, dispatcher);
+ Integer[] productPoundsOunces =
convertPoundsToPoundsOunces(productWeight);
+ UtilXml.addChildElementValue(itemDetail, "NetPounds",
productPoundsOunces[0].toString(), packageDocument);
+ UtilXml.addChildElementValue(itemDetail, "NetOunces",
productPoundsOunces[1].toString(), packageDocument);
+ UtilXml.addChildElementValue(itemDetail, "HSTariffNumber",
"", packageDocument);
+ if (originGeo != null) {
+ UtilXml.addChildElementValue(itemDetail,
"CountryOfOrigin", originGeo.getString("geoName"), packageDocument);
+ }
}
}