1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-29 15:52:08 +01:00

Fix compatibility with java8

This commit is contained in:
Paul Schaub 2020-04-21 17:34:21 +02:00
parent 247723cc68
commit f108ccc30c
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -15,6 +15,7 @@
*/
package org.pgpainless.key;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import javax.annotation.Nonnull;
@ -89,9 +90,12 @@ public class OpenPgpV4Fingerprint implements CharSequence, Comparable<OpenPgpV4F
public long getKeyId() {
byte[] bytes = Hex.decode(toString().getBytes(Charset.forName("UTF-8")));
ByteBuffer buf = ByteBuffer.wrap(bytes);
buf.position(12);
return buf.getLong();
// We have to cast here in order to be compatible with java 8
// https://github.com/eclipse/jetty.project/issues/3244
((Buffer) buf).position(12);
return buf.getLong();
}
@Override