Author: jleroux
Date: Sat Sep 17 16:51:38 2011
New Revision: 1172015
URL: http://svn.apache.org/viewvc?rev=1172015&view=rev
Log:
A patch from Dimitri Unruh "Some dead variable assignments "
https://issues.apache.org/jira/browse/OFBIZ-4426
Some value assignments to local variables without reading or using it.
jleroux: indeed I don't see any reasons to set the size of a byte array before
feeding it with String.getBytes(), since NPE is handled above. I have even
simplified it more using function composition style.
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Base64.java
ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java?rev=1172015&r1=1172014&r2=1172015&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
(original)
+++
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
Sat Sep 17 16:51:38 2011
@@ -2377,7 +2377,6 @@ public class InvoiceServices {
if (amountApplied != null) {
context.put("amountApplied", amountApplied);
} else {
- amountApplied = ZERO;
context.put("amountApplied", ZERO);
}
Modified:
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java?rev=1172015&r1=1172014&r2=1172015&view=diff
==============================================================================
---
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
(original)
+++
ofbiz/trunk/applications/accounting/src/org/ofbiz/accounting/thirdparty/valuelink/ValueLinkServices.java
Sat Sep 17 16:51:38 2011
@@ -95,7 +95,7 @@ public class ValueLinkServices {
byte[] testBytes = StringUtil.fromHexString(testString);
// place holder
- byte[] testEncryption = new byte[0];
+ byte[] testEncryption = null;
String desc = "";
if (mode.intValue() == 1) {
Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Base64.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Base64.java?rev=1172015&r1=1172014&r2=1172015&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Base64.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/Base64.java Sat Sep 17
16:51:38 2011
@@ -150,13 +150,9 @@ public class Base64 {
* @return the decoded str.
*/
public final static String base64Decode(String str) {
- if (str == null) {
- return null;
- }
-
- byte data[] = new byte[str.length()];
- data = str.getBytes();
- return new String(base64Decode(data));
+ if (str == null) return null;
+
+ return new String(base64Decode(str.getBytes()));
}
/**
Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java?rev=1172015&r1=1172014&r2=1172015&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java
(original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonEvents.java Sat Sep
17 16:51:38 2011
@@ -297,7 +297,6 @@ public class CommonEvents {
JSONObject uiLabelObject = null;
if (UtilValidate.isNotEmpty(requiredLabels)) {
- uiLabelObject = new JSONObject();
// Transform JSON String to Object
uiLabelObject = (JSONObject) JSONSerializer.toJSON(requiredLabels);
}
@@ -336,7 +335,6 @@ public class CommonEvents {
JSONObject uiLabelObject = null;
if (UtilValidate.isNotEmpty(requiredLabels)) {
- uiLabelObject = new JSONObject();
// Transform JSON String to Object
uiLabelObject = (JSONObject) JSONSerializer.toJSON(requiredLabels);
}