Improved: Fix some bugs Spotbugs reports
In UspsServices::uspsPriorityMailInternationalLabel better complete fixes for
product possible null dereferencements
@@ -1642,11 +1642,10 @@ 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();
+ 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);
@@ -1657,6 +1656,7 @@ public class UspsServices {
UtilXml.addChildElementValue(itemDetail, "CountryOfOrigin", originGeo.getString("geoName"), packageDocument);
}
}
+ }
// Send the request
Document responseDocument = null;
