Fixing exception handling for filesystem storage initialization

This commit is contained in:
Martin Stockhammer 2019-05-25 10:30:34 +02:00
parent 53c58d457d
commit aabd20f668
1 changed files with 12 additions and 2 deletions

View File

@ -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<? extends ArtifactMappingProvider> 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() {