File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
src/main/java/com/maxmind/db Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 33import java .io .IOException ;
44import java .math .BigInteger ;
55import java .nio .ByteBuffer ;
6+ import java .nio .charset .CharacterCodingException ;
67import java .nio .charset .Charset ;
8+ import java .nio .charset .CharsetDecoder ;
79
810import com .fasterxml .jackson .databind .JsonNode ;
911import com .fasterxml .jackson .databind .ObjectMapper ;
@@ -24,6 +26,8 @@ final class Decoder {
2426
2527 private final ObjectMapper objectMapper ;
2628
29+ private final CharsetDecoder utfDecoder = UTF_8 .newDecoder ();
30+
2731 private final ByteBuffer buffer ;
2832
2933 static enum Type {
@@ -184,10 +188,10 @@ private Result decodePointer(int ctrlByte, int offset) {
184188 return new Result (new LongNode (pointer ), offset + pointerSize );
185189 }
186190
187- private String decodeString (int size ) {
191+ private String decodeString (int size ) throws CharacterCodingException {
188192 int oldLimit = buffer .limit ();
189193 buffer .limit (buffer .position () + size );
190- String s = UTF_8 .decode (buffer ).toString ();
194+ String s = utfDecoder .decode (buffer ).toString ();
191195 buffer .limit (oldLimit );
192196 return s ;
193197 }
You can’t perform that action at this time.
0 commit comments