Buggy code:
public class CacheAddHandler extends AbstractAddStepHandler { private static final Logger log = Logger . getLogger ( CacheAddHandler . class . getPackage ( ) . getName ( ) ) ; private static final ModuleIdentifier QUERY_MODULE = ModuleIdentifier . fromString ( "org.infinispan.query" ) ; final CacheMode mode ; CacheAddHandler ( CacheMode mode ) { } @ Override protected void performRuntime ( OperationContext context , ModelNode operation , ModelNode model ) throws OperationFailedException { ModelNode cacheModel = Tools . readModel ( context . readResource ( EMPTY_ADDRESS ) ) ; <START_BUG> PathAddress address = Operations . getPathAddress ( operation ) ; <END_BUG> PathAddress containerAddress = address . subAddress ( 0 , ( ( address . size ( ) ) - 1 ) ) ; ModelNode containerModel = context . readResourceFromRoot ( containerAddress ) . getModel ( ) ; this . installRuntimeServices ( context , operation , containerModel , cacheModel ) ; } void installRuntimeServices ( OperationContext context , ModelNode operation , ModelNode containerModel , ModelNode cacheModel ) throws OperationFailedException { } void removeRuntimeServices ( OperationContext context , ModelNode operation , ModelNode containerModel , ModelNode cacheModel ) { } void processModelNode ( OperationContext context , String containerName , ModelNode containerModel , ModelNode cache , AdvancedCacheConfigurationBuilder configBuilder ) throws OperationFailedException { } private static StoreType findStoreType ( ModelNode cache ) { } private static StoreConfigurationBuilder < ? , ? > buildCacheStore ( OperationContext context , PersistenceConfigurationBuilder persistenceBuilder , String containerName , StoreType storeType , ModelNode store , AdvancedCacheConfigurationBuilder configBuilder ) throws OperationFailedException { } private static AbstractJdbcStoreConfigurationBuilder < ? , ? > buildJdbcStore ( PersistenceConfigurationBuilder persistenceBuilder , OperationContext context , ModelNode store ) throws OperationFailedException { } private static void buildBinaryKeyedTable ( TableManipulationConfigurationBuilder < ? , ? > builder , OperationContext context , ModelNode table ) throws OperationFailedException { } private static void buildStringKeyedTable ( TableManipulationConfigurationBuilder < ? , ? > builder , OperationContext context , ModelNode table ) throws OperationFailedException { } private static void buildTable ( TableManipulationConfigurationBuilder < ? , ? > builder , OperationContext context , ModelNode table , String defaultTableNamePrefix ) throws OperationFailedException { } private static String getColumnProperty ( OperationContext context , ModelNode table , AttributeDefinition columnResourceDefinition , AttributeDefinition columnAttribute , String defaultValue ) throws OperationFailedException { } protected class Dependency < I > { private final ServiceName name ; private final Class < I > type ; private final Injector < I > target ; Dependency ( ServiceName name ) { } Dependency ( ServiceName name , Class < I > type , Injector < I > target ) { } ServiceName getName ( ) { } public Class < I > getType ( ) { } public Injector < I > getInjector ( ) { } } }

Fix:
PathAddress address = context . getCurrentAddress ( ) ;