[java] ArrayIsStoredDirectly: False positive
A source code analyzer
Brought to you by:
adangel,
juansotuyo
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); } }
This will be fixed with PMD 5.3.7, 5.4.2 and 5.5.0.
Commit: https://github.com/pmd/pmd/commit/b9b0059797875a25c8caadffba0fcd2f6bf1f1c2