Buggy code:
public void copyFile ( String sourceFile , String destFile ) throws IOException { } public void copyFile ( String sourceFile , String destFile , FilterSetCollection filters ) throws IOException { } public void copyFile ( String sourceFile , String destFile , FilterSetCollection filters , boolean overwrite ) throws IOException { } public void copyFile ( String sourceFile , String destFile , FilterSetCollection filters , boolean overwrite , boolean preserveLastModified ) throws IOException { } public void copyFile ( String sourceFile , String destFile , FilterSetCollection filters , boolean overwrite , boolean preserveLastModified , String encoding ) throws IOException { } public void copyFile ( String sourceFile , String destFile , FilterSetCollection filters , Vector filterChains , boolean overwrite , boolean preserveLastModified , String encoding , Project project ) throws IOException { } public void copyFile ( String sourceFile , String destFile , FilterSetCollection filters , Vector filterChains , boolean overwrite , boolean preserveLastModified , String inputEncoding , String outputEncoding , Project project ) throws IOException { } public void copyFile ( File sourceFile , File destFile ) throws IOException { } public void copyFile ( File sourceFile , File destFile , FilterSetCollection filters ) throws IOException { } public void copyFile ( File sourceFile , File destFile , FilterSetCollection filters , boolean overwrite ) throws IOException { } public void copyFile ( File sourceFile , File destFile , FilterSetCollection filters , boolean overwrite , boolean preserveLastModified ) throws IOException { } public void copyFile ( File sourceFile , File destFile , FilterSetCollection filters , boolean overwrite , boolean preserveLastModified , String encoding ) throws IOException { } public void copyFile ( File sourceFile , File destFile , FilterSetCollection filters , Vector filterChains , boolean overwrite , boolean preserveLastModified , String encoding , Project project ) throws IOException { } public void copyFile ( File sourceFile , File destFile , FilterSetCollection filters , Vector filterChains , boolean overwrite , boolean preserveLastModified , String inputEncoding , String outputEncoding , Project project ) throws IOException { } public void setFileLastModified ( File file , long time ) { } public File resolveFile ( File file , String filename ) { } public static boolean isContextRelativePath ( String filename ) { } public static boolean isAbsolutePath ( String filename ) { } public static String translatePath ( String toProcess ) { } public File normalize ( final String path ) { } public String [ ] dissect ( String path ) { } public String toVMSPath ( File f ) { } public File createTempFile ( String prefix , String suffix , File parentDir ) { } public boolean contentEquals ( File f1 , File f2 ) throws IOException { } public boolean contentEquals ( File f1 , File f2 , boolean textfile ) throws IOException { } public File getParentFile ( File f ) { } public static final String readFully ( Reader rdr ) throws IOException { } public static final String readFully ( Reader rdr , int bufferSize ) throws IOException { } public boolean createNewFile ( File f ) throws IOException { } public boolean createNewFile ( File f , boolean mkdirs ) throws IOException { } public boolean isSymbolicLink ( File parent , String name ) throws IOException { } public String removeLeadingPath ( File leading , File path ) { } public boolean isLeadingPath ( File leading , File path ) { } public String toURI ( String path ) { Class uriClazz = null ; try { uriClazz = Class . forName ( "java.net.URI" ) ; } catch ( ClassNotFoundException e ) { } if ( uriClazz != null ) { try { File f = new File ( path ) . getAbsoluteFile ( ) ; Method toURIMethod = File . class . getMethod ( "toURI" , new Class [ 0 ] ) ; Object uriObj = toURIMethod . invoke ( f , new Object [ ] { } ) ; Method toASCIIStringMethod = uriClazz . getMethod ( "toASCIIString" , new Class [ 0 ] ) ; return ( ( String ) ( toASCIIStringMethod . invoke ( uriObj , new Object [ ] { } ) ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } boolean isDir = new File ( path ) . isDirectory ( ) ; StringBuffer sb = new StringBuffer ( "file:" ) ; path = resolveFile ( null , path ) . getPath ( ) ; sb . append ( "////" ) ; if ( ! ( path . startsWith ( File . separator ) ) ) { sb . append ( "//" ) ; } path = path . replace ( '\\' , '//' ) ; try { <START_BUG> sb . append ( Locator . encodeUri ( path ) ) ; <END_BUG> } catch ( UnsupportedEncodingException exc ) { throw new BuildException ( exc ) ; } if ( isDir && ( ! ( path . endsWith ( "//" ) ) ) ) { sb . append ( '//' ) ; } return sb . toString ( ) ; } public String fromURI ( String uri ) { } public boolean fileNameEquals ( File f1 , File f2 ) { } public void rename ( File from , File to ) throws IOException { } public long getFileTimestampGranularity ( ) { } public boolean isUpToDate ( File source , File dest , long granularity ) { } public boolean isUpToDate ( File source , File dest ) { } public boolean isUpToDate ( long sourceTime , long destTime , long granularity ) { } public boolean isUpToDate ( long sourceTime , long destTime ) { } public static void close ( Writer device ) { } public static void close ( Reader device ) { } public static void close ( OutputStream device ) { } public static void close ( InputStream device ) { } public static void delete ( File file ) { } }

Fix:
sb . append ( Locator . encodeURI ( path ) ) ;