Buggy code:
public class EmbeddedStandAloneServerFactory { public static final String JBOSS_EMBEDDED_ROOT = "jboss.embedded.root" ; private EmbeddedStandAloneServerFactory ( ) { } public static StandaloneServer create ( final File jbossHomeDir , final ModuleLoader moduleLoader , final Properties systemProps , final Map < String , String > systemEnv ) { EmbeddedStandAloneServerFactory . setupCleanDirectories ( jbossHomeDir , systemProps ) ; StandaloneServer standaloneServer = new StandaloneServer ( ) { private ServiceContainer serviceContainer ; private ServerDeploymentManager serverDeploymentManager ; private Context context ; private ModelControllerClient modelControllerClient ; @ Override public void deploy ( File file ) throws IOException , InterruptedException , ExecutionException { final InputStream is = VFSUtils . createJarFileInputStream ( VFS . getChild ( file . toURI ( ) ) ) ; try { execute ( serverDeploymentManager . newDeploymentPlan ( ) . add ( file . getName ( ) , is ) . andDeploy ( ) . build ( ) ) ; } finally { if ( is != null ) try { is . close ( ) ; } catch ( IOException ignore ) { } } } private ServerDeploymentPlanResult execute ( DeploymentPlan deploymentPlan ) throws InterruptedException , ExecutionException { return serverDeploymentManager . execute ( deploymentPlan ) . get ( ) ; } @ Override public Context getContext ( ) { return EmbeddedStandAloneServerFactory . ifSet ( context , "Server<seq2seq4repair_space>has<seq2seq4repair_space>not<seq2seq4repair_space>been<seq2seq4repair_space>started" ) ; } @ Override public ModelControllerClient getModelControllerClient ( ) { return modelControllerClient ; } @ Override public void start ( ) throws ServerStartException { try { ServerEnvironment serverEnvironment = Main . determineEnvironment ( new String [ 0 ] , systemProps , systemEnv , EMBEDDED ) ; Bootstrap bootstrap = Factory . newInstance ( ) ; Bootstrap . Configuration configuration = new Bootstrap . Configuration ( serverEnvironment ) ; final ExtensionRegistry extensionRegistry = configuration . getExtensionRegistry ( ) ; final Bootstrap . ConfigurationPersisterFactory configurationPersisterFactory = new Bootstrap . ConfigurationPersisterFactory ( ) { @ Override public ExtensibleConfigurationPersister createConfigurationPersister ( ServerEnvironment serverEnvironment , ExecutorService executorService ) { final QName rootElement = new QName ( CURRENT . getUriString ( ) , "server" ) ; final StandaloneXml parser = new StandaloneXml ( Module . getBootModuleLoader ( ) , executorService , extensionRegistry ) ; TransientConfigurationPersister persister = new TransientConfigurationPersister ( serverEnvironment . getServerConfigurationFile ( ) , rootElement , parser , parser ) ; <START_BUG> for ( Namespace namespace : Namespace . values ( ) ) { <END_BUG> if ( ! ( namespace . equals ( CURRENT ) ) ) { persister . registerAdditionalRootElement ( new QName ( namespace . getUriString ( ) , "server" ) , parser ) ; } } extensionRegistry . setWriterRegistry ( persister ) ; return persister ; } } ; configuration . setConfigurationPersisterFactory ( configurationPersisterFactory ) ; configuration . setModuleLoader ( moduleLoader ) ; Future < ServiceContainer > future = bootstrap . startup ( configuration , Collections . < ServiceActivator > emptyList ( ) ) ; serviceContainer = future . get ( ) ; final Value < ModelController > controllerService = ( ( Value < ModelController > ) ( serviceContainer . getRequiredService ( JBOSS_SERVER_CONTROLLER ) ) ) ; final ModelController controller = controllerService . getValue ( ) ; serverDeploymentManager = new org . jboss . as . server . deployment . client . ModelControllerServerDeploymentManager ( controller ) ; modelControllerClient = controller . createClient ( Executors . newCachedThreadPool ( ) ) ; context = new InitialContext ( ) ; } catch ( RuntimeException rte ) { throw rte ; } catch ( Exception ex ) { throw new ServerStartException ( ex ) ; } } @ Override public void stop ( ) { if ( ( context ) != null ) { try { context . close ( ) ; context = null ; } catch ( NamingException e ) { e . printStackTrace ( ) ; } } serverDeploymentManager = null ; if ( ( serviceContainer ) != null ) { try { serviceContainer . shutdown ( ) ; serviceContainer . awaitTermination ( ) ; } catch ( RuntimeException rte ) { throw rte ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } } @ Override public void undeploy ( File file ) throws InterruptedException , ExecutionException { execute ( serverDeploymentManager . newDeploymentPlan ( ) . undeploy ( file . getName ( ) ) . andRemoveUndeployed ( ) . build ( ) ) ; } } ; return standaloneServer ; } private static < T > T ifSet ( T value , String message ) { } public static void setupCleanDirectories ( Properties props ) { } static void setupCleanDirectories ( File jbossHomeDir , Properties props ) { } private static File getFileUnderAsRoot ( File jbossHomeDir , Properties props , String propName , String relativeLocation , boolean mustExist ) { } private static File getTempRoot ( Properties props ) { } private static void validateDirectory ( String property , File file ) { } private static void copyDirectory ( File src , File dest ) { } }

Fix:
for ( Namespace namespace : Namespace . domainValues ( ) ) {