From b3ec30802de3fbd8a315be0eff09b5a39051de7d Mon Sep 17 00:00:00 2001 From: dev-mlb <19797865+dev-mlb@users.noreply.github.com> Date: Fri, 4 Oct 2024 10:34:29 -0400 Subject: [PATCH] errorprone :: ignore warnings in Executrix and UnixCmdPlace (#962) --- src/main/java/emissary/place/UnixCommandPlace.java | 3 +++ src/main/java/emissary/util/shell/Executrix.java | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/main/java/emissary/place/UnixCommandPlace.java b/src/main/java/emissary/place/UnixCommandPlace.java index 1c1b9b8e77..c1ec61f1f3 100755 --- a/src/main/java/emissary/place/UnixCommandPlace.java +++ b/src/main/java/emissary/place/UnixCommandPlace.java @@ -176,6 +176,7 @@ protected void logMessages(String tempDir) { * Run the file process */ @Nullable + @SuppressWarnings("AvoidObjectArrays") public byte[] fileProcess(String[] cmd, String outputFile) { logger.debug("fileProcess({})", Arrays.asList(cmd)); StringBuilder errbuf = new StringBuilder(); @@ -195,6 +196,7 @@ public byte[] fileProcess(String[] cmd, String outputFile) { * @return bytes of output from command execution */ @Nullable + @SuppressWarnings("AvoidObjectArrays") public byte[] stdOutProcess(String[] cmd, boolean chop) { logger.debug("stdOutProcess({},{}) with charset {}", Arrays.asList(cmd), chop, charset); StringBuilder outbuf = new StringBuilder(); @@ -274,6 +276,7 @@ protected void unSynchronizedProcess(IBaseDataObject theDataObject) throws Resou * @param data the bytes to run the command on * @return byte array of output */ + @SuppressWarnings("CatchingUnchecked") protected byte[] runCommandOn(byte[] data) throws ResourceException { String[] names = executrix.makeTempFilenames(); String tempDirName = names[Executrix.DIR]; diff --git a/src/main/java/emissary/util/shell/Executrix.java b/src/main/java/emissary/util/shell/Executrix.java index 3f740923db..a62562f1c1 100755 --- a/src/main/java/emissary/util/shell/Executrix.java +++ b/src/main/java/emissary/util/shell/Executrix.java @@ -37,6 +37,7 @@ /** * This class wraps up things related to exec-ing of external processes and reading and writing disk files. */ +@SuppressWarnings("AvoidObjectArrays") public class Executrix { private static final Logger logger = LoggerFactory.getLogger(Executrix.class); @@ -1248,6 +1249,7 @@ public static boolean cleanupDirectory(final String dir) { * @param dir the directory to remove * @return true if it works, false otherwise */ + @SuppressWarnings("CatchingUnchecked") public static boolean cleanupDirectory(final File dir) { if (!dir.exists()) { return true; @@ -1363,6 +1365,7 @@ public ProcessBuilder getProcessBuilder() { } + @SuppressWarnings("MethodCanBeStatic") public ProcessReader getStdOutProcessReader(Process p) { return new ReadOutputLogger("stdOut", p.getInputStream()); }