I did come across the following 2 posts about a similar issue
Sonar Violation and
Sonar Violation
But, my problem is with byte[]
Following is the code snippet for which I get this warning in Sonar
public void setValue(byte[] value) {
this.value = value;
}
I looked at the solutions and made the following changes
public void setValue(byte[] value) {
if(value == null) {
this.value = new byte[0];
} else {
this.value= Arrays.copyOf(value, value.length);
}
}
Even then, I get the same Security violation warning in Sonar.
Am I getting this warning because it is byte[]
and byte arrays need to be handled differently?