I am using the Checkmarx security tool to scan my code. I am getting:
Improper Access Control Authorization
on read/write method while writing data to output stream from file.
private ByteArrayOutputStream createToByteArray(String fileName) throws IOException {
byte[] buf = new byte[1024];
try (InputStream is = Files.newInputStream(Paths.get(fileName))) {
int len = is.read(buf);
ByteArrayOutputStream os = new ByteArrayOutputStream();
while (len != -1) {
os.write(buf, 0, len);
len = is.read(buf);
}
return os;
}
}