Skip to content

Find Bugs Fixes #7

@tenaciousRas

Description

@tenaciousRas

This is from a find bugs report contributed by D. Borza:

  1. com.longevitysoft.android.xml.plist.domain.Data
    line 73:
    public java.lang.String getValue(boolean decode) {
    dataStringer.newBuilder();
    if (decode) {
    return dataStringer.getBuilder()
    .append(new java.lang.String(Base64.
    decodeFast(rawData)))
    .toString();
    } else {
    -> return dataStringer.getBuilder().append(rawData).toString();
    }
    }

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.

  1. class: com.longevitysoft.android.xml.plist.domain.Array
    line 252:
    public boolean equals(Object that) {
    -> return data.equals(that);
    }

This class overrides equals(Object), but does not override hashCode(), and inherits the implementation of hashCode() from java.lang.Object (which returns the identity hash code, an arbitrary value assigned to the object by the VM). Therefore, the class is very likely to violate the invariant that equal objects must have equal hashcodes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions