Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneider2015-01-22 10:38:08 +0000
committerPascal Rapicault2015-01-23 15:00:09 +0000
commit038068556785cdf32a842b792c0b73666bb93f7f (patch)
tree3c4b6f315a500227ec56fbdd714d5bd0a8b5eb93 /bundles
parent26d00d88c6606ef2ff7a371a3c8ff3fc98a6b443 (diff)
downloadrt.equinox.p2-038068556785cdf32a842b792c0b73666bb93f7f.tar.gz
rt.equinox.p2-038068556785cdf32a842b792c0b73666bb93f7f.tar.xz
rt.equinox.p2-038068556785cdf32a842b792c0b73666bb93f7f.zip
Bug 458123 - don't mask Error or RuntimeException from getArtifact inI20150126-0800I20150125-2000
MirrorRequest Change-Id: Iac5f2ae2666d539805f899f64dece3361b882675 Signed-off-by: Christian Schneider <schneider@yatta.de>
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
index 559416283..a08b396cf 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
@@ -207,6 +207,11 @@ public class MirrorRequest extends ArtifactRequest {
do {
lastResult = transferSingle(destinationDescriptor, sourceDescriptor, monitor);
allResults.add(lastResult);
+ if (lastResult.getException() instanceof Error)
+ {
+ // Error is more severe than Exception - e.g. an OutOfMemoryError should not be ignored and might hinder further processing
+ throw (Error) lastResult.getException();
+ }
} while (lastResult.getSeverity() == IStatus.ERROR && lastResult.getCode() == IArtifactRepository.CODE_RETRY && counter++ < MAX_RETRY_REQUEST);
IProvisioningEventBus bus = (IProvisioningEventBus) source.getProvisioningAgent().getService(IProvisioningEventBus.SERVICE_NAME);
if (bus != null)
@@ -262,6 +267,7 @@ public class MirrorRequest extends ArtifactRequest {
}
IStatus status = null;
+ Throwable priorException = null;
// Do the actual transfer
try {
status = getArtifact(sourceDescriptor, destination, monitor);
@@ -271,13 +277,24 @@ public class MirrorRequest extends ArtifactRequest {
Throwable e = root != null ? root.getException() : null;
((IStateful) destination).setStatus(new MultiStatus(Activator.ID, status.getCode(), new IStatus[] {status, destStatus}, status.getMessage(), e));
}
+ } catch (RuntimeException e)
+ {
+ priorException = e;
+ throw e;
+ } catch (Error e) {
+ priorException = e;
+ throw e;
} finally {
try {
destination.close();
} catch (IOException e) {
- if (status != null && status.getSeverity() == IStatus.ERROR && status.getCode() == IArtifactRepository.CODE_RETRY)
- return new MultiStatus(Activator.ID, status.getCode(), new IStatus[] {status}, NLS.bind(Messages.error_closing_stream, getArtifactKey(), target.getLocation()), e);
- return new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.error_closing_stream, getArtifactKey(), target.getLocation()), e);
+ if (priorException == null) // don't mask a formerly thrown Exception/Error
+ {
+ if (status != null && status.getSeverity() == IStatus.ERROR && status.getCode() == IArtifactRepository.CODE_RETRY)
+ return new MultiStatus(Activator.ID, status.getCode(), new IStatus[] {status}, NLS.bind(Messages.error_closing_stream, getArtifactKey(), target.getLocation()), e);
+ return new Status(IStatus.ERROR, Activator.ID, NLS.bind(Messages.error_closing_stream, getArtifactKey(), target.getLocation()), e);
+ }
+ // otherwise it is already thrown
}
}
return status;

Back to the top