Adding null checks for index manager
public static IndexingContext getMvnContext( ArchivaIndexingContext context ) throws UnsupportedBaseContextException
+ {
+ if (context!=null)
{
if ( !context.supports( IndexingContext.class ) )
{
@@ -155,6 +157,9 @@ public static IndexingContext getMvnContext( ArchivaIndexingContext context ) th
throw new UnsupportedBaseContextException( "The context does not support the Maven IndexingContext" );
}
return context.getBaseContext( IndexingContext.class );
+ } else {
+ return null;
+ }
}
private StorageAsset getIndexPath( ArchivaIndexingContext ctx )
@@ -175,6 +180,9 @@ private StorageAsset getIndexPath( ArchivaIndexingContext ctx )
*/
private void executeUpdateFunction( ArchivaIndexingContext context, IndexUpdateConsumer function ) throws IndexUpdateFailedException
{
+ if (context==null) {
+ throw new IndexUpdateFailedException( "Given context is null" );
+ }
IndexingContext indexingContext = null;
try
{
