Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Arthorne2010-05-18 15:01:07 -0400
committerJohn Arthorne2010-05-18 15:01:07 -0400
commit70a21bb153e8e5a85004b69cd382067f529e4cc2 (patch)
treebdd801be05ec6e9d31b194a1b510365036630ba3
parentae998ea149fa88901f119329df1bed97f714b0ef (diff)
downloadrt.equinox.p2-70a21bb153e8e5a85004b69cd382067f529e4cc2.tar.gz
rt.equinox.p2-70a21bb153e8e5a85004b69cd382067f529e4cc2.tar.xz
rt.equinox.p2-70a21bb153e8e5a85004b69cd382067f529e4cc2.zip
Bug 313366 - SiteListener canonicalizes filenames many times
-rw-r--r--bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
index faffa378c..74e1307ef 100644
--- a/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
+++ b/bundles/org.eclipse.equinox.p2.extensionlocation/src/org/eclipse/equinox/internal/p2/extensionlocation/SiteListener.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 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
@@ -52,12 +52,21 @@ public class SiteListener extends DirectoryChangeListener {
private static boolean contains(String[] plugins, File file) {
String filename = file.getAbsolutePath();
for (int i = 0; i < plugins.length; i++)
- if (filename.endsWith(new File(plugins[i]).toString()))
+ if (filename.endsWith(plugins[i]))
return true;
return false;
}
/**
+ * Converts a list of file names to a normalized form suitable for comparison.
+ */
+ private String[] normalize(String[] filenames) {
+ for (int i = 0; i < filenames.length; i++)
+ filenames[i] = new File(filenames[i]).toString();
+ return filenames;
+ }
+
+ /**
* Given one repo and a base location, ensure cause the other repo to be loaded and then
* poll the base location once updating the repositories accordingly. This method is used to
* ensure that both the metadata and artifact repos corresponding to one location are
@@ -116,7 +125,7 @@ public class SiteListener extends DirectoryChangeListener {
if (listString != null)
for (StringTokenizer tokenizer = new StringTokenizer(listString, ","); tokenizer.hasMoreTokens();) //$NON-NLS-1$
listCollection.add(tokenizer.nextToken());
- this.list = listCollection.toArray(new String[listCollection.size()]);
+ this.list = normalize(listCollection.toArray(new String[listCollection.size()]));
}
/* (non-Javadoc)
@@ -275,7 +284,7 @@ public class SiteListener extends DirectoryChangeListener {
result.add(pluginLocation.toString());
}
}
- managedFiles = result.toArray(new String[result.size()]);
+ managedFiles = normalize(result.toArray(new String[result.size()]));
return managedFiles;
}

Back to the top