avoiding even more NoSuchMethod exceptions (#6729)

* avoiding more NoSuchMethod exceptions

refs #6657

* avoiding even more NoSuchMethod exceptions

refs #6657
This commit is contained in:
Kamil Rojewski
2021-08-05 21:25:23 +02:00
committed by GitHub
parent a7b527d942
commit 6fb2c90d9e
4 changed files with 12 additions and 12 deletions

View File

@@ -87,11 +87,11 @@ public class Utf8Old extends Utf8 {
public String decodeUtf8(ByteBuffer buffer, int offset, int length) {
CharsetDecoder decoder = CACHE.get().decoder;
decoder.reset();
buffer = buffer.duplicate();
((Buffer) buffer).position(offset);
buffer.limit(offset + length);
Buffer b = ((Buffer) buffer).duplicate();
b.position(offset);
b.limit(offset + length);
try {
CharBuffer result = decoder.decode(buffer);
CharBuffer result = decoder.decode((ByteBuffer) b);
return result.toString();
} catch (CharacterCodingException e) {
throw new IllegalArgumentException("Bad encoding", e);