Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMykola Nikishov2015-10-23 21:28:03 +0000
committerMykola Nikishov2015-11-23 11:19:53 +0000
commitd9057d09f6b96fd8b9988299d3eb5131f9a79a98 (patch)
treefa5019f6e21061cfdadf0253a259a9ce3147c0f0
parent8daabc702115b39bf52b561ad8e581b533661dc1 (diff)
downloadrt.equinox.p2-d9057d09f6b96fd8b9988299d3eb5131f9a79a98.tar.gz
rt.equinox.p2-d9057d09f6b96fd8b9988299d3eb5131f9a79a98.tar.xz
rt.equinox.p2-d9057d09f6b96fd8b9988299d3eb5131f9a79a98.zip
As both artifacts and metadata repository factories' order calculated in the same way, eliminate duplication by extracting this logic into a separate method. Change-Id: I5900fcf5126968715ea2f0720229942bf878381b Signed-off-by: Mykola Nikishov <mn@mn.com.ua>
-rw-r--r--bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java20
1 files changed, 5 insertions, 15 deletions
diff --git a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java
index 1b39fd416..4e23b38a0 100644
--- a/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java
+++ b/bundles/org.eclipse.equinox.p2.repository/src/org/eclipse/equinox/internal/p2/repository/helpers/LocationProperties.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2010 EclipseSource and others. All rights reserved. This
+* Copyright (c) 2010, 2015 EclipseSource 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 http://www.eclipse.org/legal/epl-v10.html
@@ -169,9 +169,9 @@ public class LocationProperties {
if (VERSION.equals(entry.getKey())) {
this.version = Version.parseVersion((String) entry.getValue());
} else if (METADATA_REPOSITORY_FACTORY_ORDER.equals(entry.getKey())) {
- initMetadataRepositoryFactoryOrder((String) entry.getValue());
+ this.metadataSearchOrder = getRepositoryFactoryOrder((String) entry.getValue());
} else if (ARTIFACT_REPOSITORY_FACTORY_ORDER.equals(entry.getKey())) {
- initArtifactRepositoryFactoryOrder((String) entry.getValue());
+ this.artifactSearchOrder = getRepositoryFactoryOrder((String) entry.getValue());
} else if (((String) entry.getKey()).startsWith(MD5_HASH)) {
initHashMD5Hash((String) entry.getKey(), (String) entry.getValue());
}
@@ -188,23 +188,13 @@ public class LocationProperties {
// Empty for now
}
- private void initArtifactRepositoryFactoryOrder(String repositoryFactoryOrder) {
+ private String[] getRepositoryFactoryOrder(String repositoryFactoryOrder) {
repositoryFactoryOrder = repositoryFactoryOrder == null ? "" : repositoryFactoryOrder; //$NON-NLS-1$
StringTokenizer tokenizer = new StringTokenizer(repositoryFactoryOrder, ","); //$NON-NLS-1$
List<String> searchOrder = new ArrayList<String>();
while (tokenizer.hasMoreTokens()) {
searchOrder.add(tokenizer.nextToken().trim());
}
- this.artifactSearchOrder = searchOrder.toArray(new String[searchOrder.size()]);
- }
-
- private void initMetadataRepositoryFactoryOrder(String repositoryFactoryOrder) {
- repositoryFactoryOrder = repositoryFactoryOrder == null ? "" : repositoryFactoryOrder; //$NON-NLS-1$
- StringTokenizer tokenizer = new StringTokenizer(repositoryFactoryOrder, ","); //$NON-NLS-1$
- List<String> searchOrder = new ArrayList<String>();
- while (tokenizer.hasMoreTokens()) {
- searchOrder.add(tokenizer.nextToken().trim());
- }
- this.metadataSearchOrder = searchOrder.toArray(new String[searchOrder.size()]);
+ return searchOrder.toArray(new String[searchOrder.size()]);
}
}

Back to the top