diff options
author | Andrew Ferrazzutti | 2014-08-13 21:00:04 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2014-09-04 20:06:26 +0000 |
commit | 920fb898f4141c6b9088bd2593a8417ffc33808f (patch) | |
tree | 2aaf3011b7ab76edd4d9577a4e214834686cd68e /rpm | |
parent | 63a4aab9a5f29617a681b188fd222c9f595f6c52 (diff) | |
download | org.eclipse.linuxtools-920fb898f4141c6b9088bd2593a8417ffc33808f.tar.gz org.eclipse.linuxtools-920fb898f4141c6b9088bd2593a8417ffc33808f.tar.xz org.eclipse.linuxtools-920fb898f4141c6b9088bd2593a8417ffc33808f.zip |
RPM: Allow source downloads with FTP.
Resolves EBZ #441736.
Change-Id: I5d66e57836ebbab4638d0e3f1bc4fc2863042007
Signed-off-by: Andrew Ferrazzutti <aferrazz@redhat.com>
Reviewed-on: https://git.eclipse.org/r/31580
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
Tested-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'rpm')
2 files changed, 10 insertions, 5 deletions
diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java index 44af226eeb..8d7855eb7a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorDownloadSourcesActionDelegate.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLConnection; import java.util.List; import org.eclipse.core.commands.AbstractHandler; @@ -68,9 +69,11 @@ public class SpecfileEditorDownloadSourcesActionDelegate extends AbstractHandler return null; } - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + URLConnection connection = url.openConnection(); - if (connection.getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { + if (!(connection instanceof HttpURLConnection) || + ((HttpURLConnection) connection).getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { + connection.connect(); // grab the name of the file from the URL int offset = url.toString().lastIndexOf("/"); //$NON-NLS-1$ String filename = url.toString().substring(offset + 1); diff --git a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java index b921fc9ddb..e4e90eeb4a 100644 --- a/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java +++ b/rpm/org.eclipse.linuxtools.rpm.ui.editor/src/org/eclipse/linuxtools/internal/rpm/ui/editor/actions/SpecfileEditorPrepareSourcesActionDelegate.java @@ -15,6 +15,7 @@ import java.io.IOException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; +import java.net.URLConnection; import java.util.List; import org.eclipse.core.commands.AbstractHandler; @@ -110,10 +111,11 @@ public class SpecfileEditorPrepareSourcesActionDelegate extends AbstractHandler return false; } - HttpURLConnection connection = (HttpURLConnection) url - .openConnection(); + URLConnection connection = url.openConnection(); - if (connection.getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { + if (!(connection instanceof HttpURLConnection) || + ((HttpURLConnection) connection).getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND) { + connection.connect(); // grab the name of the file from the URL int offset = url.toString().lastIndexOf("/"); //$NON-NLS-1$ String filename = url.toString().substring(offset + 1); |