Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static void configureOtlpHeaders(
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables
addHeader.accept(key, URLDecoder.decode(value, StandardCharsets.UTF_8.name()));
} catch (Exception e) {
throw new ConfigurationException("Cannot decode header value: " + value, e);
throw new ConfigurationException("Cannot decode header value for header: " + key, e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,10 @@ void createExporter_decodingError() {
() -> {
provider.createExporter(
DefaultConfigProperties.createFromMap(
Collections.singletonMap("otel.exporter.otlp.headers", "header-key=%-1")));
Collections.singletonMap(
"otel.exporter.otlp.headers", "header-key=Bearer%20s3cr3t%-1")));
})
.isInstanceOf(ConfigurationException.class)
.hasMessage("Cannot decode header value: %-1");
.hasMessage("Cannot decode header value for header: header-key");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,7 @@ public Map<String, String> getMap(String name) {
entry -> {
String[] split = entry.split("=", 2);
if (split.length != 2 || StringUtils.isNullOrEmpty(split[0])) {
throw new ConfigurationException(
"Invalid map property: " + name + "=" + config.get(name));
throw new ConfigurationException("Invalid map property: " + name);
}
return filterBlanksAndNulls(split);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,17 @@ void uncleanMap() {
void invalidMap() {
assertThatThrownBy(
() ->
DefaultConfigProperties.createFromMap(Collections.singletonMap("map", "a=1,b"))
DefaultConfigProperties.createFromMap(
Collections.singletonMap("map", "authorization=Bearer s3cr3t,malformed"))
.getMap("map"))
.isInstanceOf(ConfigurationException.class)
.hasMessage("Invalid map property: map=a=1,b");
.hasMessage("Invalid map property: map");
assertThatThrownBy(
() ->
DefaultConfigProperties.createFromMap(Collections.singletonMap("map", "a=1,=b"))
.getMap("map"))
.isInstanceOf(ConfigurationException.class)
.hasMessage("Invalid map property: map=a=1,=b");
.hasMessage("Invalid map property: map");
}

@Test
Expand Down
Loading