Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
DivineThreepwood committed Aug 30, 2022
1 parent a1d5b06 commit b6b5f62
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 31 deletions.
40 changes: 10 additions & 30 deletions src/main/java/org/openbase/jps/core/JPService.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ public class JPService {
private static String[] args = new String[0];

static {
initJPSDefaultProperties();
registerJPSDefaultProperties();
}

private static void initJPSDefaultProperties() {
private static void registerJPSDefaultProperties() {
registerProperty(JPHelp.class);
registerProperty(JPVerbose.class);
registerProperty(JPLogLevel.class);
Expand Down Expand Up @@ -959,7 +959,7 @@ public static String newLineFormatter(String text, String newLineOperator, int m

/**
* Method prints the info message and blocks the system input until the user confirms the message.
* Otherwise the cancel message will be printed and System.exit is called with the given exit code.
* Otherwise, the cancel message will be printed and System.exit is called with the given exit code.
*
* @param infoMessage the message to inform the user about the situation to confirm.
* @param cancelMessage the message which is printed in case the user rejects the action.
Expand Down Expand Up @@ -1018,50 +1018,30 @@ public static String[] getArgs() {
}

/**
*
* Reset the entire property configuration.
*/
public static void reset() { //todo: make reset non public in next major release
public static void reset() {
registeredPropertyClasses.clear();
initializedProperties.clear();
loadedProperties.clear();
overwrittenDefaultValueMap.clear();
argumentsAnalyzed = false;
initJPSDefaultProperties();
registerJPSDefaultProperties();
}

public static boolean testMode() {
try {
return JPService.getProperty(JPTestMode.class).getValue();
} catch (JPServiceException ex) {
printError("Could not detect TestMode!", ex);
}
return false;
return JPService.getValue(JPTestMode.class, false);
}

public static boolean verboseMode() {
try {
return JPService.getProperty(JPVerbose.class).getValue();
} catch (JPServiceException ex) {
printError("Could not detect VerboseMode!", ex);
}
return false;
return JPService.getValue(JPVerbose.class, false);
}

public static boolean forceMode() {
try {
return JPService.getProperty(JPForce.class).getValue();
} catch (JPServiceException ex) {
printError("Could not detect ForceMode!", ex);
}
return false;
return JPService.getValue(JPForce.class, false);
}

public static boolean debugMode() {
try {
return JPService.getProperty(JPDebugMode.class).getValue();
} catch (JPServiceException ex) {
printError("Could not detect DebugMode!", ex);
}
return false;
return JPService.getValue(JPDebugMode.class, false);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/openbase/jps/tools/FileHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,6 @@ public boolean create(File file) throws IOException {

public interface FileCreator {

public abstract boolean create(File file) throws Exception;
boolean create(File file) throws Exception;
}
}

0 comments on commit b6b5f62

Please sign in to comment.