ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 47433] Issue with "get" task to download a redirected/moved URL (301/302)
Date Sat, 27 Jun 2009 01:39:12 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=47433





--- Comment #1 from Jagadesh Munta <jagadesh.munta@sun.com>  2009-06-26 18:39:10 PST
---
Earlier code (calling execute after setting new URL) had issue on Linux and
modified to call doGet() method.

Below is the latest code (last line changed).

            int responseCode = httpConnection.getResponseCode();
            log("Response Code="+responseCode, logLevel);
            // test for 401 result (HTTP only)
            if (responseCode == HttpURLConnection.HTTP_UNAUTHORIZED)  {
                String message = "HTTP Authorization failure";
                if (ignoreErrors) {
                    log(message, logLevel);
                    return false;
                } else {
                    throw new BuildException(message);
                }
            } else if ((responseCode == HttpURLConnection.HTTP_MOVED_PERM) ||
                    (responseCode == HttpURLConnection.HTTP_MOVED_TEMP)) {
                String newLocation = httpConnection.getHeaderField("Location");
                String message = "HTTP URL Moved to "+newLocation;
                log(message, logLevel);
                setSrc(new URL(newLocation));
                return doGet(logLevel, progress);
            }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message