Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java19
3 files changed, 29 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 20da9aee9..ab2683573 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
@@ -38,6 +38,12 @@ import org.eclipse.osgi.util.NLS;
public class MirrorRequest extends ArtifactRequest {
/**
+ * A Status code that represents an error while processing the artifact. This error is not
+ * related to transport, but rather a problem with the processing step.
+ */
+ public static final int ARTIFACT_PROCESSING_ERROR = 2;
+
+ /**
* Maximum number of times a request for a single artifact should be tried
*/
private static final int MAX_RETRY_REQUEST = 200;
@@ -199,6 +205,9 @@ public class MirrorRequest extends ArtifactRequest {
int counter = 0;
do {
+ if (counter > 0) {
+ System.out.println("Retry: " + counter + " " + sourceDescriptor.getArtifactKey().getId());
+ }
lastResult = transferSingle(destinationDescriptor, sourceDescriptor, monitor);
allResults.add(lastResult);
} while (lastResult.getSeverity() == IStatus.ERROR && lastResult.getCode() == IArtifactRepository.CODE_RETRY && counter++ < MAX_RETRY_REQUEST);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
index e99b808bb..99c9080ac 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
@@ -76,7 +76,7 @@ public class SignatureVerifier extends ProcessingStep {
try {
signedContent = verifierFactory.getSignedContent(inputFile);
} catch (GeneralSecurityException e) {
- return new Status(IStatus.ERROR, Activator.ID, Messages.SignatureVerification_failedRead + inputFile, e);
+ return new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_failedRead + inputFile, e);
}
ArrayList<IStatus> allStatus = new ArrayList<IStatus>(0);
SignedContentEntry[] entries = signedContent.getSignedEntries();
@@ -84,7 +84,7 @@ public class SignatureVerifier extends ProcessingStep {
try {
entries[i].verify();
} catch (InvalidContentException e) {
- allStatus.add(new Status(IStatus.ERROR, Activator.ID, Messages.SignatureVerification_invalidContent + entries[i].getName(), e));
+ allStatus.add(new Status(IStatus.ERROR, Activator.ID, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_invalidContent + entries[i].getName(), e));
} catch (OutOfMemoryError e) {
allStatus.add(new Status(IStatus.ERROR, Activator.ID, Messages.SignatureVerifier_OutOfMemory, e));
break;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index 4c0777d14..1f036394b 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
@@ -592,7 +592,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
// if the original download went reasonably but the reportStatus found some issues
// (e..g, in the processing steps/validators) then mark the mirror as bad and return
// a retry code (assuming we have more mirrors)
- if ((status.isOK() || status.matches(IStatus.INFO | IStatus.WARNING)) && result.getSeverity() == IStatus.ERROR) {
+ if ((status.isOK() || status.matches(IStatus.INFO | IStatus.WARNING)) && result.getSeverity() == IStatus.ERROR && !artifactError(result)) {
if (mirrors != null) {
mirrors.reportResult(mirrorLocation.toString(), result);
if (mirrors.hasValidMirror())
@@ -604,6 +604,23 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
/**
+ * Return true if there is an 'artifact error'. You cannot retry when an artifact error is found.
+ * @return True if the status (or children status) have an artifact error status code. False otherwise
+ */
+ private boolean artifactError(IStatus status) {
+ if (status.getCode() == MirrorRequest.ARTIFACT_PROCESSING_ERROR)
+ return true;
+ if (status.getChildren() != null) {
+ IStatus[] children = status.getChildren();
+ for (IStatus child : children) {
+ if (artifactError(child))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
* Copy a file to an output stream.
* Optionally close the streams when done.
* Notify the monitor about progress we make

Back to the top