mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
@@ -100,7 +100,11 @@ public final class CombinedRuntimeLoader {
|
||||
if (outputFile.toFile().exists()) {
|
||||
continue;
|
||||
}
|
||||
outputFile.getParent().toFile().mkdirs();
|
||||
var parent = outputFile.getParent();
|
||||
if (parent == null) {
|
||||
throw new IOException("Output file has no parent");
|
||||
}
|
||||
parent.toFile().mkdirs();
|
||||
|
||||
try (var os = Files.newOutputStream(outputFile)) {
|
||||
int readBytes;
|
||||
|
||||
@@ -135,6 +135,9 @@ public final class RuntimeDetector {
|
||||
public static boolean isRaspbian() {
|
||||
try (BufferedReader reader = Files.newBufferedReader(Paths.get("/etc/os-release"))) {
|
||||
String value = reader.readLine();
|
||||
if (value == null) {
|
||||
return false;
|
||||
}
|
||||
return value.contains("Raspbian");
|
||||
} catch (IOException ex) {
|
||||
return false;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user