diff --git a/pom.xml b/pom.xml index c5fc1b43a..4e3018de8 100644 --- a/pom.xml +++ b/pom.xml @@ -449,7 +449,7 @@ com.google.errorprone error_prone_core - 2.46.0 + 2.47.0 com.uber.nullaway diff --git a/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java b/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java index 3af9996e3..4483fc83f 100644 --- a/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java +++ b/prometheus-metrics-exporter-common/src/main/java/io/prometheus/metrics/exporter/common/PrometheusHttpRequest.java @@ -43,6 +43,8 @@ default String getParameter(String name) { /** See {@code jakarta.servlet.ServletRequest.getParameterValues(String)} */ @Override @Nullable + // decode with Charset is only available in Java 10+, but we want to support Java 8 + @SuppressWarnings("JdkObsolete") default String[] getParameterValues(String name) { try { ArrayList result = new ArrayList<>(); diff --git a/prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java b/prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java index 72e0561c1..ab2c07ee9 100644 --- a/prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java +++ b/prometheus-metrics-exporter-pushgateway/src/main/java/io/prometheus/metrics/exporter/pushgateway/PushGateway.java @@ -253,6 +253,8 @@ private void doRequest(@Nullable PrometheusRegistry registry, String method) thr } } + // toString with Charset is only available in Java 10+, but we want to support Java 8 + @SuppressWarnings("JdkObsolete") private static String readFromStream(InputStream is) throws IOException { ByteArrayOutputStream result = new ByteArrayOutputStream(); byte[] buffer = new byte[1024]; @@ -497,6 +499,8 @@ private Format getFormat() { return Format.PROMETHEUS_PROTOBUF; } + // encode with Charset is only available in Java 10+, but we want to support Java 8 + @SuppressWarnings("JdkObsolete") private URL makeUrl(@Nullable ExporterPushgatewayProperties properties) throws UnsupportedEncodingException, MalformedURLException { StringBuilder url = diff --git a/prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormatWriter.java b/prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormatWriter.java index 67f1ee41e..03ac229ca 100644 --- a/prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormatWriter.java +++ b/prometheus-metrics-exposition-textformats/src/main/java/io/prometheus/metrics/expositionformats/ExpositionFormatWriter.java @@ -20,6 +20,8 @@ default void write(OutputStream out, MetricSnapshots metricSnapshots) throws IOE } /** Converts the metric snapshots to a debug string using the specified escaping scheme. */ + // toString with Charset is only available in Java 10+, but we want to support Java 8 + @SuppressWarnings("JdkObsolete") default String toDebugString(MetricSnapshots metricSnapshots, EscapingScheme escapingScheme) { ByteArrayOutputStream out = new ByteArrayOutputStream(); try {