Buggy code:
public class FilenameUtils { private static final char EXTENSION_SEPARATOR = '.' ; private static final char UNIX_SEPARATOR = '//' ; private static final char WINDOWS_SEPARATOR = '\\' ; private static final char SYSTEM_SEPARATOR = File . separatorChar ; private static final char OTHER_SEPARATOR ; public FilenameUtils ( ) { } static boolean isSystemWindows ( ) { } private static boolean isSeparator ( char ch ) { } public static String normalize ( String filename ) { } public static String normalizeNoEndSeparator ( String filename ) { } private static String doNormalize ( String filename , boolean keepSeparator ) { } public static String concat ( String basePath , String fullFilenameToAdd ) { } public static String separatorsToUnix ( String path ) { } public static String separatorsToWindows ( String path ) { } public static String separatorsToSystem ( String path ) { } public static int getPrefixLength ( String filename ) { } public static int indexOfLastSeparator ( String filename ) { } public static int indexOfExtension ( String filename ) { } public static String getPrefix ( String filename ) { } public static String getPath ( String filename ) { } public static String getPathNoEndSeparator ( String filename ) { } private static String doGetPath ( String filename , int separatorAdd ) { } public static String getFullPath ( String filename ) { } public static String getFullPathNoEndSeparator ( String filename ) { } private static String doGetFullPath ( String filename , boolean includeSeparator ) { } public static String getName ( String filename ) { } public static String getBaseName ( String filename ) { } public static String getExtension ( String filename ) { } public static String removeExtension ( String filename ) { } public static boolean equals ( String filename1 , String filename2 ) { } public static boolean equalsOnSystem ( String filename1 , String filename2 ) { } public static boolean equalsNormalized ( String filename1 , String filename2 ) { } public static boolean equalsNormalizedOnSystem ( String filename1 , String filename2 ) { } public static boolean equals ( String filename1 , String filename2 , boolean normalized , IOCase caseSensitivity ) { } public static boolean isExtension ( String filename , String extension ) { } public static boolean isExtension ( String filename , String [ ] extensions ) { } public static boolean isExtension ( String filename , Collection extensions ) { } public static boolean wildcardMatch ( String filename , String wildcardMatcher ) { } public static boolean wildcardMatchOnSystem ( String filename , String wildcardMatcher ) { } public static boolean wildcardMatch ( String filename , String wildcardMatcher , IOCase caseSensitivity ) { } static String [ ] splitOnTokens ( String text ) { if ( ( ( text . indexOf ( "?" ) ) == ( - 1 ) ) && ( ( text . indexOf ( "*" ) ) == ( - 1 ) ) ) { return new String [ ] { text } ; } char [ ] array = text . toCharArray ( ) ; ArrayList list = new ArrayList ( ) ; StringBuffer buffer = new StringBuffer ( ) ; for ( int i = 0 ; i < ( array . length ) ; i ++ ) { if ( ( ( array [ i ] ) == '?' ) || ( ( array [ i ] ) == '*' ) ) { if ( ( buffer . length ( ) ) != 0 ) { list . add ( buffer . toString ( ) ) ; buffer . setLength ( 0 ) ; } if ( ( array [ i ] ) == '?' ) { list . add ( "?" ) ; } else if ( ( ( list . size ( ) ) == 0 ) || ( ( i > 0 ) && ( ( list . get ( ( ( list . size ( ) ) - 1 ) ) . equals ( "*" ) ) == false ) ) ) { list . add ( "*" ) ; } } else { buffer . append ( array [ i ] ) ; } } if ( ( buffer . length ( ) ) != 0 ) { list . add ( buffer . toString ( ) ) ; } <START_BUG> return ( ( String [ ] ) ( list . toArray ( new String [ 0 ] ) ) ) ; <END_BUG> } }

Fix:
return ( ( String [ ] ) ( list . toArray ( new String [ list . size ( ) ] ) ) ) ;