I have refered : Security - Array is stored directly.
My code is as
public IndexBlockAdapter(String[] itemStr) {
if(itemStr == null) {
this.itemStr = new String[0];
} else {
this.itemStr = Arrays.copyOf(itemStr, itemStr.length);
}
}
But Sonar still picks it up and complains about "Array is stored directly", despite making a copy. I am very confused.
Any help is appreciated!