Skip to content

Commit

Permalink
Remove warning messages in tests (#44230)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanbisutti authored Feb 20, 2025
1 parent cddf674 commit 702d0e2
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,14 @@ private static String toJson(List<TelemetryItem> telemetryItems) throws IOExcept
private static String maskIKeys(List<TelemetryItem> telemetryItems, String json) {
Set<String> iKeys
= telemetryItems.stream().map(TelemetryItem::getInstrumentationKey).collect(Collectors.toSet());
int charactersToKeepAtEnd = 13;
for (String instrumentationKey : iKeys) {
String maskedIKey = "*" + instrumentationKey.substring(instrumentationKey.length() - 13);
json = json.replace(instrumentationKey, maskedIKey);
// Tests could set the connection string with a short one
if (instrumentationKey.length() > charactersToKeepAtEnd) {
String maskedIKey
= "*" + instrumentationKey.substring(instrumentationKey.length() - charactersToKeepAtEnd);
json = json.replace(instrumentationKey, maskedIKey);
}
}
return json;
}
Expand Down

0 comments on commit 702d0e2

Please sign in to comment.