Details
-
Sub-task
-
Status: Closed
-
Minor
-
Resolution: Implemented
-
Trunk
-
None
Description
ValueLinkApi.java:159, DM_DEFAULT_ENCODING
- Dm: Found reliance on default encoding in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.encryptPin(String): String.getBytes()
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.
ValueLinkApi.java:212, DM_DEFAULT_ENCODING
- Dm: Found reliance on default encoding in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.decryptPin(String): new String(byte[])
Found a call to a method which will perform a byte to String (or String to byte) conversion, and will assume that the default platform encoding is suitable. This will cause the application behaviour to vary between platforms. Use an alternative API and specify a charset name or Charset object explicitly.
ValueLinkApi.java:531, PZLA_PREFER_ZERO_LENGTH_ARRAYS
- PZLA: Should org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.generateMwk() return a zero length array rather than null?
It is often a better design to return a length zero array rather than a null reference to indicate that there are no results (i.e., an empty list of results). This way, no explicit check for null is needed by clients of the method.
On the other hand, using null to indicate "there is no answer to this question" is probably appropriate. For example, File.listFiles() returns an empty list if given a directory containing no files, and returns null if the file is not a directory.
ValueLinkApi.java:566, PZLA_PREFER_ZERO_LENGTH_ARRAYS
- PZLA: Should org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.generateMwk(byte[]) return a zero length array rather than null?
It is often a better design to return a length zero array rather than a null reference to indicate that there are no results (i.e., an empty list of results). This way, no explicit check for null is needed by clients of the method.
On the other hand, using null to indicate "there is no answer to this question" is probably appropriate. For example, File.listFiles() returns an empty list if given a directory containing no files, and returns null if the file is not a directory.
ValueLinkApi.java:647, DC_DOUBLECHECK
- DC: Possible doublecheck on org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.mwkIndex in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.getWorkingKeyIndex()
This method may contain an instance of double-checked locking. This idiom is not correct according to the semantics of the Java memory model. For more information, see the web page http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html.
ValueLinkApi.java:910, DM_CONVERT_CASE
- Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.parseResponse(String)
A String is being converted to upper or lowercase, using the platform's default encoding. This may result in improper conversions when used with international characters. Use the
String.toUpperCase( Locale l )
String.toLowerCase( Locale l )
versions instead.
ValueLinkApi.java:967, DM_CONVERT_CASE
- Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkApi.parseHistoryResponse(String)
A String is being converted to upper or lowercase, using the platform's default encoding. This may result in improper conversions when used with international characters. Use the
String.toUpperCase( Locale l )
String.toLowerCase( Locale l )
versions instead.
ValueLinkServices.java:171, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.assignWorkingKey(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:255, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.activate(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:314, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.linkPhysicalCard(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:377, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.disablePin(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:445, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.redeem(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:515, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.reload(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:576, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.balanceInquire(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:633, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.transactionHistory(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:701, RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE
- RCN: Redundant nullcheck of response, which is known to be non-null in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.refund(DispatchContext, Map)
This method contains a redundant check of a known non-null value against the constant null.
ValueLinkServices.java:1202, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
- RCN: Nullcheck of activateResult at line 1202 of value previously dereferenced in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.giftCardPurchase(DispatchContext, Map)
A value is checked here to see whether it is null, but this value can't be null because it was previously dereferenced and if it were null a null pointer exception would have occurred at the earlier dereference. Essentially, this code and the previous dereference disagree as to whether this value is allowed to be null. Either the check is redundant or the previous dereference is erroneous.
ValueLinkServices.java:1451, RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE
- RCN: Nullcheck of reloadResult at line 1451 of value previously dereferenced in org.apache.ofbiz.accounting.thirdparty.valuelink.ValueLinkServices.giftCardReload(DispatchContext, Map)
A value is checked here to see whether it is null, but this value can't be null because it was previously dereferenced and if it were null a null pointer exception would have occurred at the earlier dereference. Essentially, this code and the previous dereference disagree as to whether this value is allowed to be null. Either the check is redundant or the previous dereference is erroneous.