Buggy code:
protected static boolean matchPath ( String pattern , String str ) { } protected static boolean matchPath ( String pattern , String str , boolean isCaseSensitive ) { } public static boolean match ( String pattern , String str ) { } protected static boolean match ( String pattern , String str , boolean isCaseSensitive ) { } public static String [ ] getDefaultExcludes ( ) { } public static boolean addDefaultExclude ( String s ) { } public static boolean removeDefaultExclude ( String s ) { } public static void resetDefaultExcludes ( ) { } public void setBasedir ( String basedir ) { } public synchronized void setBasedir ( File basedir ) { } public synchronized File getBasedir ( ) { } public synchronized boolean isCaseSensitive ( ) { } public synchronized void setCaseSensitive ( boolean isCaseSensitive ) { } public void setErrorOnMissingDir ( boolean errorOnMissingDir ) { } public synchronized boolean isFollowSymlinks ( ) { } public synchronized void setFollowSymlinks ( boolean followSymlinks ) { } public void setMaxLevelsOfSymlinks ( int max ) { } public synchronized void setIncludes ( String [ ] includes ) { } public synchronized void setExcludes ( String [ ] excludes ) { } public synchronized void addExcludes ( String [ ] excludes ) { } private static String normalizePattern ( String p ) { } public synchronized void setSelectors ( FileSelector [ ] selectors ) { } public synchronized boolean isEverythingIncluded ( ) { } public void scan ( ) throws IllegalStateException { } private void checkIncludePatterns ( ) { } private boolean shouldSkipPattern ( String pattern ) { } protected synchronized void clearResults ( ) { } protected void slowScan ( ) { } private void processSlowScan ( String [ ] arr ) { } protected void scandir ( File dir , String vpath , boolean fast ) { } private void scandir ( File dir , TokenizedPath path , boolean fast ) { } private void scandir ( File dir , TokenizedPath path , boolean fast , String [ ] newfiles , LinkedList directoryNamesFollowed ) { String vpath = path . toString ( ) ; if ( ( ( vpath . length ( ) ) > 0 ) && ( ! ( vpath . endsWith ( File . separator ) ) ) ) { vpath += File . separator ; } if ( fast && ( hasBeenScanned ( vpath ) ) ) { return ; } if ( ! ( followSymlinks ) ) { ArrayList noLinks = new ArrayList ( ) ; for ( int i = 0 ; i < ( newfiles . length ) ; i ++ ) { try { if ( DirectoryScanner . SYMLINK_UTILS . isSymbolicLink ( dir , newfiles [ i ] ) ) { String name = vpath + ( newfiles [ i ] ) ; File file = new File ( dir , newfiles [ i ] ) ; ( file . isDirectory ( ) ? dirsExcluded : filesExcluded ) . addElement ( name ) ; if ( ! ( isExcluded ( name ) ) ) { notFollowedSymlinks . add ( file . getAbsolutePath ( ) ) ; } } else { noLinks . add ( newfiles [ i ] ) ; } } catch ( IOException ioe ) { String msg = "IOException<seq2seq4repair_space>caught<seq2seq4repair_space>while<seq2seq4repair_space>checking<seq2seq4repair_space>" + "for<seq2seq4repair_space>links,<seq2seq4repair_space>couldn't<seq2seq4repair_space>get<seq2seq4repair_space>canonical<seq2seq4repair_space>path!" ; System . err . println ( msg ) ; noLinks . add ( newfiles [ i ] ) ; } } newfiles = ( ( String [ ] ) ( noLinks . toArray ( new String [ noLinks . size ( ) ] ) ) ) ; } else { directoryNamesFollowed . addFirst ( dir . getName ( ) ) ; } for ( int i = 0 ; i < ( newfiles . length ) ; i ++ ) { String name = vpath + ( newfiles [ i ] ) ; TokenizedPath newPath = new TokenizedPath ( path , newfiles [ i ] ) ; File file = new File ( dir , newfiles [ i ] ) ; String [ ] children = file . list ( ) ; <START_BUG> if ( children == null ) { <END_BUG> if ( isIncluded ( newPath ) ) { accountForIncludedFile ( newPath , file ) ; } else { everythingIncluded = false ; filesNotIncluded . addElement ( name ) ; } } else { if ( ( followSymlinks ) && ( causesIllegalSymlinkLoop ( newfiles [ i ] , dir , directoryNamesFollowed ) ) ) { System . err . println ( ( ( ( "skipping<seq2seq4repair_space>symbolic<seq2seq4repair_space>link<seq2seq4repair_space>" + ( file . getAbsolutePath ( ) ) ) + "<seq2seq4repair_space>--<seq2seq4repair_space>too<seq2seq4repair_space>many<seq2seq4repair_space>levels<seq2seq4repair_space>of<seq2seq4repair_space>symbolic" ) + "<seq2seq4repair_space>links." ) ) ; notFollowedSymlinks . add ( file . getAbsolutePath ( ) ) ; continue ; } if ( isIncluded ( newPath ) ) { accountForIncludedDir ( newPath , file , fast , children , directoryNamesFollowed ) ; } else { everythingIncluded = false ; dirsNotIncluded . addElement ( name ) ; if ( ( fast && ( couldHoldIncluded ( newPath ) ) ) && ( ! ( contentsExcluded ( newPath ) ) ) ) { scandir ( file , newPath , fast , children , directoryNamesFollowed ) ; } } if ( ! fast ) { scandir ( file , newPath , fast , children , directoryNamesFollowed ) ; } } } if ( followSymlinks ) { directoryNamesFollowed . removeFirst ( ) ; } } private void accountForIncludedFile ( TokenizedPath name , File file ) { } private void accountForIncludedDir ( TokenizedPath name , File file , boolean fast ) { } private void accountForIncludedDir ( TokenizedPath name , File file , boolean fast , String [ ] children , LinkedList directoryNamesFollowed ) { } private void processIncluded ( TokenizedPath path , File file , Vector inc , Vector exc , Vector des ) { } protected boolean isIncluded ( String name ) { } private boolean isIncluded ( TokenizedPath path ) { } protected boolean couldHoldIncluded ( String name ) { }

Fix:
if ( ( children == null ) || ( file . isFile ( ) ) ) {