Skip to content

Commit

Permalink
#2102 PropertiesDefaultProvider at first try to load properties from …
Browse files Browse the repository at this point in the history
…classpath

- check if commandSpec.userObject is null
  • Loading branch information
Lumír Návrat authored and remkop committed Sep 18, 2023
1 parent a6c207f commit b4434f4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/picocli/CommandLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -18979,7 +18979,11 @@ private static Properties loadProperties(CommandSpec commandSpec) {
if (file.canRead()) {
return createProperties(file, commandSpec);
} else {
URL resource = commandSpec.userObject().getClass().getClassLoader().getResource(propertiesFileName);
Object userObject = commandSpec.userObject();
if (userObject == null) {
userObject = commandSpec.commandLine;
}
URL resource = userObject.getClass().getClassLoader().getResource(propertiesFileName);
Tracer tracer = CommandLine.tracer();
if (resource != null) {
file = new File(resource.getFile());
Expand Down

0 comments on commit b4434f4

Please sign in to comment.