Details

    • Type: Sub-task
    • Status: Closed
    • Priority: Minor
    • Resolution: Implemented
    • Affects Version/s: Trunk
    • Fix Version/s: Upcoming Release
    • Component/s: base
    • Labels:
      None

      Description

      • 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.

        Activity

        Hide
        Dennis Balkir Dennis Balkir added a comment -
        • 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
        Show
        Dennis Balkir Dennis Balkir added a comment - 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
        Hide
        mbrohl Michael Brohl added a comment -

        Thanks Dennis,

        your patch is in trunk r1811415.

        Show
        mbrohl Michael Brohl added a comment - Thanks Dennis, your patch is in trunk r1811415.

          People

          • Assignee:
            mbrohl Michael Brohl
            Reporter:
            Dennis Balkir Dennis Balkir
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development