Author: mbrohl
Date: Tue Dec 12 16:18:42 2017
New Revision: 1817926
URL:
http://svn.apache.org/viewvc?rev=1817926&view=revLog:
Improved: Fixing defects reported by FindBugs, package
org.apache.ofbiz.accounting.thirdparty.worldpay.
(OFBIZ-9548)
Thanks Kyra Pritzel-Hentley for reporting and providing the patch.
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java?rev=1817926&r1=1817925&r2=1817926&view=diff==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/worldpay/WorldPayEvents.java Tue Dec 12 16:18:42 2017
@@ -48,6 +48,7 @@ import org.apache.ofbiz.product.store.Pr
import org.apache.ofbiz.service.GenericServiceException;
import org.apache.ofbiz.service.LocalDispatcher;
import org.apache.ofbiz.service.ModelService;
+import org.apache.ofbiz.service.ServiceUtil;
/**
* WorldPay Select Junior Integration Events/Services
@@ -249,7 +250,7 @@ public class WorldPayEvents {
}
}
// create the redirect string
- Map<String, Object> parameters = new HashMap<String, Object>();
+ Map<String, Object> parameters = new HashMap<>();
parameters.put("instId", instId);
parameters.put("cartId", orderId);
parameters.put("currency", defCur);
@@ -424,11 +425,11 @@ public class WorldPayEvents {
Locale locale = UtilHttp.getLocale(request);
String paymentStatus = request.getParameter("transStatus");
String paymentAmount = request.getParameter("authAmount");
- Long paymentDate = new Long(request.getParameter("transTime"));
+ Long paymentDate = Long.valueOf(request.getParameter("transTime"));
String transactionId = request.getParameter("transId");
String gatewayFlag = request.getParameter("rawAuthCode");
String avs = request.getParameter("AVS");
- List<GenericValue> toStore = new LinkedList<GenericValue>();
+ List<GenericValue> toStore = new LinkedList<>();
java.sql.Timestamp authDate = null;
try {
authDate = new java.sql.Timestamp(paymentDate.longValue());
@@ -481,7 +482,8 @@ public class WorldPayEvents {
request.setAttribute("_ERROR_MESSAGE_", UtilProperties.getMessage(resourceErr, "worldPayEvents.failedToExecuteServiceCreatePaymentFromPreference", locale));
return false;
}
- if ((results == null) || (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR))) {
+
+ if (ServiceUtil.isError(results)) {
Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module);
request.setAttribute("_ERROR_MESSAGE_", (String) results.get(ModelService.ERROR_MESSAGE));
return false;