fix upperbound and jdk 11 build

Signed-off-by: Olivier Lamy <olamy@apache.org>
This commit is contained in:
Olivier Lamy 2022-06-06 09:46:02 +10:00
parent 235196f471
commit f150f42042
15 changed files with 62 additions and 74 deletions

View File

@ -54,6 +54,10 @@
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
</dependencies> </dependencies>
@ -83,13 +87,13 @@
<!-- Needed for JDK >= 9 --> <!-- Needed for JDK >= 9 -->
<dependency> <dependency>
<groupId>jakarta.annotation</groupId> <groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId> <artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -19,6 +19,9 @@ package org.apache.archiva.checksum;
* under the License. * under the License.
*/ */
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
@ -55,7 +58,7 @@ public class Checksum
if (this.result.length==0) { if (this.result.length==0) {
finish(); finish();
} }
return Hex.encode( this.result ); return Hex.encodeHexString( this.result );
} }
public byte[] getChecksumBytes() { public byte[] getChecksumBytes() {
@ -110,6 +113,10 @@ public class Checksum
if (this.result == null || this.result.length==0) { if (this.result == null || this.result.length==0) {
finish(); finish();
} }
return MessageDigest.isEqual(this.result, Hex.decode( hexString )); try {
return MessageDigest.isEqual(this.result, Hex.decodeHex( hexString ));
} catch (DecoderException e) {
throw new RuntimeException(e);
}
} }
} }

View File

@ -1,55 +0,0 @@
package org.apache.archiva.checksum;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
import javax.xml.bind.DatatypeConverter;
/**
* Hex - simple hex conversions.
*
*
*/
public class Hex
{
public static String encode( byte[] data )
{
try
{
return DatatypeConverter.printHexBinary( data ).trim( ).toLowerCase( );
} catch (IllegalArgumentException e) {
return "";
}
}
public static String encode( String raw )
{
return encode( raw.getBytes() );
}
public static byte[] decode( String data ) {
try
{
return DatatypeConverter.parseHexBinary( data.trim( ) );
} catch (IllegalArgumentException e) {
return new byte[0];
}
}
}

View File

@ -123,7 +123,6 @@
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>1.9</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>

View File

@ -343,7 +343,7 @@ Using provided scope to avoid adding it to packaging.
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</profile> </profile>

View File

@ -147,13 +147,13 @@
<!-- Needed for JDK >= 9 --> <!-- Needed for JDK >= 9 -->
<dependency> <dependency>
<groupId>jakarta.annotation</groupId> <groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId> <artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -181,7 +181,7 @@
<!-- Needed for JDK >= 9 --> <!-- Needed for JDK >= 9 -->
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -69,13 +69,13 @@
<!-- Needed for JDK >= 9 --> <!-- Needed for JDK >= 9 -->
<dependency> <dependency>
<groupId>jakarta.annotation</groupId> <groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId> <artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -267,7 +267,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</profile> </profile>

View File

@ -377,13 +377,13 @@
<!-- Needed for JDK >= 9 --> <!-- Needed for JDK >= 9 -->
<dependency> <dependency>
<groupId>jakarta.annotation</groupId> <groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId> <artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -154,7 +154,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</profile> </profile>

View File

@ -564,4 +564,27 @@
</plugins> </plugins>
</build> </build>
<profiles>
<profile>
<id>jdk9+</id>
<activation>
<jdk>[1.9,)</jdk>
</activation>
<dependencies>
<!-- Needed for JDK >= 9 -->
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project> </project>

View File

@ -611,7 +611,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
</profile> </profile>

View File

@ -168,13 +168,13 @@
<!-- Needed for JDK >= 9 --> <!-- Needed for JDK >= 9 -->
<dependency> <dependency>
<groupId>jakarta.annotation</groupId> <groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId> <artifactId>jakarta.annotation-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jakarta.xml.bind</groupId> <groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId> <artifactId>jakarta.xml.bind-api</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

12
pom.xml
View File

@ -75,7 +75,7 @@
<jakarta.servlet.version>4.0.4</jakarta.servlet.version> <jakarta.servlet.version>4.0.4</jakarta.servlet.version>
<jakarta.inject.version>1.0</jakarta.inject.version> <jakarta.inject.version>1.0</jakarta.inject.version>
<jakarta.annotation.version>1.3.5</jakarta.annotation.version> <jakarta.annotation.version>1.3.5</jakarta.annotation.version>
<jakarta.xml.bind.version>3.0.0</jakarta.xml.bind.version> <jakarta.xml.bind.version>2.3.3</jakarta.xml.bind.version>
<jakarta.transaction.version>1.3.3</jakarta.transaction.version> <jakarta.transaction.version>1.3.3</jakarta.transaction.version>
<jakarta.validation.version>2.0.2</jakarta.validation.version> <jakarta.validation.version>2.0.2</jakarta.validation.version>
<jakarta.ws.rs.version>2.1.6</jakarta.ws.rs.version> <jakarta.ws.rs.version>2.1.6</jakarta.ws.rs.version>
@ -1706,6 +1706,16 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-annotations</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-classworlds</artifactId>
<version>2.6.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.ehcache</groupId> <groupId>org.ehcache</groupId>