Skip to content

Commit 52b3f39

Browse files
Captain1653arjav-desai
authored andcommitted
4.x: Remove workaround for Parsson unicode detection issue (helidon-io#8260) (helidon-io#9472)
1 parent 2273eed commit 52b3f39

File tree

1 file changed

+1
-27
lines changed
  • security/jwt/src/main/java/io/helidon/security/jwt/jwk

1 file changed

+1
-27
lines changed

security/jwt/src/main/java/io/helidon/security/jwt/jwk/JwkKeys.java

+1-27
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
import java.io.IOException;
2020
import java.io.InputStream;
2121
import java.lang.System.Logger.Level;
22-
import java.nio.charset.Charset;
23-
import java.nio.charset.StandardCharsets;
24-
import java.nio.charset.UnsupportedCharsetException;
2522
import java.util.Collections;
2623
import java.util.HashMap;
2724
import java.util.LinkedList;
@@ -30,7 +27,6 @@
3027
import java.util.Objects;
3128
import java.util.Optional;
3229

33-
import io.helidon.common.NativeImageHelper;
3430
import io.helidon.common.configurable.Resource;
3531

3632
import jakarta.json.Json;
@@ -59,26 +55,6 @@ public final class JwkKeys {
5955
private final Map<String, Jwk> keyMap = new HashMap<>();
6056
private final List<Jwk> noKeyIdKeys = new LinkedList<>();
6157

62-
private static final boolean AUTOMATIC_CHARSET_DETECTION;
63-
64-
// Workaround for https://github.com/eclipse-ee4j/parsson/issues/121
65-
static {
66-
boolean utf32Available = false;
67-
try {
68-
Charset.forName("UTF-32LE");
69-
Charset.forName("UTF-32BE");
70-
utf32Available = true;
71-
} catch (UnsupportedCharsetException e) {
72-
if (NativeImageHelper.isNativeImage()) {
73-
LOGGER.log(Level.TRACE, "Automatic JSON unicode detection not available."
74-
+ " Add -H:+AddAllCharsets to build your native image with UTF-32 support.", e);
75-
} else {
76-
LOGGER.log(Level.TRACE, "Automatic JSON unicode detection not available.", e);
77-
}
78-
}
79-
AUTOMATIC_CHARSET_DETECTION = utf32Available;
80-
}
81-
8258
private JwkKeys(Builder builder) {
8359
this.keyMap.putAll(builder.keyMap);
8460
this.noKeyIdKeys.addAll(builder.noKeyIdKeys);
@@ -171,9 +147,7 @@ public Builder addKey(Jwk key) {
171147
public Builder resource(Resource resource) {
172148
Objects.requireNonNull(resource, "Json resource must not be null");
173149
try (InputStream is = resource.stream()) {
174-
JsonObject jsonObject = AUTOMATIC_CHARSET_DETECTION
175-
? JSON.createReader(is).readObject()
176-
: JSON.createReader(is, StandardCharsets.UTF_8).readObject();
150+
JsonObject jsonObject = JSON.createReader(is).readObject();
177151
addKeys(jsonObject);
178152
} catch (IOException e) {
179153
LOGGER.log(Level.WARNING, "Failed to close input stream on resource: " + resource);

0 commit comments

Comments
 (0)