File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
api/all/src/main/java/io/opentelemetry/api/internal Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ public final class OtelEncodingUtils {
2121 private static final int NUM_ASCII_CHARACTERS = 128 ;
2222 private static final char [] ENCODING = buildEncodingArray ();
2323 private static final byte [] DECODING = buildDecodingArray ();
24- private static final boolean [] VALID_HEX = buildValidHexArray ();
24+
25+ private static volatile boolean [] validHex = null ;
2526
2627 private static char [] buildEncodingArray () {
2728 char [] encoding = new char [512 ];
@@ -152,7 +153,15 @@ public static boolean isValidBase16String(CharSequence value) {
152153
153154 /** Returns whether the given {@code char} is a valid hex character. */
154155 public static boolean isValidBase16Character (char b ) {
155- return VALID_HEX [b ];
156+ if (validHex == null ) {
157+ synchronized (OtelEncodingUtils .class ) {
158+ if (validHex == null ) {
159+ validHex = buildValidHexArray ();
160+ }
161+ }
162+ }
163+
164+ return validHex [b ];
156165 }
157166
158167 private OtelEncodingUtils () {}
You can’t perform that action at this time.
0 commit comments