Skip to content

Commit f93546a

Browse files
committed
Use safeToString when printing stableconfig map
1 parent feb1ba0 commit f93546a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

internal-api/src/main/java/datadog/trace/bootstrap/config/provider/stableconfig/Rule.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ public Rule(List<Selector> selectors, Map<String, Object> configuration) {
2828
public static Rule from(Map<?, ?> map) {
2929
Object selectorsObj = map.get("selectors");
3030
if (selectorsObj == null) {
31-
throw new StableConfigMappingException("Missing 'selectors' in rule: " + map);
31+
throw new StableConfigMappingException(
32+
"Missing 'selectors' in rule: " + StableConfigMappingException.safeToString(map));
3233
}
3334

3435
if (!(selectorsObj instanceof List)) {
@@ -59,7 +60,8 @@ public static Rule from(Map<?, ?> map) {
5960

6061
Object configObj = map.get("configuration");
6162
if (configObj == null) {
62-
throw new StableConfigMappingException("Missing 'configuration' in rule: " + map);
63+
throw new StableConfigMappingException(
64+
"Missing 'configuration' in rule: " + StableConfigMappingException.safeToString(map));
6365
}
6466
if (!(configObj instanceof Map)) {
6567
throw new StableConfigMappingException(

internal-api/src/main/java/datadog/trace/bootstrap/config/provider/stableconfig/Selector.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ public Selector(String origin, String key, List<String> matches, String operator
2020
public static Selector from(Map<?, ?> map) {
2121
Object originObj = map.get("origin");
2222
if (originObj == null) {
23-
throw new StableConfigMappingException("Missing 'origin' in selector: " + map);
23+
throw new StableConfigMappingException(
24+
"Missing 'origin' in selector: " + StableConfigMappingException.safeToString(map));
2425
}
2526
if (!(originObj instanceof String)) {
2627
throw new StableConfigMappingException(
@@ -48,7 +49,8 @@ public static Selector from(Map<?, ?> map) {
4849

4950
Object operatorObj = map.get("operator");
5051
if (operatorObj == null) {
51-
throw new StableConfigMappingException("Missing 'operator' in selector: " + map);
52+
throw new StableConfigMappingException(
53+
"Missing 'operator' in selector: " + StableConfigMappingException.safeToString(map));
5254
}
5355
if (!(operatorObj instanceof String)) {
5456
throw new StableConfigMappingException(

0 commit comments

Comments
 (0)