mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Update and enable PMD 6.3.0 (#1107)
This commit is contained in:
committed by
Peter Johnson
parent
8eafe7f325
commit
e548a5f705
@@ -8,9 +8,10 @@
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.Manifest;
|
||||
|
||||
@@ -188,9 +189,9 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
if (propVal == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
if (propVal.equalsIgnoreCase("false")) {
|
||||
if ("false".equalsIgnoreCase(propVal)) {
|
||||
return false;
|
||||
} else if (propVal.equalsIgnoreCase("true")) {
|
||||
} else if ("true".equalsIgnoreCase(propVal)) {
|
||||
return true;
|
||||
} else {
|
||||
throw new IllegalStateException(propVal);
|
||||
@@ -218,7 +219,8 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
/**
|
||||
* Starting point for the applications.
|
||||
*/
|
||||
@SuppressWarnings("PMD.UnusedFormalParameter")
|
||||
@SuppressWarnings({"PMD.AvoidInstantiatingObjectsInLoops", "PMD.AvoidCatchingThrowable",
|
||||
"PMD.CyclomaticComplexity", "PMD.NPathComplexity"})
|
||||
public static void main(String... args) {
|
||||
if (!HAL.initialize(500, 0)) {
|
||||
throw new IllegalStateException("Failed to initialize. Terminating");
|
||||
@@ -232,7 +234,8 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
} else {
|
||||
Enumeration<URL> resources = null;
|
||||
try {
|
||||
resources = RobotBase.class.getClassLoader().getResources("META-INF/MANIFEST.MF");
|
||||
resources = Thread.currentThread()
|
||||
.getContextClassLoader().getResources("META-INF/MANIFEST.MF");
|
||||
} catch (IOException ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@@ -273,7 +276,7 @@ public abstract class RobotBase implements AutoCloseable {
|
||||
|
||||
file.createNewFile();
|
||||
|
||||
try (FileOutputStream output = new FileOutputStream(file)) {
|
||||
try (OutputStream output = Files.newOutputStream(file.toPath())) {
|
||||
output.write("Java ".getBytes());
|
||||
output.write(WPILibVersion.Version.getBytes());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user