Buggy code:
public class UndertowService implements Service < UndertowService > { public static final ServiceName UNDERTOW = JBOSS . append ( "undertow" ) ; public static final ServiceName SERVLET_CONTAINER = UndertowService . UNDERTOW . append ( Constants . SERVLET_CONTAINER ) ; public static final ServiceName SERVER = UndertowService . UNDERTOW . append ( Constants . SERVER ) ; public static final ServiceName HANDLER = UndertowService . UNDERTOW . append ( Constants . HANDLER ) ; public static final ServiceName FILTER = UndertowService . UNDERTOW . append ( Constants . FILTER ) ; static final ServiceName WEB_DEPLOYMENT_BASE = UndertowService . UNDERTOW . append ( "deployment" ) ; private final String defaultContainer ; private final String defaultServer ; private final String defaultVirtualHost ; private final Set < Server > registeredServers = new CopyOnWriteArraySet < > ( ) ; private final List < UndertowEventListener > listeners = Collections . synchronizedList ( new LinkedList < UndertowEventListener > ( ) ) ; private volatile String instanceId ; private final boolean statistics ; protected UndertowService ( String defaultContainer , String defaultServer , String defaultVirtualHost , String instanceId , boolean statistics ) { } public static ServiceName deploymentServiceName ( final String serverName , final String virtualHost , final String contextPath ) { } public static ServiceName virtualHostName ( final String server , final String virtualHost ) { } public static ServiceName locationServiceName ( final String server , final String virtualHost , final String locationName ) { } public static ServiceName accessLogServiceName ( final String server , final String virtualHost ) { } public static ServiceName consoleRedirectServiceName ( final String server , final String virtualHost ) { } public static ServiceName filterRefName ( final String server , final String virtualHost , final String locationName , final String filterName ) { } public static ServiceName filterRefName ( final String server , final String virtualHost , final String filterName ) { } public static ServiceName getFilterRefServiceName ( final PathAddress address , String name ) { final PathAddress oneUp = address . subAddress ( 0 , ( ( address . size ( ) ) - 1 ) ) ; final PathAddress twoUp = oneUp . subAddress ( 0 , ( ( oneUp . size ( ) ) - 1 ) ) ; final PathAddress threeUp = twoUp . subAddress ( 0 , ( ( twoUp . size ( ) ) - 1 ) ) ; ServiceName serviceName ; if ( address . getLastElement ( ) . getKey ( ) . equals ( FILTER_REF ) ) { if ( oneUp . getLastElement ( ) . getKey ( ) . equals ( HOST ) ) { String host = oneUp . getLastElement ( ) . getValue ( ) ; String server = twoUp . getLastElement ( ) . getValue ( ) ; serviceName = UndertowService . filterRefName ( server , host , name ) ; } else { String location = oneUp . getLastElement ( ) . getValue ( ) ; String host = twoUp . getLastElement ( ) . getValue ( ) ; String server = threeUp . getLastElement ( ) . getValue ( ) ; serviceName = UndertowService . filterRefName ( server , host , location , name ) ; } } else if ( address . getLastElement ( ) . getKey ( ) . equals ( HOST ) ) { String host = address . getLastElement ( ) . getValue ( ) ; <START_BUG> String server = oneUp . getLastElement ( ) . getValue ( ) ; <END_BUG> serviceName = UndertowService . filterRefName ( server , host , name ) ; } else { String location = address . getLastElement ( ) . getValue ( ) ; String host = oneUp . getLastElement ( ) . getValue ( ) ; String server = twoUp . getLastElement ( ) . getValue ( ) ; serviceName = UndertowService . filterRefName ( server , host , location , name ) ; } return serviceName ; } public static ServiceName listenerName ( String listenerName ) { } @ Override public void start ( StartContext context ) throws StartException { } @ Override public void stop ( StopContext context ) { } @ Override public UndertowService getValue ( ) throws IllegalArgumentException , IllegalStateException { } protected void registerServer ( final Server server ) { } protected void unregisterServer ( final Server server ) { } public String getDefaultContainer ( ) { } public String getDefaultServer ( ) { } public String getDefaultVirtualHost ( ) { } public Set < Server > getServers ( ) { } public String getInstanceId ( ) { } public void setInstanceId ( String instanceId ) { } public boolean statisticsEnabled ( ) { } public void registerListener ( UndertowEventListener listener ) { } public void unregisterListener ( UndertowEventListener listener ) { } protected void fireEvent ( EventInvoker invoker ) { } }

Fix:
String server = twoUp . getLastElement ( ) . getValue ( ) ;