Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-09-25 16:00:38 -0400
committerAlexander Kurtakov2019-10-16 01:10:16 -0400
commite06819792b23c8e9305c7d5662cc11c39c781577 (patch)
treec150a186221e2c02ae942de1d90683007c58a093
parentc3e6490d91f762660b540236b6e45a963243df23 (diff)
downloadrt.equinox.p2-e06819792b23c8e9305c7d5662cc11c39c781577.tar.gz
rt.equinox.p2-e06819792b23c8e9305c7d5662cc11c39c781577.tar.xz
rt.equinox.p2-e06819792b23c8e9305c7d5662cc11c39c781577.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: Id71f030335f035816de194384d1a3c042a350886 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
-rw-r--r--bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzer.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/TaskHelper.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeWriter.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java6
15 files changed, 86 insertions, 74 deletions
diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
index b3a0bb604..5a4b64cf6 100644
--- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
+++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/PlatformXmlListener.java
@@ -47,21 +47,22 @@ public class PlatformXmlListener extends DirectoryChangeListener {
private String toString(Feature[] features, String[] list) {
StringBuilder buffer = new StringBuilder();
if (features != null) {
- for (int i = 0; i < features.length; i++) {
- String featureURL = features[i].getUrl();
- if (featureURL != null)
+ for (Feature feature : features) {
+ String featureURL = feature.getUrl();
+ if (featureURL != null) {
buffer.append(featureURL).append(',');
- else {
- String id = features[i].getId();
- String version = features[i].getVersion();
+ } else {
+ String id = feature.getId();
+ String version = feature.getVersion();
if (id != null && version != null)
buffer.append("features/" + id + "_" + version + "/,"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
}
if (list != null) {
- for (int i = 0; i < list.length; i++)
- buffer.append(list[i]).append(',');
+ for (String list1 : list) {
+ buffer.append(list1).append(',');
+ }
}
if (buffer.length() == 0)
return ""; //$NON-NLS-1$
@@ -239,8 +240,7 @@ public class PlatformXmlListener extends DirectoryChangeListener {
} catch (ProvisionException ex) {
IArtifactRepository artifactRepository = Activator.loadArtifactRepository(location, null);
// set the repository properties here in case they have changed since the last time we loaded
- for (Iterator<String> inner = properties.keySet().iterator(); inner.hasNext();) {
- String key = inner.next();
+ for (String key : properties.keySet()) {
String value = properties.get(key);
artifactRepository.setProperty(key, value);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
index 1dce82b9f..da9914a31 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/comparator/JarComparator.java
@@ -151,22 +151,26 @@ public class JarComparator implements IArtifactComparator {
if (entries1.length != entries2.length)
parent.add(newErrorStatus(Messages.featureSize));
- for (int i = 0; i < entries1.length; i++)
- entryMap.put(new FeatureEntryWrapper(entries1[i]), entries1[i]);
-
- for (int i = 0; i < entries2.length; i++) {
- FeatureEntry firstEntry = entryMap.get(new FeatureEntryWrapper(entries2[i]));
- if (firstEntry == null)
- parent.add(newErrorStatus(NLS.bind(Messages.featureEntry, entries2[i])));
- else {
- if (firstEntry.isOptional() != entries2[i].isOptional())
- parent.add(newErrorStatus(NLS.bind(Messages.featureEntryOptional, entries2[i])));
- if (firstEntry.isUnpack() != entries2[i].isUnpack())
- parent.add(newErrorStatus(NLS.bind(Messages.featureEntryUnpack, entries2[i])));
- if (firstEntry.isRequires() && firstEntry.getMatch() != null && !firstEntry.getMatch().equals(entries2[i].getMatch()))
- parent.add(newErrorStatus(NLS.bind(Messages.featureEntryMatch, entries2[i])));
- if (firstEntry.getFilter() != null && !firstEntry.getFilter().equals(entries2[i].getFilter()))
- parent.add(newErrorStatus(NLS.bind(Messages.featureEntryFilter, entries2[i])));
+ for (FeatureEntry entries11 : entries1) {
+ entryMap.put(new FeatureEntryWrapper(entries11), entries11);
+ }
+ for (FeatureEntry entries21 : entries2) {
+ FeatureEntry firstEntry = entryMap.get(new FeatureEntryWrapper(entries21));
+ if (firstEntry == null) {
+ parent.add(newErrorStatus(NLS.bind(Messages.featureEntry, entries21)));
+ } else {
+ if (firstEntry.isOptional() != entries21.isOptional()) {
+ parent.add(newErrorStatus(NLS.bind(Messages.featureEntryOptional, entries21)));
+ }
+ if (firstEntry.isUnpack() != entries21.isUnpack()) {
+ parent.add(newErrorStatus(NLS.bind(Messages.featureEntryUnpack, entries21)));
+ }
+ if (firstEntry.isRequires() && firstEntry.getMatch() != null && !firstEntry.getMatch().equals(entries21.getMatch())) {
+ parent.add(newErrorStatus(NLS.bind(Messages.featureEntryMatch, entries21)));
+ }
+ if (firstEntry.getFilter() != null && !firstEntry.getFilter().equals(entries21.getFilter())) {
+ parent.add(newErrorStatus(NLS.bind(Messages.featureEntryFilter, entries21)));
+ }
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java
index 4bd40a946..9bd77d3ff 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/FileMirrorLog.java
@@ -60,7 +60,9 @@ public class FileMirrorLog implements IArtifactMirrorLog {
/*
* Write a status to the log, indenting it based on status depth.
+ *
* @param status the status to log
+ *
* @param depth the depth of the status
*/
private void log(IStatus status, String prefix) {
@@ -76,13 +78,15 @@ public class FileMirrorLog implements IArtifactMirrorLog {
// Write the children of the status to the log
IStatus[] nestedStatus = status.getChildren();
if (nestedStatus != null)
- for (int i = 0; i < nestedStatus.length; i++)
- log(nestedStatus[i], prefix + INDENT);
+ for (IStatus s : nestedStatus) {
+ log(s, prefix + INDENT);
+ }
}
}
/*
* Write a message to the log
+ *
* @param message the message to write
*/
private void log(String message) {
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
index 13cffb890..524c9faea 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/Mirroring.java
@@ -110,8 +110,8 @@ public class Mirroring {
while (keys.hasNext()) {
IArtifactKey key = keys.next();
IArtifactDescriptor[] descriptors = source.getArtifactDescriptors(key);
- for (int j = 0; j < descriptors.length; j++) {
- IStatus result = mirror(descriptors[j], verbose);
+ for (IArtifactDescriptor descriptor : descriptors) {
+ IStatus result = mirror(descriptor, verbose);
//Only log INFO and WARNING if we want verbose logging. Always log ERRORs
if (!result.isOK() && (verbose || result.getSeverity() == IStatus.ERROR))
multiStatus.add(result);
@@ -242,9 +242,10 @@ public class Mirroring {
return null;
IArtifactDescriptor[] baselineDescriptors = baseline.getArtifactDescriptors(descriptor.getArtifactKey());
- for (int i = 0; i < baselineDescriptors.length; i++) {
- if (baselineDescriptors[i].equals(descriptor))
- return baselineDescriptors[i];
+ for (IArtifactDescriptor baselineDescriptor : baselineDescriptors) {
+ if (baselineDescriptor.equals(descriptor)) {
+ return baselineDescriptor;
+ }
}
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java
index 1d6c7cb31..1d093962d 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/mirroring/XMLMirrorLog.java
@@ -117,8 +117,9 @@ public class XMLMirrorLog implements IArtifactMirrorLog {
// Log children statuses
IStatus[] nestedStatus = status.getChildren();
if (nestedStatus != null)
- for (int i = 0; i < nestedStatus.length; i++)
- log(nestedStatus[i]);
+ for (IStatus s : nestedStatus) {
+ log(s);
+ }
// Close status tag
if (writer != null)
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
index 251929e4e..3a918b62e 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/MirrorApplication.java
@@ -297,8 +297,8 @@ public class MirrorApplication extends AbstractApplication implements IApplicati
if (rootIUs != null) {
sourceIUs = new ArrayList<>();
- for (int i = 0; i < rootIUs.length; i++) {
- String[] segments = getArrayArgsFromString(rootIUs[i], "/"); //$NON-NLS-1$
+ for (String rootIU : rootIUs) {
+ String[] segments = getArrayArgsFromString(rootIU, "/"); //$NON-NLS-1$
VersionRange range = segments.length > 1 ? VersionRange.create(segments[1]) : null;
Iterator<IInstallableUnit> queryResult = metadataRepo.query(QueryUtil.createIUQuery(segments[0], range), null).iterator();
while (queryResult.hasNext())
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzer.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzer.java
index db77976a1..09b724ff1 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzer.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzer.java
@@ -14,15 +14,14 @@
******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools;
-import org.eclipse.equinox.p2.repository.tools.analyzer.IIUAnalyzer;
-import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;
-
import java.util.Iterator;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.tools.analyzer.IIUAnalyzer;
+import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;
/**
* @since 2.0
@@ -42,18 +41,17 @@ public class RepositoryAnalyzer {
SubMonitor sub = SubMonitor.convert(monitor, repositories.length * 2);
IConfigurationElement[] config = RegistryFactory.getRegistry().getConfigurationElementsFor(IIUAnalyzer.ID);
- for (int i = 0; i < repositories.length; i++) {
- IQueryResult<IInstallableUnit> queryResult = repositories[i].query(QueryUtil.createIUAnyQuery(), sub);
-
+ for (IMetadataRepository repository : repositories) {
+ IQueryResult<IInstallableUnit> queryResult = repository.query(QueryUtil.createIUAnyQuery(), sub);
SubMonitor repositoryMonitor = SubMonitor.convert(sub, IProgressMonitor.UNKNOWN);
- for (int j = 0; j < config.length; j++) {
+ for (IConfigurationElement config1 : config) {
try {
- IIUAnalyzer verifier = (IIUAnalyzer) config[j].createExecutableExtension("class"); //$NON-NLS-1$
- String analyizerName = config[j].getAttribute("name"); //$NON-NLS-1$
+ IIUAnalyzer verifier = (IIUAnalyzer) config1.createExecutableExtension("class"); //$NON-NLS-1$
+ String analyizerName = config1.getAttribute("name"); //$NON-NLS-1$
if (verifier instanceof IUAnalyzer) {
((IUAnalyzer) verifier).setName(analyizerName);
}
- verifier.preAnalysis(repositories[i]);
+ verifier.preAnalysis(repository);
Iterator<IInstallableUnit> iter = queryResult.iterator();
while (iter.hasNext()) {
IInstallableUnit iu = iter.next();
@@ -67,9 +65,11 @@ public class RepositoryAnalyzer {
result.add(postAnalysisResult);
} catch (CoreException e) {
if (e.getCause() instanceof ClassNotFoundException) {
- result.add(new Status(IStatus.ERROR, Activator.ID, "Cannot find: " + config[j].getAttribute("class")));
- } else
+ result.add(new Status(IStatus.ERROR, Activator.ID,
+ "Cannot find: " + config1.getAttribute("class"))); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
e.printStackTrace();
+ }
}
}
repositoryMonitor.done();
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java
index 623897396..93fd4d994 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/RepositoryAnalyzerApplication.java
@@ -45,16 +45,17 @@ public class RepositoryAnalyzerApplication implements IApplication {
System.out.println("Repository Analyzer Finished succesfuly in " + time + " ms.");
else
System.out.println("Repository Analyzer Finished in " + time + " ms with status with errors.");
- for (int i = 0; i < children.length; i++) {
- if (children[i].isOK())
+ for (IStatus child : children) {
+ if (child.isOK()) {
System.out.print("[OK] ");
- else
+ } else {
System.out.print("[Error] ");
- System.out.println(children[i].getMessage());
- if (children[i].isMultiStatus() && children[i].getChildren() != null && children[i].getChildren().length > 0) {
- IStatus[] subChildren = children[i].getChildren();
- for (int j = 0; j < subChildren.length; j++) {
- System.out.println(" " + subChildren[j].getMessage());
+ }
+ System.out.println(child.getMessage());
+ if (child.isMultiStatus() && child.getChildren() != null && child.getChildren().length > 0) {
+ IStatus[] subChildren = child.getChildren();
+ for (IStatus subChild : subChildren) {
+ System.out.println(" " + subChild.getMessage());
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
index 87af4e37d..2ad1cb778 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AbstractRepositoryTask.java
@@ -152,10 +152,9 @@ public abstract class AbstractRepositoryTask extends Task {
DirectoryScanner scanner = fileset.getDirectoryScanner(getProject());
String[][] elements = new String[][] {scanner.getIncludedDirectories(), scanner.getIncludedFiles()};
for (int i = 0; i < 2; i++) {
- for (int j = 0; j < elements[i].length; j++) {
- File file = new File(fileset.getDir(), elements[i][j]);
+ for (String element : elements[i]) {
+ File file = new File(fileset.getDir(), element);
URI uri = file.toURI();
-
if (file.isFile() && file.getName().endsWith(".zip")) { //$NON-NLS-1$
uri = URIUtil.toJarURI(uri, null);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java
index d58211fa5..a2f49c70f 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/AntMirrorLog.java
@@ -53,8 +53,9 @@ public class AntMirrorLog implements IArtifactMirrorLog {
// Log any children of this status
IStatus[] nestedStatus = status.getChildren();
if (nestedStatus != null)
- for (int i = 0; i < nestedStatus.length; i++)
- log(nestedStatus[i]);
+ for (IStatus s : nestedStatus) {
+ log(s);
+ }
}
@Override
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
index 261042a2a..8c9097062 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/RemoveIUTask.java
@@ -91,9 +91,9 @@ public class RemoveIUTask extends AbstractRepositoryTask {
artifacts.removeDescriptor(key, new NullProgressMonitor());
} else {
IArtifactDescriptor[] descriptors = artifacts.getArtifactDescriptors(key);
- for (int j = 0; j < descriptors.length; j++) {
- if (filter.match(createDictionary(descriptors[j]))) {
- artifacts.removeDescriptor(descriptors[j], new NullProgressMonitor());
+ for (IArtifactDescriptor descriptor : descriptors) {
+ if (filter.match(createDictionary(descriptor))) {
+ artifacts.removeDescriptor(descriptor, new NullProgressMonitor());
} else {
removeMetadata = false;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/TaskHelper.java b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/TaskHelper.java
index 33bf77b01..5be773c85 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/TaskHelper.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src_ant/org/eclipse/equinox/p2/internal/repository/tools/tasks/TaskHelper.java
@@ -29,8 +29,8 @@ public class TaskHelper {
b.append('\n');
b.append(status.getMessage());
}
- for (int i = 0; i < nestedStatus.length; i++) {
- statusToString(nestedStatus[i], severities, b);
+ for (IStatus s : nestedStatus) {
+ statusToString(s, severities, b);
}
return b;
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeWriter.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeWriter.java
index 68b0f41bc..e06da2ba8 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeWriter.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/CompositeWriter.java
@@ -39,8 +39,9 @@ public class CompositeWriter extends XMLWriter implements XMLConstants {
return;
start(CHILDREN_ELEMENT);
attribute(COLLECTION_SIZE_ATTRIBUTE, children.length);
- for (int i = 0; i < children.length; i++)
- writeChild(children[i]);
+ for (URI child : children) {
+ writeChild(child);
+ }
end(CHILDREN_ELEMENT);
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
index 79e96f5d2..011417df1 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/persistence/XMLWriter.java
@@ -71,8 +71,8 @@ public class XMLWriter implements XMLConstants {
this.open = false;
this.indent = " "; //$NON-NLS-1$
if (piElements != null) {
- for (int i = 0; i < piElements.length; i++) {
- println(piElements[i].toString());
+ for (ProcessingInstruction piElement : piElements) {
+ println(piElement.toString());
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
index 7cd469d4a..99b3e9f41 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/CacheManager.java
@@ -274,11 +274,11 @@ public class CacheManager {
void deleteCache(URI repositoryLocation) {
for (String prefix : knownPrefixes) {
File[] cacheFiles = getCacheFiles(repositoryLocation, prefix);
- for (int i = 0; i < cacheFiles.length; i++) {
+ for (File cacheFile : cacheFiles) {
// delete the cache file if it exists
- safeDelete(cacheFiles[i]);
+ safeDelete(cacheFile);
// delete a resumable download if it exists
- safeDelete(new File(new File(cacheFiles[i].getParentFile(), DOWNLOADING), cacheFiles[i].getName()));
+ safeDelete(new File(new File(cacheFile.getParentFile(), DOWNLOADING), cacheFile.getName()));
}
}
}

Back to the top