Remove use of JAXB from xmvn-core to make it work with Java 9

This commit is contained in:
Mikolaj Izdebski 2018-04-27 16:07:03 +02:00
parent dd155d2782
commit 69ccb8f09d
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,58 @@
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

View File

@ -10,7 +10,7 @@
Name: xmvn Name: xmvn
Version: 3.0.0 Version: 3.0.0
Release: 15%{?dist} Release: 16%{?dist}
Summary: Local Extensions for Apache Maven Summary: Local Extensions for Apache Maven
License: ASL 2.0 License: ASL 2.0
URL: https://fedora-java.github.io/xmvn/ URL: https://fedora-java.github.io/xmvn/
@ -23,6 +23,7 @@ Patch1: 0001-Port-to-Gradle-4.2.patch
Patch2: 0001-Port-to-Gradle-4.3.1.patch Patch2: 0001-Port-to-Gradle-4.3.1.patch
Patch3: 0001-Support-setting-Xdoclint-none-in-m-javadoc-p-3.0.0.patch Patch3: 0001-Support-setting-Xdoclint-none-in-m-javadoc-p-3.0.0.patch
Patch4: 0001-Fix-configuration-of-aliased-plugins.patch Patch4: 0001-Fix-configuration-of-aliased-plugins.patch
Patch5: 0001-Don-t-use-JAXB-for-converting-bytes-to-hex-string.patch
BuildRequires: maven >= 3.5.0 BuildRequires: maven >= 3.5.0
BuildRequires: maven-local BuildRequires: maven-local
@ -197,6 +198,7 @@ This package provides %{summary}.
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
# Bisect IT has no chances of working in local, offline mode, without # Bisect IT has no chances of working in local, offline mode, without
# network access - it needs to access remote repositories. # network access - it needs to access remote repositories.
@ -346,6 +348,9 @@ cp -P ${maven_home}/bin/m2.conf %{buildroot}%{_datadir}/%{name}/bin/
%doc LICENSE NOTICE %doc LICENSE NOTICE
%changelog %changelog
* Fri Apr 27 2018 Mikolaj Izdebski <mizdebsk@redhat.com> - 3.0.0-16
- Remove use of JAXB from xmvn-core to make it work with Java 9
* Thu Apr 19 2018 Michael Simacek <msimacek@redhat.com> - 3.0.0-15 * Thu Apr 19 2018 Michael Simacek <msimacek@redhat.com> - 3.0.0-15
- Fix maven home lookup and layout to match current maven - Fix maven home lookup and layout to match current maven