Buggy code:
public abstract class AbstractCFMetaDataFactory extends AbstractMetaDataFactory { private static final Localizer _loc = Localizer . forPackage ( AbstractMetaDataFactory . class ) ; protected Collection files = null ; protected Collection urls = null ; protected Collection rsrcs = null ; protected Collection cpath = null ; private Set _typeNames = null ; public void setFiles ( Collection files ) { } public void setFiles ( String files ) { } public void setURLs ( Collection urls ) { } public void setURLs ( String urls ) { } public void setResources ( Collection rsrcs ) { } public void setResources ( String rsrcs ) { } public void setClasspathScan ( Collection cpath ) { } public void setClasspathScan ( String cpath ) { } public boolean store ( ClassMetaData [ ] metas , QueryMetaData [ ] queries , SequenceMetaData [ ] seqs , int mode , Map output ) { } public boolean drop ( Class [ ] cls , int mode , ClassLoader envLoader ) { } private Set assignDefaultMetaDataFiles ( ClassMetaData [ ] metas , QueryMetaData [ ] queries , SequenceMetaData [ ] seqs , int mode , Map clsNames ) { } private Set assignDefaultQueryFiles ( QueryMetaData [ ] queries , Map clsNames ) { } protected boolean isMappingOnlyFactory ( ) { } protected void parse ( MetaDataParser parser , Collection files ) { } protected void parse ( MetaDataParser parser , Class [ ] cls ) { } protected boolean isParseTopDown ( ) { } protected void serialize ( MetaDataSerializer ser , Map output , int flags ) { } protected void backupAndDelete ( Collection files ) { } protected void clearMapping ( ClassMetaData meta ) { } protected File getSourceFile ( ClassMetaData meta ) { } protected void setSourceFile ( ClassMetaData meta , File sourceFile ) { } protected File getSourceFile ( SequenceMetaData meta ) { } protected void setSourceFile ( SequenceMetaData meta , File sourceFile ) { } protected abstract File defaultSourceFile ( ClassMetaData meta ) { } protected abstract File defaultSourceFile ( QueryMetaData query , Map clsNames ) { } protected abstract File defaultSourceFile ( SequenceMetaData seq , Map clsNames ) { } protected abstract AbstractCFMetaDataFactory . Parser newParser ( boolean loading ) { } protected abstract AbstractCFMetaDataFactory . Serializer newSerializer ( ) { } protected ClassMetaData getDefiningMetaData ( QueryMetaData query , Map clsNames ) { } public Set getPersistentTypeNames ( boolean devpath , ClassLoader envLoader ) { } private Set parsePersistentTypeNames ( ClassLoader loader ) throws IOException { ClassArgParser cparser = newClassArgParser ( ) ; String [ ] clss ; Set names = new HashSet ( ) ; if ( ( files ) != null ) { File file ; for ( Iterator itr = files . iterator ( ) ; itr . hasNext ( ) ; ) { file = ( ( File ) ( itr . next ( ) ) ) ; if ( file . isDirectory ( ) ) { if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scanning-directory" , file ) ) ; <START_BUG> scan ( new FileMetaDataIterator ( dir , newMetaDataFilter ( ) ) , cparser , names , true , file ) ; <END_BUG> } else if ( file . getName ( ) . endsWith ( ".jar" ) ) { if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scanning-jar" , file ) ) ; scan ( new org . apache . openjpa . lib . meta . ZipFileMetaDataIterator ( new ZipFile ( file ) , newMetaDataFilter ( ) ) , cparser , names , true , file ) ; } else { if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scanning-file" , file ) ) ; clss = cparser . parseTypeNames ( new FileMetaDataIterator ( file ) ) ; if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scan-found-names" , clss , file ) ) ; names . addAll ( Arrays . asList ( clss ) ) ; mapPersistentTypeNames ( file . getAbsoluteFile ( ) . toURL ( ) , clss ) ; } } } URL url ; if ( ( urls ) != null ) { for ( Iterator itr = urls . iterator ( ) ; itr . hasNext ( ) ; ) { url = ( ( URL ) ( itr . next ( ) ) ) ; if ( ( "jar" . equals ( url . getProtocol ( ) ) ) && ( url . getPath ( ) . endsWith ( "!//" ) ) ) { if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scanning-jar-url" , url ) ) ; scan ( new org . apache . openjpa . lib . meta . ZipFileMetaDataIterator ( url , newMetaDataFilter ( ) ) , cparser , names , true , url ) ; } else if ( url . getPath ( ) . endsWith ( ".jar" ) ) { if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scanning-jar-at-url" , url ) ) ; scan ( new org . apache . openjpa . lib . meta . ZipStreamMetaDataIterator ( new ZipInputStream ( url . openStream ( ) ) , newMetaDataFilter ( ) ) , cparser , names , true , url ) ; } else { if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scanning-url" , url ) ) ; clss = cparser . parseTypeNames ( new URLMetaDataIterator ( url ) ) ; if ( log . isTraceEnabled ( ) ) log . trace ( AbstractCFMetaDataFactory . _loc . get ( "scan-found-names" , clss , url ) ) ; names . addAll ( Arrays . asList ( clss ) ) ;

Fix:
scan ( new FileMetaDataIterator ( file , newMetaDataFilter ( ) ) , cparser , names , true , file ) ;