Buggy code:
@ Alias ( "spring" ) @ Topic ( "Web<seq2seq4repair_space>Application<seq2seq4repair_space>Setup" ) @ Help ( "Spring<seq2seq4repair_space>MVC<seq2seq4repair_space>applications" ) @ RequiresProject @ RequiresFacet ( { DependencyFacet . class , PackagingFacet . class , ResourceFacet . class , WebResourceFacet . class , MetadataFacet . class , PersistenceFacet . class , JavaSourceFacet . class } ) public class SpringPlugin implements Plugin { public static final String DEFAULT_UNIT_NAME = "forge-default" ; @ Inject private Project project ; @ Inject private Event < InstallFacets > install ; private static final String XMLNS_PREFIX = "xmlns:" ; @ SetupCommand public void setup ( PipeOut out ) { DependencyFacet deps = project . getFacet ( DependencyFacet . class ) ; MetadataFacet meta = project . getFacet ( MetadataFacet . class ) ; PackagingFacet packaging = project . getFacet ( PackagingFacet . class ) ; ResourceFacet resources = project . getFacet ( ResourceFacet . class ) ; if ( ( packaging . getPackagingType ( ) ) != ( PackagingType . WAR ) ) { packaging . setPackagingType ( WAR ) ; this . install . fire ( new InstallFacets ( WebResourceFacet . class ) ) ; } WebResourceFacet web = project . getFacet ( WebResourceFacet . class ) ; String springVersion = "3.1.0.RC1" ; deps . setProperty ( "spring.version" , springVersion ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-asm:${spring.version}" ) ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-beans:${spring.version}" ) ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-context:${spring.version}" ) ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-context-support:${spring.version}" ) ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-core:${spring.version}" ) ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-expression:${spring.version}" ) ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-web:${spring.version}" ) ) ; deps . addDirectDependency ( DependencyBuilder . create ( "org.springframework:spring-webmvc:${spring.version}" ) ) ; out . println ( ( ( "Added<seq2seq4repair_space>Spring<seq2seq4repair_space>" + springVersion ) + "<seq2seq4repair_space>dependencies<seq2seq4repair_space>to<seq2seq4repair_space>pom.xml." ) ) ; Node beans = new Node ( "beans" ) ; beans . attribute ( "xmlns" , "http:////www.springframework.org//schema//beans" ) ; beans . attribute ( ( ( SpringPlugin . XMLNS_PREFIX ) + "xsi" ) , "http:////www.w3.org//2001//XMLSchema-instance" ) ; String schemaLoc = "http:////www.springframework.org//schema//beans<seq2seq4repair_space>http:////www.springframework.org//schema//beans//spring-beans.xsd" ; beans . attribute ( "xsi:schemaLocation" , schemaLoc ) ; String file = XMLParser . toXMLString ( beans ) ; resources . createResource ( file . toCharArray ( ) , "META-INF//spring//applicationContext.xml" ) ; Node webapp = new Node ( "web-app" ) ; webapp . attribute ( "version" , "3.0" ) ; webapp . attribute ( "xmlns" , "http:////java.sun.com//xml//ns//javaee" ) ; webapp . attribute ( "xmlns:xsi" , "http:////www.w3.org//2001//XMLSchema-instance" ) ; webapp . attribute ( "xsi:schemaLocation" , "http:////java.sun.com//xml//ns//javaee<seq2seq4repair_space>http:////java.sun.com//xml//ns//javaee//web-app_3_0.xsd" ) ; webapp . attribute ( "metadata-complete" , "true" ) ; if ( webapp . get ( "display-name" ) . isEmpty ( ) ) { Node display = webapp . createChild ( "display-name" ) ; display . text ( meta . getProjectName ( ) ) ; } <START_BUG> if ( webapp . getChildren ( ) . isEmpty ( ) ) { <END_BUG> Node contextParam = new Node ( "context-param" , webapp ) ; Node contextConfig = new Node ( "param-name" , contextParam ) ; contextConfig . text ( "contextConfigLocation" ) ; Node configLocation = new Node ( "param-value" , contextConfig ) ; configLocation . text ( "classpath://META-INF//spring//applicationContext.xml" ) ; } if ( webapp . get ( "listener" ) . isEmpty ( ) ) { Node listener = new Node ( "listener" , webapp ) ; Node cll = new Node ( "listener-class" , listener ) ; cll . text ( "org.springframework.web.context.ContextLoaderListener" ) ; } file = XMLParser . toXMLString ( webapp ) ; web . createWebResource ( file . toCharArray ( ) , "WEB-INF//web.xml" ) ; } @ Command ( "persistence" ) public void springPersistence ( PipeOut out ) { } @ DefaultCommand @ Command ( "help" ) public void help ( PipeOut out ) { } No newline ; at end ; of file ; }

Fix:
if ( webapp . get ( "context-param" ) . isEmpty ( ) ) {