[ 
https://issues.apache.org/jira/browse/OFBIZ-9575?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dennis Balkir updated OFBIZ-9575:
---------------------------------
    Attachment: OFBIZ-9575_org.apache.ofbiz.base.util.cache_bugfixes.patch

- fixed Diamond Operators

class CacheSoftReference:
- didn't fix first bug: why is this class implementing Serializable at all? I 
didn't get it :(
- set method {{finalize}} to {{protected}}

class UtilCache:
- deleted unnecessary else blocks
- added {{Arrays.toString()}} to prevent the reading of the Array {{propNames}} 
from returning random text
- didn't fix Line 108 & 110, not really possible to fix there, hopefully 
intended as it is
- circular dependency not found, maybe there is none..?
- moved nullcheck in {{findSizeInBytes}} in front of the try-block, therefore 
no possible null inside of the try-block

> [FB] Package org.apache.ofbiz.base.util.cache
> ---------------------------------------------
>
>                 Key: OFBIZ-9575
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9575
>             Project: OFBiz
>          Issue Type: Sub-task
>          Components: base
>    Affects Versions: Trunk
>            Reporter: Dennis Balkir
>            Priority: Minor
>         Attachments: 
> OFBIZ-9575_org.apache.ofbiz.base.util.cache_bugfixes.patch
>
>
> - CacheSoftReference.java:29, SE_NO_SUITABLE_CONSTRUCTOR
> Se: org.apache.ofbiz.base.util.cache.CacheSoftReference is Serializable but 
> its superclass doesn't define an accessible void constructor
> This class implements the Serializable interface and its superclass does not. 
> When such an object is deserialized, the fields of the superclass need to be 
> initialized by invoking the void constructor of the superclass. Since the 
> superclass does not have one, serialization and deserialization will fail at 
> runtime.
> - CacheSoftReference.java:45, FI_PUBLIC_SHOULD_BE_PROTECTED
> FI: org.apache.ofbiz.base.util.cache.CacheSoftReference.finalize() is public; 
> should be protected
> A class's finalize() method should have protected access, not public.
> - UtilCache.java:-1, SE_BAD_FIELD
> Se: Class org.apache.ofbiz.base.util.cache.UtilCache defines non-transient 
> non-serializable instance field memoryTable
> This Serializable class defines a non-primitive instance field which is 
> neither transient, Serializable, or java.lang.Object, and does not appear to 
> implement the Externalizable interface or the readObject() and writeObject() 
> methods.  Objects of this class will not be deserialized correctly if a 
> non-Serializable object is stored in this field.
> - UtilCache.java:-1, SE_BAD_FIELD
> Se: Class org.apache.ofbiz.base.util.cache.UtilCache defines non-transient 
> non-serializable instance field listeners
> This Serializable class defines a non-primitive instance field which is 
> neither transient, Serializable, or java.lang.Object, and does not appear to 
> implement the Externalizable interface or the readObject() and writeObject() 
> methods.  Objects of this class will not be deserialized correctly if a 
> non-Serializable object is stored in this field.
> - UtilCache.java:63, SE_NO_SERIALVERSIONID
> SnVI: org.apache.ofbiz.base.util.cache.UtilCache is Serializable; consider 
> declaring a serialVersionUID
> This class implements the Serializable interface, but does not define a 
> serialVersionUID field.  A change as simple as adding a reference to a .class 
> object will add synthetic fields to the class, which will unfortunately 
> change the implicit serialVersionUID (e.g., adding a reference to 
> String.class will generate a static field class$java$lang$String). Also, 
> different source code to bytecode compilers may use different naming 
> conventions for synthetic variables generated for references to class objects 
> or inner classes. To ensure interoperability of Serializable across versions, 
> consider adding an explicit serialVersionUID.
> - UtilCache.java:160, DMI_INVOKING_TOSTRING_ON_ARRAY
> USELESS_STRING: Invocation of toString on propNames in 
> org.apache.ofbiz.base.util.cache.UtilCache.getPropertyParam(ResourceBundle, 
> String[], String)
> The code invokes toString on an array, which will generate a fairly useless 
> result such as [C@16f0472. Consider using Arrays.toString to convert the 
> array into a readable String that gives the contents of the array. See 
> Programming Puzzlers, chapter 3, puzzle 12.
> - UtilCache.java:387, NP_NULL_ON_SOME_PATH_EXCEPTION
> NP: Possible null pointer dereference of o in 
> org.apache.ofbiz.base.util.cache.UtilCache.findSizeInBytes(Object) on 
> exception path
> A reference value which is null on some exception control path is 
> dereferenced here.  This may lead to a NullPointerException when the code is 
> executed.  Note that because FindBugs currently does not prune infeasible 
> exception paths, this may be a false warning.
> Also note that FindBugs considers the default case of a switch statement to 
> be an exception path, since the default case is often infeasible.



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

Reply via email to