Refactored the previous bug fix to minimize duplication by reusing an existing function.

Bear in mind that the condition in the previous code was (config == null) and now is (config == null || config.equals("")).
This commit is contained in:
filipesoliveira 2020-08-06 11:15:19 +01:00
parent 80d279a70e
commit 8eaf237a27

View File

@ -33,9 +33,8 @@ public class CordaCaplet extends Capsule {
private Config parseConfigFile(List<String> args) {
this.baseDir = getBaseDirectory(args);
String config = getOptionMultiple(args, Arrays.asList("--config-file", "-f"));
File configFile = (config == null) ? new File(baseDir, "node.conf") : new File(config);
File configFile = getConfigFile(args, baseDir);
try {
ConfigParseOptions parseOptions = ConfigParseOptions.defaults().setAllowMissing(false);
Config defaultConfig = ConfigFactory.parseResources("corda-reference.conf", parseOptions);