Skip to content

Commit

Permalink
errorprone :: SystemOut (#963)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-mlb authored Oct 4, 2024
1 parent b3ec308 commit ce9f5e6
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/main/java/emissary/command/BaseCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ protected void setSystemProperty(String key, String value) {
* @param clazz the Class of return type class
* @param args vararg of Strings
*/
@SuppressWarnings("SystemOut")
public static <T extends EmissaryCommand> T parse(Class<T> clazz, String... args) throws EmissaryException {
T cmd;
try {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/emissary/command/HelpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public static void dumpCommands(CommandLine cl) {
LOG.info("Use 'help <command-name>' to see more detailed info about that command");
}

@SuppressWarnings("SystemOut")
public static void dumpHelp(CommandLine c, String subcommand) {
LOG.info("Detailed help for: {}", subcommand);
try {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/emissary/command/MonitorCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ private void sendClusterRequests(final EmissaryClient client, final T entity) th
}

// Here as a hook in case commands have summarize/custom display options
@SuppressWarnings("SystemOut")
protected void displayEntityResults(T entity) {
entity.dumpToConsole();
for (String error : entity.getErrors()) {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/emissary/command/PeersCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public String getCommandName() {
}

@Override
@SuppressWarnings("SystemOut")
public void run(CommandLine c) {
setup();
try {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/emissary/config/ExtractResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static void main(final String[] args) {
try {
ex.writeResource(args[i]);
} catch (IOException iox) {
System.err.println(args[i] + ": " + iox);
logger.error("{}: {}", args[i], iox.toString());
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions src/main/java/emissary/util/DependencyCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import emissary.config.Configurator;
import emissary.util.shell.Executrix;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.io.IOException;
import java.util.Set;
Expand All @@ -13,6 +16,8 @@
*/
public class DependencyCheck {

private static final Logger logger = LoggerFactory.getLogger(DependencyCheck.class);

Configurator config;

public static final String REQUIRED_EXECUTABLE = "REQUIRED_EXECUTABLE";
Expand Down Expand Up @@ -97,27 +102,27 @@ public void printDependencyReport() {

for (String reqExe : reqExeSet) {
boolean exists = DependencyCheck.executableExists(reqExe);
System.out.println("RequiredExecutable: " + reqExe + " exists: " + exists);
logger.info("RequiredExecutable: {} exists: {}", reqExe, exists);
}
for (String reqDir : reqDirSet) {
boolean exists = DependencyCheck.directoryExists(reqDir);
System.out.println("RequiredDirectory " + reqDir + " exists: " + exists);
logger.info("RequiredDirectory {} exists: {}", reqDir, exists);
}
for (String reqFile : reqFileSet) {
boolean exists = DependencyCheck.fileExists(reqFile);
System.out.println("RequiredFile: " + reqFile + " exists: " + exists);
logger.info("RequiredFile: {} exists: {}", reqFile, exists);
}
for (String optExe : optExeSet) {
boolean exists = DependencyCheck.executableExists(optExe);
System.out.println("OptionalExecutable: " + optExe + " exists: " + exists);
logger.info("OptionalExecutable: {} exists: {}", optExe, exists);
}
for (String optDir : optDirSet) {
boolean exists = DependencyCheck.directoryExists(optDir);
System.out.println("OptionalDirectory " + optDir + " exists: " + exists);
logger.info("OptionalDirectory {} exists: {}", optDir, exists);
}
for (String optFile : optFileSet) {
boolean exists = DependencyCheck.fileExists(optFile);
System.out.println("OptionalFile: " + optFile + " exists: " + exists);
logger.info("OptionalFile: {} exists: {}", optFile, exists);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/test/java/emissary/util/DependencyCheckTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ void testFileDoesNotExists() {
}

@Test
@SuppressWarnings("SystemOut")
void testDependencyReport() {
Configurator conf = new ServiceConfigGuide();
conf.addEntry("REQUIRED_EXECUTABLE", "bash");
Expand Down

0 comments on commit ce9f5e6

Please sign in to comment.