Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2018-08-13 06:53:58 -0400
committerAlexander Kurtakov2018-08-13 06:55:20 -0400
commitc26c1d7d18a07fc62dc445b4e03ed1d588464ef2 (patch)
tree4316e6ead3f63c410715c2664e8dcf771eac0914
parent6b5371284d8303c3c632a7f4bee5711ff4f28fb3 (diff)
downloadrt.equinox.p2-c26c1d7d18a07fc62dc445b4e03ed1d588464ef2.tar.gz
rt.equinox.p2-c26c1d7d18a07fc62dc445b4e03ed1d588464ef2.tar.xz
rt.equinox.p2-c26c1d7d18a07fc62dc445b4e03ed1d588464ef2.zip
Fix ArtifactRepositoryValidator creation error message.
The error message has a placeholder for reporting the comparator id requested but not existing but it was not binded. Also some for-each conversions in the file while on it. Change-Id: Ie28554fa346a720c43b583a6a5941ced7f7086c6 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java29
1 files changed, 14 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java
index 0e72a5412..71de1e08e 100644
--- a/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java
+++ b/bundles/org.eclipse.equinox.p2.repository.tools/src/org/eclipse/equinox/p2/internal/repository/tools/ArtifactRepositoryValidator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,10 +10,6 @@
*******************************************************************************/
package org.eclipse.equinox.p2.internal.repository.tools;
-import org.eclipse.equinox.p2.repository.tools.comparator.ArtifactComparatorFactory;
-import org.eclipse.equinox.p2.repository.tools.comparator.IArtifactComparator;
-
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository;
@@ -21,6 +17,9 @@ import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.repository.artifact.*;
+import org.eclipse.equinox.p2.repository.tools.comparator.ArtifactComparatorFactory;
+import org.eclipse.equinox.p2.repository.tools.comparator.IArtifactComparator;
+import org.eclipse.osgi.util.NLS;
public class ArtifactRepositoryValidator {
@@ -30,7 +29,7 @@ public class ArtifactRepositoryValidator {
try {
comparator = ArtifactComparatorFactory.getArtifactComparator(comparatorId);
} catch (IllegalArgumentException e) {
- throw new ProvisionException(Messages.invalidComparatorId, e);
+ throw new ProvisionException(NLS.bind(Messages.invalidComparatorId, comparatorId), e);
}
}
@@ -39,8 +38,8 @@ public class ArtifactRepositoryValidator {
return validateComposite((CompositeArtifactRepository) repository);
IQueryResult<IArtifactKey> queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, new NullProgressMonitor());
- for (Iterator<IArtifactKey> iterator = queryResult.iterator(); iterator.hasNext();) {
- IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(iterator.next());
+ for (IArtifactKey iArtifactKey : queryResult) {
+ IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(iArtifactKey);
for (int i = 0; i < descriptors.length - 2; i++) {
IStatus compareResult = comparator.compare(repository, descriptors[i], repository, descriptors[i + 1]);
if (!compareResult.isOK()) {
@@ -54,8 +53,7 @@ public class ArtifactRepositoryValidator {
public IStatus validateComposite(CompositeArtifactRepository repository) {
List<IArtifactRepository> repos = repository.getLoadedChildren();
IQueryResult<IArtifactKey> queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, new NullProgressMonitor());
- for (Iterator<IArtifactKey> iterator = queryResult.iterator(); iterator.hasNext();) {
- IArtifactKey key = iterator.next();
+ for (IArtifactKey key : queryResult) {
IArtifactRepository firstRepo = null;
for (IArtifactRepository child : repos) {
if (child.contains(key)) {
@@ -66,10 +64,11 @@ public class ArtifactRepositoryValidator {
IArtifactDescriptor[] d1 = firstRepo.getArtifactDescriptors(key);
IArtifactDescriptor[] d2 = child.getArtifactDescriptors(key);
- //If we assume each repo is internally consistant, we only need to compare one descriptor from each repo
+ // If we assume each repo is internally consistant, we only need to compare one
+ // descriptor from each repo
IStatus compareResult = comparator.compare(firstRepo, d1[0], child, d2[0]);
if (!compareResult.isOK()) {
- //LogHelper.log(compareResult);
+ // LogHelper.log(compareResult);
return compareResult;
}
}
@@ -80,12 +79,12 @@ public class ArtifactRepositoryValidator {
public IStatus validateComposite(CompositeArtifactRepository composite, IArtifactRepository repository) {
IQueryResult<IArtifactKey> queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, new NullProgressMonitor());
- for (Iterator<IArtifactKey> iterator = queryResult.iterator(); iterator.hasNext();) {
- IArtifactKey key = iterator.next();
+ for (IArtifactKey key : queryResult) {
if (composite.contains(key)) {
IArtifactDescriptor[] d1 = composite.getArtifactDescriptors(key);
IArtifactDescriptor[] d2 = repository.getArtifactDescriptors(key);
- //If we assume each repo is internally consistant, we only need to compare one descriptor from each repo
+ // If we assume each repo is internally consistant, we only need to compare one
+ // descriptor from each repo
IStatus compareResult = comparator.compare(composite, d1[0], repository, d2[0]);
if (!compareResult.isOK())
return compareResult;

Back to the top