Buggy code:
public class WarMetaDataProcessor implements DeploymentUnitProcessor { public static final long PRIORITY = INSTALL_SERVICES . plus ( 100L ) ; public void processDeployment ( DeploymentUnitContext context ) throws DeploymentUnitProcessingException { WarMetaData warMetaData = context . getAttachment ( ATTACHMENT_KEY ) ; assert warMetaData != null ; DeploymentStructure structure = context . getAttachment ( DeploymentStructure . ATTACHMENT_KEY ) ; assert structure != null ; assert ( structure . getEntries ( ) ) != 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 ( DeploymentStructure . ClassPathEntry resourceRoot : structure . getEntries ( ) ) { <START_BUG> if ( resourceRoot . getRoot ( ) . isFile ( ) ) { <END_BUG> jarsSet . add ( resourceRoot . getName ( ) ) ; 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 . getName ( ) , 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 ( "Duplicate<seq2seq4repair_space>others<seq2seq4repair_space>in<seq2seq4repair_space>absolute<seq2seq4repair_space>ordering" ) ; } 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 ( ( "Could<seq2seq4repair_space>not<seq2seq4repair_space>resolve<seq2seq4repair_space>name<seq2seq4repair_space>in<seq2seq4repair_space>absolute<seq2seq4repair_space>ordering:<seq2seq4repair_space>" + ( 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 ( "Invalid<seq2seq4repair_space>ordering" , 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 ( ) . getLowerCaseName ( ) . endsWith ( ".jar" ) ) {