Skip to content

Commit 538e468

Browse files
committed
fix: log warning if version.properties cannot be found
1 parent 9edcde9 commit 538e468

File tree

1 file changed

+13
-4
lines changed
  • operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config

1 file changed

+13
-4
lines changed

operator-framework-core/src/main/java/io/javaoperatorsdk/operator/api/config/Utils.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@
66
import java.time.Instant;
77
import java.util.Date;
88
import java.util.Properties;
9+
import org.slf4j.Logger;
10+
import org.slf4j.LoggerFactory;
911

1012
public class Utils {
1113

14+
private static final Logger log = LoggerFactory.getLogger(Utils.class);
15+
1216
public static Version loadFromProperties() {
1317
final var is =
1418
Thread.currentThread().getContextClassLoader().getResourceAsStream("version.properties");
19+
1520
final var properties = new Properties();
16-
try {
17-
properties.load(is);
18-
} catch (IOException e) {
19-
e.printStackTrace();
21+
if(is != null) {
22+
try {
23+
properties.load(is);
24+
} catch (IOException e) {
25+
log.warn("Couldn't load version information: {}", e.getMessage());
26+
}
27+
} else {
28+
log.warn("Couldn't find version.properties file. Default version information will be used.");
2029
}
2130

2231
Date builtTime;

0 commit comments

Comments
 (0)