Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Lindberg2009-04-30 18:55:09 +0000
committerHenrik Lindberg2009-04-30 18:55:09 +0000
commit0c9fde111f8fe42d4e58860be47174bcb0329aeb (patch)
tree6218815449f458f3289d26a6461b3e89e800ecca /bundles/org.eclipse.equinox.p2.repository
parent9b5df30fcc985085686906f69c04e3f86ef9d7fb (diff)
downloadrt.equinox.p2-0c9fde111f8fe42d4e58860be47174bcb0329aeb.tar.gz
rt.equinox.p2-0c9fde111f8fe42d4e58860be47174bcb0329aeb.tar.xz
rt.equinox.p2-0c9fde111f8fe42d4e58860be47174bcb0329aeb.zip
Bug 274569 [transport] Exceptions for HTTP errors does not surface
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatus.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatus.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatus.java
index 7770002b6..f8ad8a4d7 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatus.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/RepositoryStatus.java
@@ -12,6 +12,7 @@
package org.eclipse.equinox.internal.p2.repository;
import java.io.FileNotFoundException;
+import java.io.IOException;
import java.net.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.ecf.core.identity.IDCreateException;
@@ -125,8 +126,23 @@ public class RepositoryStatus {
return new DownloadStatus(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_INVALID_LOCATION, NLS.bind(Messages.TransportErrorTranslator_MalformedRemoteFileReference, toDownload), t);
}
- if (t instanceof IncomingFileTransferException) {
- int code = ((IncomingFileTransferException) t).getErrorCode();
+ int code = 0;
+ // (sigh) parse http code from IOException thrown by ECF
+ if (t instanceof IOException) {
+ String ioMsg = t.getMessage();
+ String prefix = "HttpClient connection error response code "; //$NON-NLS-1$
+ if (ioMsg != null && ioMsg.startsWith(prefix)) {
+ try {
+ code = new Integer(ioMsg.substring(prefix.length(), ioMsg.lastIndexOf("."))).intValue(); //$NON-NLS-1$
+ } catch (Throwable e) {
+ code = 0;
+ }
+ }
+ }
+
+ if (t instanceof IncomingFileTransferException || code != 0) {
+ if (code == 0)
+ code = ((IncomingFileTransferException) t).getErrorCode();
// Switch on error codes in the HTTP error code range
if (code >= 400 && code <= 600) {
int provisionCode = ProvisionException.REPOSITORY_FAILED_READ;

Back to the top