Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2018-07-23 10:37:24 +0000
committerAlexander Kurtakov2018-10-03 08:00:20 +0000
commitab78d64c030e003435d1b2430c99a8c64d621c1b (patch)
tree3667a1550d3a9815fe40c8d528ac6a11de8133fa
parent909347bbf63f88048fa277ef72ced50de579c555 (diff)
downloadrt.equinox.p2-ab78d64c030e003435d1b2430c99a8c64d621c1b.tar.gz
rt.equinox.p2-ab78d64c030e003435d1b2430c99a8c64d621c1b.tar.xz
rt.equinox.p2-ab78d64c030e003435d1b2430c99a8c64d621c1b.zip
Bug 536326 - Report ARTIFACT_PROCESSING_ERROR from pack200 processing step
When Pack200ProcessorStep fails to unpack artifact, it reports MirrorRequest.ARTIFACT_PROCESSING_ERROR. Since b26ae58972e96118b4f9e4496438fc218e5ab2d0, processing step must return MirrorRequest.ARTIFACT_PROCESSING_ERROR to report non-transport artifact errors and instruct SimpleArtifactRepository's downloadArtifact(IArtifactDescriptor, OutputStream, IProgressMonitor) via artifactError(IStatus) method to stop retrying. This fixes failing MirrorRequestTest's testFailToCanonicalWithMirrors() from the previous commit. Bug: 377976 Change-Id: Ib0c3316915044d115408a91a45a590266a63e8b6 Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java
index 3fb2586ce..7eb071752 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java
@@ -19,6 +19,7 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.artifact.processing.AbstractBufferingStep;
import org.eclipse.equinox.internal.p2.artifact.repository.Activator;
+import org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest;
import org.eclipse.equinox.internal.p2.core.helpers.FileUtils;
import org.eclipse.equinox.internal.p2.jarprocessor.UnpackStep;
import org.eclipse.equinox.internal.p2.jarprocessor.Utils;
@@ -49,7 +50,7 @@ public class Pack200ProcessorStep extends AbstractBufferingStep {
if (!UnpackStep.canUnpack()) {
IStatus status = null;
if (detailedResult) {
- status = new Status(IStatus.ERROR, Activator.ID, "Unpack facility not configured."); //$NON-NLS-1$
+ status = new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, "Unpack facility not configured.", null); //$NON-NLS-1$
detailedResult = true;
} else {
String[] locations = Utils.getPack200Commands("unpack200"); //$NON-NLS-1$
@@ -57,7 +58,7 @@ public class Pack200ProcessorStep extends AbstractBufferingStep {
for (int i = 0; i < locations.length; i++) {
locationTried.append(locations[i]).append(", "); //$NON-NLS-1$
}
- status = new Status(IStatus.ERROR, Activator.ID, "Unpack facility not configured. The locations searched for unpack200 are: " + locationTried); //$NON-NLS-1$
+ status = new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, "Unpack facility not configured. The locations searched for unpack200 are: " + locationTried, null); //$NON-NLS-1$
}
setStatus(status);
}
@@ -80,8 +81,11 @@ public class Pack200ProcessorStep extends AbstractBufferingStep {
InputStream resultStream = new BufferedInputStream(new FileInputStream(resultFile));
FileUtils.copyStream(resultStream, true, getDestination(), false);
} else {
- setStatus(new Status(IStatus.ERROR, Activator.ID, "Unpacking fails because intermediate file is empty: " + resultFile)); //$NON-NLS-1$
+ setStatus(new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, "Unpacking fails because intermediate file is empty: " + resultFile, null)); //$NON-NLS-1$
}
+ } catch (IOException e) {
+ setStatus(new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, "Unpacking fails", e)); //$NON-NLS-1$
+ throw e;
} finally {
if (resultFile != null)
resultFile.delete();

Back to the top