From 3a08931d197522fad9440ade10eb96364d2ca405 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Fri, 15 Nov 2019 20:05:48 +0100 Subject: [PATCH] Removing plexus dependency --- .../rss/processor/NewArtifactsRssFeedProcessorTest.java | 6 ++++-- .../apache/archiva/webdav/ArchivaDavResourceFactory.java | 9 +-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java index 8caccdba0..2e5913108 100644 --- a/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java +++ b/archiva-modules/archiva-web/archiva-rss/src/test/java/org/apache/archiva/rss/processor/NewArtifactsRssFeedProcessorTest.java @@ -97,7 +97,7 @@ public class NewArtifactsRssFeedProcessorTest throws Exception { List newArtifacts = new ArrayList<>(); - ZonedDateTime whenGathered = ZonedDateTime.of(LocalDateTime.now(), ZoneId.systemDefault()); + ZonedDateTime whenGathered = ZonedDateTime.now(); newArtifacts.add( createArtifact( "artifact-one", "1.0", whenGathered ) ); newArtifacts.add( createArtifact( "artifact-one", "1.1", whenGathered ) ); @@ -116,8 +116,10 @@ public class NewArtifactsRssFeedProcessorTest SyndFeed feed = newArtifactsProcessor.process( reqParams ); + // check that the date used in the call is close to the one passed (5 seconds difference at most) - ZonedDateTime cal = ZonedDateTime.of(LocalDateTime.now(), ZoneId.systemDefault()).minusDays(30); + ZonedDateTime cal = ZonedDateTime.now().minusDays(30); + assertTrue(ChronoUnit.SECONDS.between(cal.toInstant(), metadataRepository.getFrom().toInstant())<5); assertEquals( null, metadataRepository.getTo() ); assertEquals( TEST_REPO, metadataRepository.getRepoId() ); diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java index 7cc663271..b9bd4ad81 100644 --- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java +++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java @@ -92,7 +92,6 @@ import org.apache.jackrabbit.webdav.DavServletResponse; import org.apache.jackrabbit.webdav.DavSession; import org.apache.jackrabbit.webdav.lock.LockManager; import org.apache.jackrabbit.webdav.lock.SimpleLockManager; -import org.codehaus.plexus.digest.DigesterException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.MarkerFactory; @@ -379,12 +378,6 @@ public class ArchivaDavResourceFactory throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Error occurred while generating checksum files." ); } - catch ( DigesterException de ) - { - throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, - "Error occurred while generating checksum files." - + de.getMessage() ); - } catch ( LayoutException e ) { log.error("Incompatible layout: {}", e.getMessage(), e); @@ -1250,7 +1243,7 @@ public class ArchivaDavResourceFactory } private StorageAsset writeMergedMetadataToFile( RepositoryGroup repoGroup, ArchivaRepositoryMetadata mergedMetadata, String outputFilename ) - throws RepositoryMetadataException, DigesterException, IOException + throws RepositoryMetadataException, IOException { StorageAsset asset = repoGroup.addAsset( outputFilename, false ); OutputStream stream = asset.getWriteStream( true );