Author: deepak
Date: Tue May 16 17:16:05 2017
New Revision: 1795341
URL: http://svn.apache.org/viewvc?rev=1795341&view=rev
Log:
Improved: Inconsistent String Comparisons, Applied application groovy patch
from jira issue. (OFBIZ-9254)
I found an inconsistency in the code for string comparison
statusId.equals("PRUN_COMPLETED") whereas it should be written as
"PRUN_COMPLETED".equals(statusId) cause the former can throw
NullPointerException if the variable found to be NULL.
Thanks Devanshu Vyas for your contribution.
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/BillSettings.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/OrderView.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/product/EditProductContent.groovy
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/accounting/groovyScripts/order/BillingAccountOrders.groovy
Tue May 16 17:16:05 2017
@@ -25,7 +25,7 @@ if (billingAccountId) {
orderId = orderHeader.orderId
orderBillingAcc =
from("OrderHeaderAndPaymentPref").where("orderId", orderId).queryFirst()
orderBillingAccMap = [:]
- if (orderBillingAcc.paymentMethodTypeId.equals("EXT_BILLACT") &&
orderBillingAcc.paymentStatusId.equals("PAYMENT_NOT_RECEIVED")) {
+ if ("EXT_BILLACT".equals(orderBillingAcc.paymentMethodTypeId) &&
"PAYMENT_NOT_RECEIVED".equals(orderBillingAcc.paymentStatusId)) {
orderBillingAccMap.putAll(orderBillingAcc)
orderId = orderBillingAcc.orderId
orderBillingAccMap.orderId = orderId
Modified:
ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/manufacturing/groovyScripts/jobshopmgt/ProductionRunDeclaration.groovy
Tue May 16 17:16:05 2017
@@ -97,7 +97,7 @@ if (productionRunId) {
//---------------
// routingTask update sub-screen
routingTaskId = parameters.routingTaskId
- if (routingTaskId && (actionForm.equals("UpdateRoutingTask") ||
actionForm.equals("EditRoutingTask"))) {
+ if (routingTaskId && ("UpdateRoutingTask".equals(actionForm) ||
"EditRoutingTask".equals(actionForm))) {
routingTask = from("WorkEffort").where("workEffortId",
routingTaskId).queryOne()
Map routingTaskData = routingTask.getAllFields()
routingTaskData.estimatedSetupMillis =
routingTask.getDouble("estimatedSetupMillis")
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/AdditionalPartyListing.groovy
Tue May 16 17:16:05 2017
@@ -35,7 +35,7 @@ additionalPartyRole.each { roleTypeId, p
partyMap = [:]
partyMap.partyId = partyId
party = from("Party").where("partyId", partyId).cache(true).queryOne()
- if (party.partyTypeId.equals("PERSON")) {
+ if ("PERSON".equals(party.partyTypeId)) {
party = party.getRelatedOne("Person", true)
partyMap.type = "person"
partyMap.firstName = party.firstName
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/BillSettings.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/BillSettings.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/BillSettings.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/BillSettings.groovy
Tue May 16 17:16:05 2017
@@ -40,7 +40,7 @@ if (newPaymentMethodId) {
context.checkOutPaymentId = newPaymentMethodId
}
-if (orderPartyId && !orderPartyId.equals("_NA_")) {
+if (orderPartyId && !"_NA_".equals(orderPartyId)) {
orderParty = from("Party").where("partyId", orderPartyId).queryOne()
orderPerson = orderParty.getRelatedOne("Person", false)
context.orderParty = orderParty
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/entry/SetCheckOutTabBar.groovy
Tue May 16 17:16:05 2017
@@ -51,7 +51,7 @@ isLastStep = "N"
enabled = "Y"
checkoutSteps.eachWithIndex { checkoutStep, i ->
checkoutStep.put("enabled", enabled)
- if (enabled.equals("Y")) {
+ if ("Y".equals(enabled)) {
if (i == (checkoutSteps.size() - 1)) {
isLastStep = "Y"
}
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/CompanyHeader.groovy
Tue May 16 17:16:05 2017
@@ -88,7 +88,7 @@ if (orderHeader) {
partyId = orh.getBillFromParty().partyId
} else {
productStore = orderHeader.getRelatedOne("ProductStore", false)
- if (orderHeader.orderTypeId.equals("SALES_ORDER") &&
productStore?.payToPartyId) {
+ if ("SALES_ORDER".equals(orderHeader.orderTypeId) &&
productStore?.payToPartyId) {
partyId = productStore.payToPartyId
}
}
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/OrderView.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/OrderView.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/OrderView.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/order/OrderView.groovy
Tue May 16 17:16:05 2017
@@ -294,13 +294,13 @@ if (orderHeader) {
supplierContactMechValueMaps.each { supplierContactMechValueMap ->
contactMechPurposes =
supplierContactMechValueMap.partyContactMechPurposes
contactMechPurposes.each { contactMechPurpose ->
- if
(contactMechPurpose.contactMechPurposeTypeId.equals("GENERAL_LOCATION")) {
+ if
("GENERAL_LOCATION".equals(contactMechPurpose.contactMechPurposeTypeId)) {
context.supplierGeneralContactMechValueMap =
supplierContactMechValueMap
- } else if
(contactMechPurpose.contactMechPurposeTypeId.equals("SHIPPING_LOCATION")) {
+ } else if
("SHIPPING_LOCATION".equals(contactMechPurpose.contactMechPurposeTypeId)) {
context.supplierShippingContactMechValueMap =
supplierContactMechValueMap
- } else if
(contactMechPurpose.contactMechPurposeTypeId.equals("BILLING_LOCATION")) {
+ } else if
("BILLING_LOCATION".equals(contactMechPurpose.contactMechPurposeTypeId)) {
context.supplierBillingContactMechValueMap =
supplierContactMechValueMap
- } else if
(contactMechPurpose.contactMechPurposeTypeId.equals("PAYMENT_LOCATION")) {
+ } else if
("PAYMENT_LOCATION".equals(contactMechPurpose.contactMechPurposeTypeId)) {
context.supplierPaymentContactMechValueMap =
supplierContactMechValueMap
}
}
@@ -493,7 +493,7 @@ if (workEffortId && assignPartyId && ass
workEffortStatus = workEffort.currentStatusId
if (workEffortStatus) {
context.workEffortStatus = workEffortStatus
- if (workEffortStatus.equals("WF_RUNNING") ||
workEffortStatus.equals("WF_SUSPENDED"))
+ if ("WF_RUNNING".equals(workEffortStatus) ||
"WF_SUSPENDED".equals(workEffortStatus))
context.inProcess = true
}
@@ -550,7 +550,7 @@ if (shipments) {
// get orderAdjustmentId for SHIPPING_CHARGES
orderAdjustmentId = null
orderAdjustments.each { orderAdjustment ->
- if(orderAdjustment.orderAdjustmentTypeId.equals("SHIPPING_CHARGES")) {
+ if("SHIPPING_CHARGES".equals(orderAdjustment.orderAdjustmentTypeId)) {
orderAdjustmentId = orderAdjustment.orderAdjustmentId
}
}
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/reports/OpenOrderItemsReport.groovy
Tue May 16 17:16:05 2017
@@ -104,11 +104,11 @@ listIt.each { listValue ->
listPrice = 0.0
productPrices.each { productPriceMap ->
- if (productPriceMap.productPriceTypeId.equals("AVERAGE_COST")) {
+ if ("AVERAGE_COST".equals(productPriceMap.productPriceTypeId)) {
costPrice = productPriceMap.price
- } else if (productPriceMap.productPriceTypeId.equals("DEFAULT_PRICE"))
{
+ } else if ("DEFAULT_PRICE".equals(productPriceMap.productPriceTypeId))
{
retailPrice = productPriceMap.price
- } else if (productPriceMap.productPriceTypeId.equals("LIST_PRICE")) {
+ } else if ("LIST_PRICE".equals(productPriceMap.productPriceTypeId)) {
listPrice = productPriceMap.price
}
}
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/request/RequestItemNotes.groovy
Tue May 16 17:16:05 2017
@@ -26,7 +26,7 @@ showAll = parameters.showAll ?: "false"
context.showAll = showAll
fields = [custRequestId : custRequestId]
-if (showAll.equals("false")) {
+if ("false".equals(showAll)) {
fields.custRequestItemSeqId = custRequestItemSeqId
}
notes =
from("CustRequestItemNoteView").where(fields).orderBy("-noteDateTime").queryList()
Modified:
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/order/groovyScripts/task/OrderTaskList.groovy
Tue May 16 17:16:05 2017
@@ -29,10 +29,10 @@ context.userLogin = userLogin
sort = parameters.sort
sortOrder = ["currentStatusId", "-priority", "orderDate"]
if (sort) {
- if (sort.equals("name")) {
+ if ("name".equals(sort)) {
sortOrder.add(0, "firstName")
sortOrder.add(0, "lastName")
- } else if (sort.equals("grandTotal")) {
+ } else if ("grandTotal".equals(sort)) {
sortOrder.add(0, "-grandTotal")
} else {
sortOrder.add(0, sort)
@@ -60,7 +60,7 @@ partyRoles = from("PartyRole").where("pa
// build the role list
pRolesList = []
partyRoles.each { partyRole ->
- if (!partyRole.roleTypeId.equals("_NA_"))
+ if (!"_NA_".equals(partyRole.roleTypeId))
pRolesList.add(EntityCondition.makeCondition("roleTypeId",
EntityOperator.EQUALS, partyRole.roleTypeId))
}
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/CheckRejected.groovy
Tue May 16 17:16:05 2017
@@ -28,7 +28,7 @@ if (rowCount > 1) {
if(paramMap.get("checkStatusId" +thisSuffix)){
def temp = paramMap.get("checkStatusId" +thisSuffix)
def splitTemp = temp.split("/")
- if(splitTemp[0].equals("IM_REJECTED")){
+ if("IM_REJECTED".equals(splitTemp[0])){
rejected = true
}
}
@@ -37,7 +37,7 @@ if (rowCount > 1) {
else {
def temp = paramMap.get("checkStatusId_o_0")
def splitTemp = temp.split("/")
- if(splitTemp[0].equals("IM_REJECTED")){
+ if("IM_REJECTED".equals(splitTemp[0])){
rejected = true
}
}
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/ImageUpload.groovy
Tue May 16 17:16:05 2017
@@ -129,11 +129,11 @@ if (fileType) {
product.set(fileType + "ImageUrl", imageUrl)
// call scaleImageInAllSize
- if (fileType.equals("original")) {
+ if ("original".equals(fileType)) {
context.delegator = delegator
result = ScaleImage.scaleImageInAllSize(context,
filenameToUse, "main", "0")
- if (result.containsKey("responseMessage") &&
result.get("responseMessage").equals("success")) {
+ if (result.containsKey("responseMessage") &&
"success".equals(result.get("responseMessage"))) {
imgMap = result.get("imageUrlMap")
imgMap.each() { key, value ->
product.set(key + "ImageUrl", value)
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/imagemanagement/SetDefaultImage.groovy
Tue May 16 17:16:05 2017
@@ -167,11 +167,11 @@ if (fileType) {
product.set(fileType + "ImageUrl", imageUrl)
// call scaleImageInAllSize
- if (fileType.equals("original")) {
+ if ("original".equals(fileType)) {
context.delegator = delegator
result = ScaleImage.scaleImageInAllSize(context,
filenameToUse, "main", "0")
- if (result.containsKey("responseMessage") &&
result.get("responseMessage").equals("success")) {
+ if (result.containsKey("responseMessage") &&
"success".equals(result.get("responseMessage"))) {
imgMap = result.get("imageUrlMap")
imgMap.each() { key, value ->
product.set(key + "ImageUrl", value)
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/product/EditProductContent.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/product/EditProductContent.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/product/EditProductContent.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/catalog/product/EditProductContent.groovy
Tue May 16 17:16:05 2017
@@ -120,9 +120,9 @@ if (fileType) {
if (!filenameToUse.startsWith(productId + ".")) {
File[] files = targetDir.listFiles()
for(File file : files) {
- if (file.isFile() &&
file.getName().contains(filenameToUse.substring(0,
filenameToUse.indexOf(".")+1)) && !fileType.equals("original")) {
+ if (file.isFile() &&
file.getName().contains(filenameToUse.substring(0,
filenameToUse.indexOf(".")+1)) && !"original".equals(fileType)) {
file.delete()
- } else if(file.isFile() && fileType.equals("original")
&& !file.getName().equals(defaultFileName)) {
+ } else if(file.isFile() && "original".equals(fileType)
&& !file.getName().equals(defaultFileName)) {
file.delete()
}
}
@@ -146,11 +146,11 @@ if (fileType) {
product.set(fileType + "ImageUrl", imageUrl)
// call scaleImageInAllSize
- if (fileType.equals("original")) {
+ if ("original".equals(fileType)) {
context.delegator = delegator
result = ScaleImage.scaleImageInAllSize(context,
filenameToUse, "main", "0")
- if (result.containsKey("responseMessage") &&
result.get("responseMessage").equals("success")) {
+ if (result.containsKey("responseMessage") &&
"success".equals(result.get("responseMessage"))) {
imgMap = result.get("imageUrlMap")
imgMap.each() { key, value ->
product.set(key + "ImageUrl", value)
Modified:
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy?rev=1795341&r1=1795340&r2=1795341&view=diff
==============================================================================
---
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
(original)
+++
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
Tue May 16 17:16:05 2017
@@ -92,7 +92,7 @@ if (purchaseOrder && !shipmentId) {
}
shipment = null
-if (shipmentId && !shipmentId.equals("_NA_")) {
+if (shipmentId && !"_NA_".equals(shipmentId)) {
shipment = from("Shipment").where("shipmentId", shipmentId).queryOne()
}