Buggy code:
private static final int REDIRECT_LIMIT = 25 ; private static final String HTTP = "http" ; private static final String HTTPS = "https" ; private Resources sources = new Resources ( ) ; private File destination ; private boolean verbose = false ; private boolean useTimestamp = false ; private boolean ignoreErrors = false ; private String uname = null ; private String pword = null ; private long maxTime = 0 ; private int numberRetries = Get . NUMBER_RETRIES ; private boolean skipExisting = false ; private boolean httpUseCaches = true ; private Mapper mapperElement = null ; public void execute ( ) throws BuildException { } public boolean doGet ( int logLevel , Get . DownloadProgress progress ) throws IOException { } public boolean doGet ( URL source , File dest , int logLevel , Get . DownloadProgress progress ) throws IOException { } private void checkAttributes ( ) { } public void setSrc ( URL u ) { } public void add ( ResourceCollection rc ) { } public void setDest ( File dest ) { } public void setVerbose ( boolean v ) { } public void setIgnoreErrors ( boolean v ) { } public void setUseTimestamp ( boolean v ) { } public void setUsername ( String u ) { } public void setPassword ( String p ) { } public void setMaxTime ( long maxTime ) { } public void setRetries ( int r ) { } public void setSkipExisting ( boolean s ) { } public void setHttpUseCaches ( boolean httpUseCache ) { } public Mapper createMapper ( ) throws BuildException { } public void add ( FileNameMapper fileNameMapper ) { } protected static class Base64Converter extends org . apache . tools . ant . util . Base64Converter { } public interface DownloadProgress { void beginDownload ( ) { } void onTick ( ) { } void endDownload ( ) { } } public static class NullProgress implements Get . DownloadProgress { public void beginDownload ( ) { } public void onTick ( ) { } public void endDownload ( ) { } } public static class VerboseProgress implements Get . DownloadProgress { private int dots = 0 ; PrintStream out ; public VerboseProgress ( PrintStream out ) { } public void beginDownload ( ) { } public void onTick ( ) { } public void endDownload ( ) { } } private class GetThread extends Thread { private final URL source ; private final File dest ; private final boolean hasTimestamp ; private final long timestamp ; private final Get . DownloadProgress progress ; private final int logLevel ; private boolean success = false ; private IOException ioexception = null ; private BuildException exception = null ; private InputStream is = null ; private OutputStream os = null ; private URLConnection connection ; private int redirections = 0 ; GetThread ( URL source , File dest , boolean h , long t , Get . DownloadProgress p , int l ) { } public void run ( ) { } private boolean get ( ) throws IOException , BuildException { } private boolean redirectionAllowed ( URL aSource , URL aDest ) { } private URLConnection openConnection ( URL aSource ) throws IOException { URLConnection connection = aSource . openConnection ( ) ; if ( hasTimestamp ) { connection . setIfModifiedSince ( timestamp ) ; } if ( ( ( uname ) != null ) || ( ( pword ) != null ) ) { String up = ( ( uname ) + ":" ) + ( pword ) ; String encoding ; Get . Base64Converter encoder = new Get . Base64Converter ( ) ; encoding = encoder . encode ( up . getBytes ( ) ) ; connection . setRequestProperty ( "Authorization" , ( "Basic<seq2seq4repair_space>" + encoding ) ) ; } if ( connection instanceof HttpURLConnection ) { ( ( HttpURLConnection ) ( connection ) ) . setInstanceFollowRedirects ( false ) ; ( ( HttpURLConnection ) ( connection ) ) . setUseCaches ( httpUseCaches ) ; } try { connection . connect ( ) ; } catch ( NullPointerException e ) { throw new BuildException ( ( "Failed<seq2seq4repair_space>to<seq2seq4repair_space>parse<seq2seq4repair_space>" + ( source . toString ( ) ) ) , e ) ; } if ( connection instanceof HttpURLConnection ) { HttpURLConnection httpConnection = ( ( HttpURLConnection ) ( connection ) ) ; int responseCode = httpConnection . getResponseCode ( ) ; if ( ( ( responseCode == ( HttpURLConnection . HTTP_MOVED_PERM ) ) || ( responseCode == ( HttpURLConnection . HTTP_MOVED_TEMP ) ) ) || ( responseCode == ( HttpURLConnection . HTTP_SEE_OTHER ) ) ) { String newLocation = httpConnection . getHeaderField ( "Location" ) ; String message = ( ( aSource + ( responseCode == ( HttpURLConnection . HTTP_MOVED_PERM ) ? "<seq2seq4repair_space>permanently" : "" ) ) + "<seq2seq4repair_space>moved<seq2seq4repair_space>to<seq2seq4repair_space>" ) + newLocation ; log ( message , logLevel ) ; <START_BUG> URL newURL = new URL ( newLocation ) ; <END_BUG> if ( ! ( redirectionAllowed ( aSource , newURL ) ) ) { return null ; } return openConnection ( newURL ) ; } long lastModified = httpConnection . getLastModified ( ) ; if ( ( responseCode == ( HttpURLConnection . HTTP_NOT_MODIFIED ) ) || ( ( ( lastModified != 0 ) && ( hasTimestamp ) ) && ( ( timestamp ) >= lastModified ) ) ) { log ( "Not<seq2seq4repair_space>modified<seq2seq4repair_space>-<seq2seq4repair_space>so<seq2seq4repair_space>not<seq2seq4repair_space>downloaded" , logLevel ) ; return null ; } if ( responseCode == ( HttpURLConnection . HTTP_UNAUTHORIZED ) ) { String message = "HTTP<seq2seq4repair_space>Authorization<seq2seq4repair_space>failure" ; if ( ignoreErrors ) { log ( message , logLevel ) ; return null ; } else { throw new BuildException ( message ) ; } } } return connection ; } private boolean downloadFile ( ) throws FileNotFoundException , IOException { } private void updateTimeStamp ( ) { } boolean wasSuccessful ( ) throws IOException , BuildException { } void closeStreams ( ) { } } }

Fix:
URL newURL = new URL ( aSource , newLocation ) ;