diff --git a/security/jwt/src/main/java/io/helidon/security/jwt/jwk/JwkKeys.java b/security/jwt/src/main/java/io/helidon/security/jwt/jwk/JwkKeys.java index 9e339384cee..9b8a037e890 100644 --- a/security/jwt/src/main/java/io/helidon/security/jwt/jwk/JwkKeys.java +++ b/security/jwt/src/main/java/io/helidon/security/jwt/jwk/JwkKeys.java @@ -19,9 +19,6 @@ import java.io.IOException; import java.io.InputStream; import java.lang.System.Logger.Level; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; -import java.nio.charset.UnsupportedCharsetException; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; @@ -30,7 +27,6 @@ import java.util.Objects; import java.util.Optional; -import io.helidon.common.NativeImageHelper; import io.helidon.common.configurable.Resource; import jakarta.json.Json; @@ -59,26 +55,6 @@ public final class JwkKeys { private final Map keyMap = new HashMap<>(); private final List noKeyIdKeys = new LinkedList<>(); - private static final boolean AUTOMATIC_CHARSET_DETECTION; - - // Workaround for https://github.com/eclipse-ee4j/parsson/issues/121 - static { - boolean utf32Available = false; - try { - Charset.forName("UTF-32LE"); - Charset.forName("UTF-32BE"); - utf32Available = true; - } catch (UnsupportedCharsetException e) { - if (NativeImageHelper.isNativeImage()) { - LOGGER.log(Level.TRACE, "Automatic JSON unicode detection not available." - + " Add -H:+AddAllCharsets to build your native image with UTF-32 support.", e); - } else { - LOGGER.log(Level.TRACE, "Automatic JSON unicode detection not available.", e); - } - } - AUTOMATIC_CHARSET_DETECTION = utf32Available; - } - private JwkKeys(Builder builder) { this.keyMap.putAll(builder.keyMap); this.noKeyIdKeys.addAll(builder.noKeyIdKeys); @@ -171,9 +147,7 @@ public Builder addKey(Jwk key) { public Builder resource(Resource resource) { Objects.requireNonNull(resource, "Json resource must not be null"); try (InputStream is = resource.stream()) { - JsonObject jsonObject = AUTOMATIC_CHARSET_DETECTION - ? JSON.createReader(is).readObject() - : JSON.createReader(is, StandardCharsets.UTF_8).readObject(); + JsonObject jsonObject = JSON.createReader(is).readObject(); addKeys(jsonObject); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to close input stream on resource: " + resource);