[ 
https://issues.apache.org/jira/browse/OFBIZ-9776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16178834#comment-16178834
 ] 

Julian Leichert edited comment on OFBIZ-9776 at 9/25/17 10:39 AM:
------------------------------------------------------------------

class ScaleImage
 - multiple lines : changed "" to '' in indexOf to increase performance
 - multiple lines : added locale
 - line 204 : added if to handle return value of delete()
  


was (Author: jleichert):
class ScaleImage
 - multiple lines : changed "" to '' in indexOf to increase performance
 - multiple line : added locale
 - line 204 : added if to handle return value of delete()
  

> [FB] Package org.apache.ofbiz.product.image
> -------------------------------------------
>
>                 Key: OFBIZ-9776
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9776
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: product
>    Affects Versions: Trunk
>            Reporter: Julian Leichert
>            Priority: Minor
>         Attachments: OFBIZ-9776_org.apache.ofbiz.product.image_bugfixes.patch
>
>
> ScaleImage.java:121, DM_CONVERT_CASE
> - Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageInAllSize(Map, String, 
> String, 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.
> ScaleImage.java:137, NP_LOAD_OF_KNOWN_NULL_VALUE
> - NP: Load of known null value in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageInAllSize(Map, String, 
> String, String)
> The variable referenced at this point is known to be null due to an earlier 
> check against null. Although this is valid, it might be a mistake (perhaps 
> you intended to refer to a different variable, or perhaps the earlier check 
> to see if the variable is null should have been a check to see if it was 
> non-null).
> ScaleImage.java:141, RV_RETURN_VALUE_IGNORED
> - RV: Return value of String.substring(int, int) ignored in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageInAllSize(Map, String, 
> String, String)
> The return value of this method should be checked. One common cause of this 
> warning is to invoke a method on an immutable object, thinking that it 
> updates the object. For example, in the following code fragment,
>     String dateString = getHeaderField(name);
>     dateString.trim();
> the programmer seems to be thinking that the trim() method will update the 
> String referenced by dateString. But since Strings are immutable, the trim() 
> function returns a new String value, which is being ignored here. The code 
> should be corrected to:
>     String dateString = getHeaderField(name);
>     dateString = dateString.trim();
> ScaleImage.java:180, NP_NULL_ON_SOME_PATH
> - NP: Possible null pointer dereference of newFileLocation in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageInAllSize(Map, String, 
> String, String)
> There is a branch of statement that, if executed, guarantees that a null 
> value will be dereferenced, which would generate a NullPointerException when 
> the code is executed. Of course, the problem might be that the branch or 
> statement is infeasible and that the null pointer exception can't ever be 
> executed; deciding that is beyond the ability of FindBugs.
> ScaleImage.java:202, RV_RETURN_VALUE_IGNORED_BAD_PRACTICE
> - RV: Exceptional return value of java.io.File.delete() ignored in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageInAllSize(Map, String, 
> String, String)
> This method returns a value that is not checked. The return value should be 
> checked since it can indicate an unusual or unexpected function execution. 
> For example, the File.delete() method returns false if the file could not be 
> successfully deleted (rather than throwing an Exception). If you don't check 
> the result, you won't notice if the method invocation signals unexpected 
> behavior by returning an atypical return value.
> ScaleImage.java:301, DM_CONVERT_CASE
> - Dm: Use of non-localized String.toUpperCase() or String.toLowerCase() in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageManageInAllSize(Map, 
> String, String, String, 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.
> ScaleImage.java:308, NP_LOAD_OF_KNOWN_NULL_VALUE
> - NP: Load of known null value in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageManageInAllSize(Map, 
> String, String, String, String)
> The variable referenced at this point is known to be null due to an earlier 
> check against null. Although this is valid, it might be a mistake (perhaps 
> you intended to refer to a different variable, or perhaps the earlier check 
> to see if the variable is null should have been a check to see if it was 
> non-null).
> ScaleImage.java:360, NP_NULL_ON_SOME_PATH
> - NP: Possible null pointer dereference of newFileLocation in 
> org.apache.ofbiz.product.image.ScaleImage.scaleImageManageInAllSize(Map, 
> String, String, String, String)
> There is a branch of statement that, if executed, guarantees that a null 
> value will be dereferenced, which would generate a NullPointerException when 
> the code is executed. Of course, the problem might be that the branch or 
> statement is infeasible and that the null pointer exception can't ever be 
> executed; deciding that is beyond the ability of FindBugs. 



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to