mirror of https://github.com/apache/archiva.git
Adding null checks for index manager
This commit is contained in:
parent
74d69f36c8
commit
d9f8834dc1
|
@ -148,6 +148,8 @@ public class MavenIndexManager implements ArchivaIndexManager {
|
||||||
|
|
||||||
|
|
||||||
public static IndexingContext getMvnContext( ArchivaIndexingContext context ) throws UnsupportedBaseContextException
|
public static IndexingContext getMvnContext( ArchivaIndexingContext context ) throws UnsupportedBaseContextException
|
||||||
|
{
|
||||||
|
if (context!=null)
|
||||||
{
|
{
|
||||||
if ( !context.supports( IndexingContext.class ) )
|
if ( !context.supports( IndexingContext.class ) )
|
||||||
{
|
{
|
||||||
|
@ -155,6 +157,9 @@ public class MavenIndexManager implements ArchivaIndexManager {
|
||||||
throw new UnsupportedBaseContextException( "The context does not support the Maven IndexingContext" );
|
throw new UnsupportedBaseContextException( "The context does not support the Maven IndexingContext" );
|
||||||
}
|
}
|
||||||
return context.getBaseContext( IndexingContext.class );
|
return context.getBaseContext( IndexingContext.class );
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private StorageAsset getIndexPath( ArchivaIndexingContext ctx )
|
private StorageAsset getIndexPath( ArchivaIndexingContext ctx )
|
||||||
|
@ -175,6 +180,9 @@ public class MavenIndexManager implements ArchivaIndexManager {
|
||||||
*/
|
*/
|
||||||
private void executeUpdateFunction( ArchivaIndexingContext context, IndexUpdateConsumer function ) throws IndexUpdateFailedException
|
private void executeUpdateFunction( ArchivaIndexingContext context, IndexUpdateConsumer function ) throws IndexUpdateFailedException
|
||||||
{
|
{
|
||||||
|
if (context==null) {
|
||||||
|
throw new IndexUpdateFailedException( "Given context is null" );
|
||||||
|
}
|
||||||
IndexingContext indexingContext = null;
|
IndexingContext indexingContext = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue