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:
parent
247723cc68
commit
f108ccc30c
1 changed files with 6 additions and 2 deletions
|
@ -15,6 +15,7 @@
|
||||||
*/
|
*/
|
||||||
package org.pgpainless.key;
|
package org.pgpainless.key;
|
||||||
|
|
||||||
|
import java.nio.Buffer;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
@ -89,9 +90,12 @@ public class OpenPgpV4Fingerprint implements CharSequence, Comparable<OpenPgpV4F
|
||||||
public long getKeyId() {
|
public long getKeyId() {
|
||||||
byte[] bytes = Hex.decode(toString().getBytes(Charset.forName("UTF-8")));
|
byte[] bytes = Hex.decode(toString().getBytes(Charset.forName("UTF-8")));
|
||||||
ByteBuffer buf = ByteBuffer.wrap(bytes);
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue