Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-09-25 19:52:41 +0000
committerAlexander Kurtakov2019-10-14 12:19:35 +0000
commit680b7ea1ff9dd2dfc8248f3d9d1c92023bd746d4 (patch)
treebb79e45c48bf74cad6eb6351a11c3ca90bd15c61 /bundles/org.eclipse.equinox.p2.artifact.repository
parent4c9f2ab32d4f60aca08375e176ee06928aa22edf (diff)
downloadrt.equinox.p2-680b7ea1ff9dd2dfc8248f3d9d1c92023bd746d4.tar.gz
rt.equinox.p2-680b7ea1ff9dd2dfc8248f3d9d1c92023bd746d4.tar.xz
rt.equinox.p2-680b7ea1ff9dd2dfc8248f3d9d1c92023bd746d4.zip
Use jdk 5 for-each loop
Replace simple uses of Iterator with a corresponding for-loop. Also add missing braces on loops as necessary. Change-Id: I044ba2ecb69c7c5e1f30b6c60f345078b2fa7b3b Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java14
3 files changed, 13 insertions, 13 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
index eda0fe019..3e21e1ba1 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
@@ -370,8 +370,7 @@ public class MirrorSelector {
public synchronized void reportResult(String toDownload, IStatus result) {
if (mirrors == null)
return;
- for (int i = 0; i < mirrors.length; i++) {
- MirrorInfo mirror = mirrors[i];
+ for (MirrorInfo mirror : mirrors) {
if (toDownload.startsWith(mirror.locationString)) {
if (!result.isOK() && result.getSeverity() != IStatus.CANCEL) {
// Punishing a mirror harshly for a FileNotFoundException can be very wrong.
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 2a0c420b1..45ac40936 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
@@ -93,15 +93,16 @@ public class SignatureVerifier extends ProcessingStep {
}
ArrayList<IStatus> allStatus = new ArrayList<>(0);
SignedContentEntry[] entries = signedContent.getSignedEntries();
- for (int i = 0; i < entries.length; i++)
+ for (SignedContentEntry entry : entries) {
try {
- entries[i].verify();
+ entry.verify();
} catch (InvalidContentException 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, MirrorRequest.ARTIFACT_PROCESSING_ERROR, Messages.SignatureVerification_invalidContent + entry.getName(), e));
+ }catch (OutOfMemoryError e) {
allStatus.add(new Status(IStatus.ERROR, Activator.ID, Messages.SignatureVerifier_OutOfMemory, e));
break;
}
+ }
if (allStatus.size() > 0)
return new MultiStatus(Activator.ID, IStatus.ERROR, allStatus.toArray(new IStatus[allStatus.size()]), Messages.SignatureVerification_invalidFileContent + inputFile, null);
return Status.OK_STATUS;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
index da50ce095..65bc6a4be 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
@@ -249,10 +249,10 @@ public class SimpleArtifactRepositoryIO {
if (rules.length > 0) {
start(MAPPING_RULES_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, rules.length);
- for (int i = 0; i < rules.length; i++) {
+ for (String[] rule : rules) {
start(MAPPING_RULE_ELEMENT);
- attribute(MAPPING_RULE_FILTER_ATTRIBUTE, rules[i][0]);
- attribute(MAPPING_RULE_OUTPUT_ATTRIBUTE, rules[i][1]);
+ attribute(MAPPING_RULE_FILTER_ATTRIBUTE, rule[0]);
+ attribute(MAPPING_RULE_OUTPUT_ATTRIBUTE, rule[1]);
end(MAPPING_RULE_ELEMENT);
}
end(MAPPING_RULES_ELEMENT);
@@ -280,11 +280,11 @@ public class SimpleArtifactRepositoryIO {
if (processingSteps.length > 0) {
start(PROCESSING_STEPS_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, processingSteps.length);
- for (int i = 0; i < processingSteps.length; i++) {
+ for (IProcessingStepDescriptor processingStep : processingSteps) {
start(PROCESSING_STEP_ELEMENT);
- attribute(ID_ATTRIBUTE, processingSteps[i].getProcessorId());
- attribute(STEP_DATA_ATTRIBUTE, processingSteps[i].getData());
- attribute(STEP_REQUIRED_ATTRIBUTE, processingSteps[i].isRequired());
+ attribute(ID_ATTRIBUTE, processingStep.getProcessorId());
+ attribute(STEP_DATA_ATTRIBUTE, processingStep.getData());
+ attribute(STEP_REQUIRED_ATTRIBUTE, processingStep.isRequired());
end(PROCESSING_STEP_ELEMENT);
}
end(PROCESSING_STEPS_ELEMENT);

Back to the top