Skip to content

Commit 27362ee

Browse files
committed
naming
Signed-off-by: Gregor Zeitlinger <[email protected]>
1 parent 263d805 commit 27362ee

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/PrometheusNaming.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
package io.prometheus.metrics.model.snapshots;
22

3-
import static java.lang.Character.*;
4-
53
import io.prometheus.metrics.config.PrometheusProperties;
4+
65
import java.nio.charset.StandardCharsets;
76
import java.util.ArrayList;
87
import java.util.List;
98
import java.util.regex.Matcher;
109
import java.util.regex.Pattern;
1110

11+
import static java.lang.Character.MAX_CODE_POINT;
12+
import static java.lang.Character.MAX_LOW_SURROGATE;
13+
import static java.lang.Character.MIN_HIGH_SURROGATE;
14+
1215
/**
1316
* Utility for Prometheus Metric and Label naming.
1417
*
@@ -637,7 +640,7 @@ public static String escapeName(String name, EscapingScheme scheme) {
637640
escaped.append("__");
638641
} else if (isValidLegacyChar(c, i)) {
639642
escaped.appendCodePoint(c);
640-
} else if (!isValidUTF8Char(c)) {
643+
} else if (!isValidUtf8Char(c)) {
641644
escaped.append("_FFFD_");
642645
} else {
643646
escaped.append('_');
@@ -707,7 +710,7 @@ static String unescapeName(String name, EscapingScheme scheme) {
707710
if (escapedName.codePointAt(i) == '_') {
708711
// char utf8Char = (char) utf8Val;
709712
foundClosingUnderscore = true;
710-
if (!isValidUTF8Char(utf8Val)) {
713+
if (!isValidUtf8Char(utf8Val)) {
711714
return name;
712715
}
713716
unescaped.appendCodePoint(utf8Val);
@@ -746,7 +749,7 @@ static boolean isValidLegacyChar(int c, int i) {
746749
|| (c >= '0' && c <= '9' && i > 0);
747750
}
748751

749-
private static boolean isValidUTF8Char(int c) {
752+
private static boolean isValidUtf8Char(int c) {
750753
return (0 <= c && c < MIN_HIGH_SURROGATE) || (MAX_LOW_SURROGATE < c && c <= MAX_CODE_POINT);
751754
}
752755
}

0 commit comments

Comments
 (0)