Buggy code:
class ConfigurationAssembler { private final File baseDir ; private final File templateFile ; private final String templateRootElementName ; private final File subsystemsFile ; private final File outputFile ; public ConfigurationAssembler ( File baseDir , File templateFile , String templateRootElementName , File subsystemsFile , File outputFile ) { } public void assemble ( ) throws IOException , XMLStreamException { } private void populateTemplate ( TemplateParser templateParser , SubsystemsParser subsystemsParser ) throws IOException , XMLStreamException { final Set < String > extensions = new TreeSet < String > ( ) ; final Map < String , Map < String , ElementNode > > socketBindingsByGroup = new HashMap < String , Map < String , ElementNode > > ( ) ; final Map < String , Map < String , ElementNode > > outboundSocketBindingsByGroup = new HashMap < String , Map < String , ElementNode > > ( ) ; for ( Map . Entry < String , ProcessingInstructionNode > subsystemEntry : templateParser . getSubsystemPlaceholders ( ) . entrySet ( ) ) { final String subsystemName = subsystemEntry . getKey ( ) ; final String groupName = subsystemEntry . getValue ( ) . getDataValue ( "socket-binding-group" , "" ) ; final SubsystemConfig [ ] subsystems = subsystemsParser . getSubsystemConfigs ( ) . get ( subsystemName ) ; if ( subsystems == null ) { throw new IllegalStateException ( ( ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>find<seq2seq4repair_space>a<seq2seq4repair_space>subsystems<seq2seq4repair_space>configuration<seq2seq4repair_space>called<seq2seq4repair_space>'" + ( subsystemEntry . getKey ( ) ) ) + "'<seq2seq4repair_space>in<seq2seq4repair_space>" ) + ( subsystemsFile ) ) ) ; } final Map < String , ElementNode > socketBindings = new TreeMap < String , ElementNode > ( ) ; if ( ( socketBindingsByGroup . put ( groupName , socketBindings ) ) != null ) { throw new IllegalStateException ( ( ( "Group<seq2seq4repair_space>'" + groupName ) + "'<seq2seq4repair_space>already<seq2seq4repair_space>exists" ) ) ; } final Map < String , ElementNode > outboundSocketBindings = new TreeMap < String , ElementNode > ( ) ; outboundSocketBindingsByGroup . put ( groupName , outboundSocketBindings ) ; for ( SubsystemConfig subsystem : subsystems ) { <START_BUG> final File subsystemFile = new File ( baseDir , subsystem . getSubsystemFile ( ) ) ; <END_BUG> if ( ! ( subsystemFile . exists ( ) ) ) { throw new IllegalStateException ( ( ( ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>find<seq2seq4repair_space>'" + subsystem ) + "'<seq2seq4repair_space>under<seq2seq4repair_space>the<seq2seq4repair_space>base<seq2seq4repair_space>directory<seq2seq4repair_space>'" ) + ( baseDir ) ) + "'" ) ) ; } final SubsystemParser subsystemParser = new SubsystemParser ( templateParser . getRootNode ( ) . getNamespace ( ) , subsystem . getSupplement ( ) , subsystemFile ) ; subsystemParser . parse ( ) ; subsystemEntry . getValue ( ) . addDelegate ( subsystemParser . getSubsystem ( ) ) ; extensions . add ( subsystemParser . getExtensionModule ( ) ) ; for ( Map . Entry < String , ElementNode > entry : subsystemParser . getSocketBindings ( ) . entrySet ( ) ) { if ( socketBindings . containsKey ( entry . getKey ( ) ) ) { throw new IllegalStateException ( ( ( "SocketBinding<seq2seq4repair_space>'" + entry ) + "'<seq2seq4repair_space>already<seq2seq4repair_space>exists" ) ) ; } socketBindings . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } for ( Map . Entry < String , ElementNode > entry : subsystemParser . getOutboundSocketBindings ( ) . entrySet ( ) ) { if ( outboundSocketBindings . containsKey ( entry . getKey ( ) ) ) { throw new IllegalStateException ( ( ( "Outbound<seq2seq4repair_space>SocketBinding<seq2seq4repair_space>'" + entry ) + "'<seq2seq4repair_space>already<seq2seq4repair_space>exists" ) ) ; } outboundSocketBindings . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } } if ( ( extensions . size ( ) ) > 0 ) { final ProcessingInstructionNode extensionNode = templateParser . getExtensionPlaceHolder ( ) ; for ( String extension : extensions ) { final ElementNode extensionElement = new ElementNode ( null , "extension" , templateParser . getRootNode ( ) . getNamespace ( ) ) ; extensionElement . addAttribute ( "module" , new AttributeValue ( extension ) ) ; extensionNode . addDelegate ( extensionElement ) ; } } else { for ( Iterator < Node > it = templateParser . getRootNode ( ) . iterateChildren ( ) ; it . hasNext ( ) ; ) { Node node = it . next ( ) ; if ( node instanceof ElementNode ) { ElementNode elementNode = ( ( ElementNode ) ( node ) ) ; if ( ( elementNode . getName ( ) . equals ( "extensions" ) ) || ( elementNode . getName ( ) . equals ( "profile" ) ) ) { it . remove ( ) ; } } } } if ( ( ( socketBindingsByGroup . size ( ) ) > 0 ) && ( ( outboundSocketBindingsByGroup . size ( ) ) > 0 ) ) { for ( Map . Entry < String , ProcessingInstructionNode > entry : templateParser . getSocketBindingsPlaceHolders ( ) . entrySet ( ) ) { Map < String , ElementNode > socketBindings = socketBindingsByGroup . get ( entry . getKey ( ) ) ; if ( socketBindings == null ) { throw new IllegalArgumentException ( ( "No<seq2seq4repair_space>socket<seq2seq4repair_space>bindings<seq2seq4repair_space>for<seq2seq4repair_space>group<seq2seq4repair_space>" + ( entry . getKey ( ) ) ) ) ; } if ( ( socketBindings . size ( ) ) > 0 ) { for ( ElementNode binding : socketBindings . values ( ) ) { entry . getValue ( ) . addDelegate ( binding ) ; } } } for ( Map . Entry < String , ProcessingInstructionNode > entry : templateParser . getSocketBindingsPlaceHolders ( ) . entrySet ( ) ) { Map < String , ElementNode > outboundSocketBindings = outboundSocketBindingsByGroup . get ( entry . getKey ( ) ) ; if ( outboundSocketBindings == null ) { throw new IllegalArgumentException ( ( "No<seq2seq4repair_space>outbound<seq2seq4repair_space>socket<seq2seq4repair_space>bindings<seq2seq4repair_space>for<seq2seq4repair_space>group<seq2seq4repair_space>" + ( entry . getKey ( ) ) ) ) ; } if ( ( outboundSocketBindings . size ( ) ) > 0 ) { for ( ElementNode binding : outboundSocketBindings . values ( ) ) { entry . getValue ( ) . addDelegate ( binding ) ;

Fix:
final File subsystemFile = new File ( baseDir , subsystem . getSubsystem ( ) ) ;