|
1 | 1 | package com.datadog.aiguard; |
2 | 2 |
|
| 3 | +import static datadog.communication.ddagent.TracerVersion.TRACER_VERSION; |
3 | 4 | import static datadog.trace.api.telemetry.WafMetricCollector.AIGuardTruncationType.CONTENT; |
4 | 5 | import static datadog.trace.api.telemetry.WafMetricCollector.AIGuardTruncationType.MESSAGES; |
5 | 6 | import static datadog.trace.util.Strings.isBlank; |
|
10 | 11 | import com.squareup.moshi.JsonWriter; |
11 | 12 | import com.squareup.moshi.Moshi; |
12 | 13 | import com.squareup.moshi.Types; |
13 | | -import datadog.common.version.VersionInfo; |
14 | 14 | import datadog.communication.http.OkHttpUtils; |
15 | 15 | import datadog.trace.api.Config; |
16 | 16 | import datadog.trace.api.aiguard.AIGuard; |
@@ -90,7 +90,7 @@ public static void install() { |
90 | 90 | "DD-APPLICATION-KEY", |
91 | 91 | appKey, |
92 | 92 | "DD-AI-GUARD-VERSION", |
93 | | - VersionInfo.VERSION, |
| 93 | + TRACER_VERSION, |
94 | 94 | "DD-AI-GUARD-SOURCE", |
95 | 95 | "SDK", |
96 | 96 | "DD-AI-GUARD-LANGUAGE", |
@@ -279,10 +279,12 @@ private static OkHttpClient buildClient(final HttpUrl url, final long timeout) { |
279 | 279 | } |
280 | 280 |
|
281 | 281 | private static Map<String, String> mapOf(final String... props) { |
| 282 | + if (props.length % 2 != 0) { |
| 283 | + throw new IllegalArgumentException("Props must be even"); |
| 284 | + } |
282 | 285 | final Map<String, String> map = new HashMap<>(props.length << 1); |
283 | | - int index = 0; |
284 | | - while (index < props.length) { |
285 | | - map.put(props[index++], props[index++]); |
| 286 | + for (int i = 0; i < props.length; ) { |
| 287 | + map.put(props[i++], props[i++]); |
286 | 288 | } |
287 | 289 | return map; |
288 | 290 | } |
|
0 commit comments