Projects
Mega:23.09
xmvn
_service:tar_scm:0001-Don-t-use-JAXB-for-conver...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm:0001-Don-t-use-JAXB-for-converting-bytes-to-hex-string.patch of Package xmvn
From 336cbdc97f3c7055ebdf858141bfc160fd4d412b Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski <mizdebsk@redhat.com> Date: Fri, 8 Dec 2017 18:00:54 +0100 Subject: [PATCH] Don't use JAXB for converting bytes to hex string --- .../java/org/fedoraproject/xmvn/resolver/impl/CacheManager.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 index 1d6c193b..0902aa88 100644 --- 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 @@ -16,14 +16,13 @@ package org.fedoraproject.xmvn.resolver.impl; import java.io.IOException; +import java.math.BigInteger; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import javax.xml.bind.annotation.adapters.HexBinaryAdapter; - /** * @author Mikolaj Izdebski */ @@ -31,8 +30,6 @@ class CacheManager { private static final String DIGEST_ALGORITHM = "SHA-1"; - private final HexBinaryAdapter hexAdapter; - private final MessageDigest digest; private static volatile Path cacheHome; @@ -41,7 +38,6 @@ class CacheManager { try { - hexAdapter = new HexBinaryAdapter(); digest = MessageDigest.getInstance( DIGEST_ALGORITHM ); } catch ( NoSuchAlgorithmException e ) @@ -53,7 +49,7 @@ class CacheManager private String hash( Path path ) throws IOException { - return hexAdapter.marshal( digest.digest( Files.readAllBytes( path ) ) ); + return new BigInteger( 1, digest.digest( Files.readAllBytes( path ) ) ).setBit( 160 ).toString( 16 ).substring( 1 ).toUpperCase(); } private static Path getPathDefault( String key, Object defaultValue ) -- 2.14.3
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2