Skip to content

Commit

Permalink
Refactor the calls to System.getProperty()
Browse files Browse the repository at this point in the history
- first try using the value of tcmsConfigPath
- if that's missing then default to ~/.tcms.conf
  • Loading branch information
atodorov committed Jul 14, 2023
1 parent 5e7105b commit b631d05
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/main/java/org/kiwitcms/java/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import org.apache.commons.configuration2.builder.fluent.Configurations;
import org.apache.commons.configuration2.ex.ConfigurationException;

import org.apache.commons.lang3.StringUtils;
import org.ini4j.Ini;
import org.ini4j.IniPreferences;

Expand All @@ -27,10 +26,10 @@ public class Config {

private Config() {
try {
String config_path = System.getProperty("user.home") + "/.tcms.conf");
if (!StringUtils.isBlank(System.getProperty("tcmsConfigPath"))) {
config_path = System.getProperty("tcmsConfigPath");
}
String config_path = System.getProperty(
"tcmsConfigPath",
System.getProperty("user.home") + "/.tcms.conf"
);
config = new IniPreferences(new Ini(new File(config_path)));
} catch (java.io.IOException fnfe) {
fnfe.printStackTrace();
Expand Down

0 comments on commit b631d05

Please sign in to comment.