Buggy code:
public class PathConvert extends Task { private static boolean onWindows = Os . isFamily ( "dos" ) ; private Union path = null ; private Reference refid = null ; private String targetOS = null ; private boolean targetWindows = false ; private boolean setonempty = true ; private String property = null ; private Vector prefixMap = new Vector ( ) ; private String pathSep = null ; private String dirSep = null ; private Mapper mapper = null ; public PathConvert ( ) { } public class MapEntry { private String from = null ; private String to = null ; public void setFrom ( String from ) { } public void setTo ( String to ) { } public String apply ( String elem ) { } } public static class TargetOs extends EnumeratedAttribute { public String [ ] getValues ( ) { } } public Path createPath ( ) { } public void add ( ResourceCollection rc ) { } private synchronized Union getPath ( ) { } public PathConvert . MapEntry createMap ( ) { } public void setTargetos ( String target ) { } public void setTargetos ( PathConvert . TargetOs target ) { } public void setSetonempty ( boolean setonempty ) { } public void setProperty ( String p ) { } public void setRefid ( Reference r ) { } public void setPathSep ( String sep ) { } public void setDirSep ( String sep ) { } public boolean isReference ( ) { } public void execute ( ) throws BuildException { Union savedPath = path ; String savedPathSep = pathSep ; String savedDirSep = dirSep ; try { if ( isReference ( ) ) { Object o = refid . getReferencedObject ( getProject ( ) ) ; if ( ! ( o instanceof ResourceCollection ) ) { throw new BuildException ( ( ( "refid<seq2seq4repair_space>'" + ( refid . getRefId ( ) ) ) + "'<seq2seq4repair_space>does<seq2seq4repair_space>not<seq2seq4repair_space>refer<seq2seq4repair_space>to<seq2seq4repair_space>a<seq2seq4repair_space>resource<seq2seq4repair_space>collection." ) ) ; } getPath ( ) . add ( ( ( ResourceCollection ) ( o ) ) ) ; } validateSetup ( ) ; String fromDirSep = ( PathConvert . onWindows ) ? "\\" : "//" ; StringBuffer rslt = new StringBuffer ( ) ; String [ ] elems = path . list ( ) ; if ( ( mapper ) != null ) { FileNameMapper impl = mapper . getImplementation ( ) ; List ret = new ArrayList ( ) ; for ( int i = 0 ; i < ( elems . length ) ; ++ i ) { String [ ] mapped = impl . mapFileName ( elems [ i ] ) ; for ( int m = 0 ; ( mapped != null ) && ( m < ( mapped . length ) ) ; ++ m ) { ret . add ( mapped [ m ] ) ; } } <START_BUG> elems = ( ( String [ ] ) ( ret . toArray ( new String [ ] { } ) ) ) ; <END_BUG> } for ( int i = 0 ; i < ( elems . length ) ; i ++ ) { String elem = mapElement ( elems [ i ] ) ; if ( i != 0 ) { rslt . append ( pathSep ) ; } StringTokenizer stDirectory = new StringTokenizer ( elem , fromDirSep , true ) ; while ( stDirectory . hasMoreTokens ( ) ) { String token = stDirectory . nextToken ( ) ; rslt . append ( ( fromDirSep . equals ( token ) ? dirSep : token ) ) ; } } if ( ( setonempty ) || ( ( rslt . length ( ) ) > 0 ) ) { String value = rslt . toString ( ) ; if ( ( property ) == null ) { log ( value ) ; } else { log ( ( ( ( "Set<seq2seq4repair_space>property<seq2seq4repair_space>" + ( property ) ) + "<seq2seq4repair_space>=<seq2seq4repair_space>" ) + value ) , MSG_VERBOSE ) ; getProject ( ) . setNewProperty ( property , value ) ; } } } finally { path = savedPath ; dirSep = savedDirSep ; pathSep = savedPathSep ; } } private String mapElement ( String elem ) { } public void addMapper ( Mapper mapper ) { } public void add ( FileNameMapper fileNameMapper ) { } private void validateSetup ( ) throws BuildException { } private BuildException noChildrenAllowed ( ) { } }

Fix:
elems = ( ( String [ ] ) ( ret . toArray ( new String [ ret . size ( ) ] ) ) ) ;