Skip to content

Commit 528321d

Browse files
committed
Prevent issues if stable config is used with a security manager (#10006)
1 parent a37b588 commit 528321d

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

utils/config-utils/src/main/java/datadog/trace/bootstrap/config/provider/StableConfigSource.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,14 @@ public final class StableConfigSource extends ConfigProvider.Source {
2828
private final StableConfig config;
2929

3030
StableConfigSource(String filePath, ConfigOrigin origin) {
31+
StableConfig cfg = StableConfig.EMPTY;
3132
this.fileOrigin = origin;
32-
File file = new File(filePath);
33-
if (!file.exists()) {
34-
this.config = StableConfig.EMPTY;
35-
return;
36-
}
37-
StableConfig cfg;
3833
try {
34+
File file = new File(filePath);
3935
log.debug("Stable configuration file found at path: {}", file);
40-
cfg = StableConfigParser.parse(filePath);
36+
if (file.exists()) {
37+
cfg = StableConfigParser.parse(filePath);
38+
}
4139
} catch (Throwable e) {
4240
if (e instanceof StableConfigMappingException
4341
|| e instanceof IllegalArgumentException
@@ -55,8 +53,6 @@ public final class StableConfigSource extends ConfigProvider.Source {
5553
filePath,
5654
e.getMessage());
5755
}
58-
59-
cfg = StableConfig.EMPTY;
6056
}
6157
this.config = cfg;
6258
}

0 commit comments

Comments
 (0)