diff options
author | Mykola Nikishov | 2015-10-23 21:28:03 +0000 |
---|---|---|
committer | Mykola Nikishov | 2015-11-23 11:19:53 +0000 |
commit | d9057d09f6b96fd8b9988299d3eb5131f9a79a98 (patch) | |
tree | fa5019f6e21061cfdadf0253a259a9ce3147c0f0 | |
parent | 8daabc702115b39bf52b561ad8e581b533661dc1 (diff) | |
download | rt.equinox.p2-d9057d09f6b96fd8b9988299d3eb5131f9a79a98.tar.gz rt.equinox.p2-d9057d09f6b96fd8b9988299d3eb5131f9a79a98.tar.xz rt.equinox.p2-d9057d09f6b96fd8b9988299d3eb5131f9a79a98.zip |
Extract method to calculate repository factories' orderI20151229-0800I20151222-0800I20151215-0800I20151213-2000I20151209-2300I20151209-2000I20151209-0800I20151208-2000I20151208-0800I20151207-2000I20151207-0800I20151206-2000I20151203-1230I20151203-0800I20151201-1100I20151201-0800I20151124-1000I20151124-0800
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.java | 20 |
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()]); } } |