From aabd20f66839032f335f19b29dec0098fbffb178 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sat, 25 May 2019 10:30:34 +0200 Subject: [PATCH] Fixing exception handling for filesystem storage initialization --- .../maven2/ManagedDefaultRepositoryContent.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java index 92c9b6039..c34c01d0a 100644 --- a/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java +++ b/archiva-modules/archiva-maven/archiva-maven-repository/src/main/java/org/apache/archiva/repository/content/maven2/ManagedDefaultRepositoryContent.java @@ -83,7 +83,12 @@ public class ManagedDefaultRepositoryContent super(Collections.singletonList( new DefaultArtifactMappingProvider() )); setFileTypes( fileTypes ); setRepository( repository ); - storage = new FilesystemStorage(getRepoDir(), lockManager); + try { + storage = new FilesystemStorage(getRepoDir(), lockManager); + } catch (IOException e) { + log.error("Could not initialize the filesystem storage to repository: {}", getRepoDir()); + throw new RuntimeException("Fatal error. Could not initialize the filesystem storage for "+getRepoDir()); + } } public ManagedDefaultRepositoryContent( ManagedRepository repository, List artifactMappingProviders, FileTypes fileTypes, FileLockManager lockManager ) @@ -91,7 +96,12 @@ public class ManagedDefaultRepositoryContent super(artifactMappingProviders==null ? Collections.singletonList( new DefaultArtifactMappingProvider() ) : artifactMappingProviders); setFileTypes( fileTypes ); setRepository( repository ); - storage = new FilesystemStorage(getRepoDir(), lockManager); + try { + storage = new FilesystemStorage(getRepoDir(), lockManager); + } catch (IOException e) { + log.error("Could not initialize the filesystem storage to repository: {}", getRepoDir()); + throw new RuntimeException("Fatal error. Could not initialize the filesystem storage for "+getRepoDir()); + } } private Path getRepoDir() {