diff options
author | Martin Stockhammer <martin_s@apache.org> | 2021-07-03 11:20:04 +0200 |
---|---|---|
committer | Martin Stockhammer <martin_s@apache.org> | 2021-07-03 11:20:04 +0200 |
commit | bc27b2584b5a1500cb74419a1a98a02acb4dff4d (patch) | |
tree | 3de4e4f1894e79e27a181bdf42081c7ddf6e3ee1 /archiva-modules | |
parent | bf219edd1656cc03dc35d9e4379890d2c2124459 (diff) | |
download | archiva-bc27b2584b5a1500cb74419a1a98a02acb4dff4d.tar.gz archiva-bc27b2584b5a1500cb74419a1a98a02acb4dff4d.zip |
Fixing NPEs
Diffstat (limited to 'archiva-modules')
-rw-r--r-- | archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java index ebdd0c761..81e6377b2 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/test/java/org/apache/archiva/admin/mock/MavenIndexContextMock.java @@ -47,12 +47,17 @@ public class MavenIndexContextMock implements ArchivaIndexingContext { MavenIndexContextMock(Repository repository, IndexingContext delegate) { this.delegate = delegate; this.repository = repository; - try { - this.filesystemStorage = new FilesystemStorage(delegate.getIndexDirectoryFile().toPath(), new DefaultFileLockManager()); - } catch (IOException e) { - e.printStackTrace(); + if(delegate!=null && delegate.getIndexDirectoryFile()!=null) + { + try + { + this.filesystemStorage = new FilesystemStorage( delegate.getIndexDirectoryFile( ).toPath( ), new DefaultFileLockManager( ) ); + } + catch ( IOException e ) + { + e.printStackTrace( ); + } } - } @Override @@ -95,7 +100,7 @@ public class MavenIndexContextMock implements ArchivaIndexingContext { public void close(boolean deleteFiles) throws IOException { open = false; try { - delegate.close(deleteFiles); + if (delegate!=null) delegate.close(deleteFiles); } catch (NoSuchFileException e) { // Ignore missing directory } @@ -105,7 +110,7 @@ public class MavenIndexContextMock implements ArchivaIndexingContext { public void close() throws IOException { open = false; try { - delegate.close(false); + if (delegate!=null) delegate.close(false); } catch (NoSuchFileException e) { // Ignore missing directory } |