aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webdav/src
diff options
context:
space:
mode:
authorMartin Stockhammer <martin_s@apache.org>2020-02-01 00:41:34 +0100
committerMartin Stockhammer <martin_s@apache.org>2020-02-01 00:41:34 +0100
commit865e3fef2449f093ddfb6c133563de0a0b5d4659 (patch)
tree38975ae0f82f587a49df840346012dc87f650283 /archiva-modules/archiva-web/archiva-webdav/src
parent5fe962ccce28d60c2745343e0174fed42bd5e2b5 (diff)
downloadarchiva-865e3fef2449f093ddfb6c133563de0a0b5d4659.tar.gz
archiva-865e3fef2449f093ddfb6c133563de0a0b5d4659.zip
Adding metadatareader interface
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav/src')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java13
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java3
2 files changed, 10 insertions, 6 deletions
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 b9bd4ad81..7c56f6563 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
@@ -66,6 +66,7 @@ import org.apache.archiva.repository.ReleaseScheme;
import org.apache.archiva.repository.RepositoryGroup;
import org.apache.archiva.repository.RepositoryRegistry;
import org.apache.archiva.repository.RepositoryRequestInfo;
+import org.apache.archiva.repository.storage.FilesystemAsset;
import org.apache.archiva.repository.storage.FilesystemStorage;
import org.apache.archiva.repository.storage.StorageAsset;
import org.apache.archiva.metadata.audit.AuditListener;
@@ -103,6 +104,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
+import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
@@ -340,18 +342,19 @@ public class ArchivaDavResourceFactory
try
{
Path metadataFile = Paths.get( resourceAbsPath );
- ArchivaRepositoryMetadata repoMetadata = MavenMetadataReader.read( metadataFile );
+ FilesystemStorage storage = new FilesystemStorage( metadataFile.getParent( ), new DefaultFileLockManager( ) );
+ ArchivaRepositoryMetadata repoMetadata = repositoryRegistry.getMetadataReader( repoGroup.getType( ) ).read( storage.getAsset( metadataFile.getFileName().toString() ) );
mergedMetadata = RepositoryMetadataMerge.merge( mergedMetadata, repoMetadata );
}
- catch (XMLException e )
+ catch ( RepositoryMetadataException r )
{
throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Error occurred while reading metadata file." );
+ "Error occurred while merging metadata file." );
}
- catch ( RepositoryMetadataException r )
+ catch ( IOException e )
{
throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
- "Error occurred while merging metadata file." );
+ "Error occurred while merging metadata file." );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
index b634bfd3e..ed44abf47 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/RepositoryServletRepositoryGroupTest.java
@@ -259,7 +259,8 @@ public class RepositoryServletRepositoryGroupTest
Path returnedMetadata = getProjectBase().resolve( "target/test-classes/retrievedMetadataFile.xml" );
org.apache.archiva.common.utils.FileUtils.writeStringToFile( returnedMetadata, Charset.defaultCharset(), response.getContentAsString() );
- ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( returnedMetadata );
+ MavenMetadataReader metadataReader = new MavenMetadataReader( );
+ ArchivaRepositoryMetadata metadata = metadataReader.read( returnedMetadata );
assertResponseOK( response );