forked from BigfootDev/flatbuffers
avoiding even more NoSuchMethod exceptions (#6729)
* avoiding more NoSuchMethod exceptions refs #6657 * avoiding even more NoSuchMethod exceptions refs #6657
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user