Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2008-04-24 22:57:22 -0400
committerJohn Arthorne2008-04-24 22:57:22 -0400
commit846231adb81707635f2b636550caf61fc181ff80 (patch)
tree90887777457dda9435e844d88196d7c9d46a651b /bundles
parent4ceb076346e08aab89dd178ad746c8f6c24ceab7 (diff)
downloadrt.equinox.p2-846231adb81707635f2b636550caf61fc181ff80.tar.gz
rt.equinox.p2-846231adb81707635f2b636550caf61fc181ff80.tar.xz
rt.equinox.p2-846231adb81707635f2b636550caf61fc181ff80.zip
Bug 228805 Logged exception when attempting to open an update site
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java
index 91adca968..5c7b5460d 100644
--- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java
+++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/UpdateSite.java
@@ -113,18 +113,20 @@ public class UpdateSite {
* Returns a local file containing the contents of the update site at the given location.
*/
private static File loadSiteFile(URL location, IProgressMonitor monitor) throws ProvisionException {
- File siteFile;
+ Throwable failure;
try {
- siteFile = File.createTempFile("site", ".xml"); //$NON-NLS-1$//$NON-NLS-2$
+ File siteFile = File.createTempFile("site", ".xml"); //$NON-NLS-1$//$NON-NLS-2$
OutputStream destination = new BufferedOutputStream(new FileOutputStream(siteFile));
IStatus transferResult = getTransport().download(getSiteURL(location).toExternalForm(), destination, monitor);
- if (!transferResult.isOK())
- throw new ProvisionException(transferResult);
+ if (transferResult.isOK())
+ return siteFile;
+ failure = transferResult.getException();
} catch (IOException e) {
- String msg = NLS.bind(Messages.ErrorReadingSite, location);
- throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, ProvisionException.REPOSITORY_FAILED_READ, msg, e));
+ failure = e;
}
- return siteFile;
+ int code = (failure instanceof FileNotFoundException) ? ProvisionException.REPOSITORY_NOT_FOUND : ProvisionException.REPOSITORY_FAILED_READ;
+ String msg = NLS.bind(Messages.ErrorReadingSite, location);
+ throw new ProvisionException(new Status(IStatus.ERROR, Activator.ID, code, msg, failure));
}
/*

Back to the top