[build] Enable spotbugs (#3601)

Benign spotbugs warnings were suppressed, and all others were fixed. Bug
descriptions are documented here:
https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html

Co-authored-by: Austin Shalit <austinshalit@gmail.com>
This commit is contained in:
Tyler Veness
2021-09-24 16:04:02 -07:00
committed by GitHub
parent b65fce86bf
commit 95dd20a151
73 changed files with 356 additions and 558 deletions

View File

@@ -105,7 +105,13 @@ public final class RuntimeLoader<T> {
if (resIs == null) {
throw new IOException(getLoadErrorMessage(ule));
}
jniLibrary.getParentFile().mkdirs();
var parentFile = jniLibrary.getParentFile();
if (parentFile == null) {
throw new IOException("JNI library has no parent file");
}
parentFile.mkdirs();
try (OutputStream os = Files.newOutputStream(jniLibrary.toPath())) {
byte[] buffer = new byte[0xFFFF]; // 64K copy buffer
int readBytes;
@@ -171,7 +177,13 @@ public final class RuntimeLoader<T> {
if (resIs == null) {
throw new IOException(getLoadErrorMessage(ule));
}
jniLibrary.getParentFile().mkdirs();
var parentFile = jniLibrary.getParentFile();
if (parentFile == null) {
throw new IOException("JNI library has no parent file");
}
parentFile.mkdirs();
try (OutputStream os = Files.newOutputStream(jniLibrary.toPath())) {
byte[] buffer = new byte[0xFFFF]; // 64K copy buffer
int readBytes;