Buggy code:
public class WarMetaDataProcessor implements DeploymentUnitProcessor { public void deploy ( DeploymentPhaseContext phaseContext ) throws DeploymentUnitProcessingException { final DeploymentUnit deploymentUnit = phaseContext . getDeploymentUnit ( ) ; if ( ! ( DeploymentTypeMarker . isType ( WAR , deploymentUnit ) ) ) { return ; } WarMetaData warMetaData = deploymentUnit . getAttachment ( ATTACHMENT_KEY ) ; assert warMetaData != null ; List < ResourceRoot > resourceRoots = deploymentUnit . getAttachment ( RESOURCE_ROOTS ) ; assert resourceRoots != null ; WebMetaData specMetaData = warMetaData . getWebMetaData ( ) ; boolean isComplete = false ; if ( specMetaData != null ) { if ( specMetaData instanceof Web25MetaData ) { isComplete |= ( ( Web25MetaData ) ( specMetaData ) ) . isMetadataComplete ( ) ; } else if ( specMetaData instanceof Web30MetaData ) { isComplete |= ( ( Web30MetaData ) ( specMetaData ) ) . isMetadataComplete ( ) ; } else { isComplete = true ; } } LinkedList < String > order = new LinkedList < String > ( ) ; List < WarMetaDataProcessor . WebOrdering > orderings = new ArrayList < WarMetaDataProcessor . WebOrdering > ( ) ; HashSet < String > jarsSet = new HashSet < String > ( ) ; Set < VirtualFile > overlays = new HashSet < VirtualFile > ( ) ; Map < String , VirtualFile > scis = new HashMap < String , VirtualFile > ( ) ; boolean fragmentFound = false ; Map < String , WebFragmentMetaData > webFragments = warMetaData . getWebFragmentsMetaData ( ) ; for ( ResourceRoot resourceRoot : resourceRoots ) { <START_BUG> if ( resourceRoot . getRoot ( ) . getLowerCaseName ( ) . endsWith ( ".jar" ) ) { <END_BUG> jarsSet . add ( resourceRoot . getRootName ( ) ) ; VirtualFile overlay = resourceRoot . getRoot ( ) . getChild ( "META-INF//resources" ) ; if ( overlay . exists ( ) ) { overlays . add ( overlay ) ; } VirtualFile sci = resourceRoot . getRoot ( ) . getChild ( "META-INF//services//javax.servlet.ServletContainerInitializer" ) ; if ( sci . exists ( ) ) { scis . put ( resourceRoot . getRootName ( ) , sci ) ; } } } if ( ! isComplete ) { HashSet < String > jarsWithoutFragmentsSet = new HashSet < String > ( ) ; jarsWithoutFragmentsSet . addAll ( jarsSet ) ; for ( String jarName : webFragments . keySet ( ) ) { fragmentFound = true ; WebFragmentMetaData fragmentMetaData = webFragments . get ( jarName ) ; webFragments . put ( jarName , fragmentMetaData ) ; WarMetaDataProcessor . WebOrdering webOrdering = new WarMetaDataProcessor . WebOrdering ( ) ; webOrdering . setName ( fragmentMetaData . getName ( ) ) ; webOrdering . setJar ( jarName ) ; jarsWithoutFragmentsSet . remove ( jarName ) ; if ( ( fragmentMetaData . getOrdering ( ) ) != null ) { if ( ( fragmentMetaData . getOrdering ( ) . getAfter ( ) ) != null ) { for ( OrderingElementMetaData orderingElementMetaData : fragmentMetaData . getOrdering ( ) . getAfter ( ) . getOrdering ( ) ) { if ( orderingElementMetaData . isOthers ( ) ) { webOrdering . setAfterOthers ( true ) ; } else { webOrdering . addAfter ( orderingElementMetaData . getName ( ) ) ; } } } if ( ( fragmentMetaData . getOrdering ( ) . getBefore ( ) ) != null ) { for ( OrderingElementMetaData orderingElementMetaData : fragmentMetaData . getOrdering ( ) . getBefore ( ) . getOrdering ( ) ) { if ( orderingElementMetaData . isOthers ( ) ) { webOrdering . setBeforeOthers ( true ) ; } else { webOrdering . addBefore ( orderingElementMetaData . getName ( ) ) ; } } } } orderings . add ( webOrdering ) ; } for ( String jarName : jarsWithoutFragmentsSet ) { WarMetaDataProcessor . WebOrdering ordering = new WarMetaDataProcessor . WebOrdering ( ) ; ordering . setJar ( jarName ) ; orderings . add ( ordering ) ; } } if ( ! fragmentFound ) { orderings . clear ( ) ; } AbsoluteOrderingMetaData absoluteOrderingMetaData = null ; if ( ( ! isComplete ) && ( specMetaData instanceof Web30MetaData ) ) { absoluteOrderingMetaData = ( ( Web30MetaData ) ( specMetaData ) ) . getAbsoluteOrdering ( ) ; } if ( absoluteOrderingMetaData != null ) { int otherPos = - 1 ; int i = 0 ; for ( OrderingElementMetaData orderingElementMetaData : absoluteOrderingMetaData . getOrdering ( ) ) { if ( orderingElementMetaData . isOthers ( ) ) { if ( otherPos >= 0 ) { throw new DeploymentUnitProcessingException ( WebMessages . MESSAGES . invalidMultipleOthers ( ) ) ; } otherPos = i ; } else { boolean found = false ; for ( WarMetaDataProcessor . WebOrdering ordering : orderings ) { if ( orderingElementMetaData . getName ( ) . equals ( ordering . getName ( ) ) ) { order . add ( ordering . getJar ( ) ) ; jarsSet . remove ( ordering . getJar ( ) ) ; found = true ; break ; } } if ( ! found ) throw new DeploymentUnitProcessingException ( WebMessages . MESSAGES . invalidAbsoluteOrdering ( orderingElementMetaData . getName ( ) ) ) ; } i ++ ; } if ( otherPos >= 0 ) { order . addAll ( otherPos , jarsSet ) ; jarsSet . clear ( ) ; } } else if ( ( orderings . size ( ) ) > 0 ) { try { WarMetaDataProcessor . resolveOrder ( orderings , order ) ; } catch ( IllegalStateException e ) { throw new DeploymentUnitProcessingException ( WebMessages . MESSAGES . invalidRelativeOrdering ( ) , e ) ; } jarsSet . clear ( ) ; } else { order . addAll ( jarsSet ) ; jarsSet . clear ( ) ; warMetaData . setNoOrder ( true ) ; } Logger log = Logger . getLogger ( "org.jboss.web" ) ; if ( log . isDebugEnabled ( ) ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( "Resolved<seq2seq4repair_space>order:<seq2seq4repair_space>[<seq2seq4repair_space>" ) ;

Fix:
if ( resourceRoot . getRoot ( ) . getName ( ) . toLowerCase ( ) . endsWith ( ".jar" ) ) {