#1476 [java] ArrayIsStoredDirectly: False positive

PMD-5.3.7
closed
java (55)
PMD
3-Major
Bug
5.4.1
ArrayIsStoredDirectly
2016-06-25
2016-04-28
No

I have a constructor which creates a string from the specified byte array. It is considered as a violation by ArrayIsStoredDirectly.

public NotificationPacket(byte id, byte[] rawTypeData)
{
    super(id);

    if (rawTypeData == null)
    {
        throw new IllegalArgumentException("No type data is specified");
    }

    if (rawTypeData.length == 0)
    {
        this.message = EMPTY_MESSAGE;
    }
    else
    {
        this.message = new String(rawTypeData, StandardCharsets.UTF_8);
    }
}

Discussion

  • Andreas Dangel

    Andreas Dangel - 2016-04-30
    • status: open --> closed
    • assigned_to: Andreas Dangel
    • Milestone: New Tickets --> PMD-5.3.7
     
  • Andreas Dangel

    Andreas Dangel - 2016-06-25
    • labels: --> java
    • summary: False positive of ArrayIsStoredDirectly --> [java] ArrayIsStoredDirectly: False positive
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks