|
|
d6a86f |
From 336cbdc97f3c7055ebdf858141bfc160fd4d412b Mon Sep 17 00:00:00 2001
|
|
|
d6a86f |
From: Mikolaj Izdebski <mizdebsk@redhat.com>
|
|
|
d6a86f |
Date: Fri, 8 Dec 2017 18:00:54 +0100
|
|
|
d6a86f |
Subject: [PATCH] Don't use JAXB for converting bytes to hex string
|
|
|
d6a86f |
|
|
|
d6a86f |
---
|
|
|
d6a86f |
.../java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java | 8 ++------
|
|
|
d6a86f |
1 file changed, 2 insertions(+), 6 deletions(-)
|
|
|
d6a86f |
|
|
|
d6a86f |
diff --git a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java
|
|
|
d6a86f |
index 1d6c193b..0902aa88 100644
|
|
|
d6a86f |
--- a/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java
|
|
|
d6a86f |
+++ b/xmvn-core/src/main/java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java
|
|
|
d6a86f |
@@ -16,14 +16,13 @@
|
|
|
d6a86f |
package org.fedoraproject.xmvn.resolver.impl;
|
|
|
d6a86f |
|
|
|
d6a86f |
import java.io.IOException;
|
|
|
d6a86f |
+import java.math.BigInteger;
|
|
|
d6a86f |
import java.nio.file.Files;
|
|
|
d6a86f |
import java.nio.file.Path;
|
|
|
d6a86f |
import java.nio.file.Paths;
|
|
|
d6a86f |
import java.security.MessageDigest;
|
|
|
d6a86f |
import java.security.NoSuchAlgorithmException;
|
|
|
d6a86f |
|
|
|
d6a86f |
-import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
|
|
|
d6a86f |
-
|
|
|
d6a86f |
/**
|
|
|
d6a86f |
* @author Mikolaj Izdebski
|
|
|
d6a86f |
*/
|
|
|
d6a86f |
@@ -31,8 +30,6 @@ class CacheManager
|
|
|
d6a86f |
{
|
|
|
d6a86f |
private static final String DIGEST_ALGORITHM = "SHA-1";
|
|
|
d6a86f |
|
|
|
d6a86f |
- private final HexBinaryAdapter hexAdapter;
|
|
|
d6a86f |
-
|
|
|
d6a86f |
private final MessageDigest digest;
|
|
|
d6a86f |
|
|
|
d6a86f |
private static volatile Path cacheHome;
|
|
|
d6a86f |
@@ -41,7 +38,6 @@ class CacheManager
|
|
|
d6a86f |
{
|
|
|
d6a86f |
try
|
|
|
d6a86f |
{
|
|
|
d6a86f |
- hexAdapter = new HexBinaryAdapter();
|
|
|
d6a86f |
digest = MessageDigest.getInstance( DIGEST_ALGORITHM );
|
|
|
d6a86f |
}
|
|
|
d6a86f |
catch ( NoSuchAlgorithmException e )
|
|
|
d6a86f |
@@ -53,7 +49,7 @@ class CacheManager
|
|
|
d6a86f |
private String hash( Path path )
|
|
|
d6a86f |
throws IOException
|
|
|
d6a86f |
{
|
|
|
d6a86f |
- return hexAdapter.marshal( digest.digest( Files.readAllBytes( path ) ) );
|
|
|
d6a86f |
+ return new BigInteger( 1, digest.digest( Files.readAllBytes( path ) ) ).setBit( 160 ).toString( 16 ).substring( 1 ).toUpperCase();
|
|
|
d6a86f |
}
|
|
|
d6a86f |
|
|
|
d6a86f |
private static Path getPathDefault( String key, Object defaultValue )
|
|
|
d6a86f |
--
|
|
|
d6a86f |
2.14.3
|
|
|
d6a86f |
|