[Fixed JENKINS-13129] Updating built-in plugins doesn't work, the file doesn't get pinned and is overwritten on the next startup

changed bundled plugin detection, added unit test
This commit is contained in:
Alex Lehmann committed 2012-03-27 17:12:33 +02:00
1 parent 5454d17c33
commit 2453985ca5
2 files changed
+74 -1

No files matched your search

+10 -1
View File
@@ -196,7 +196,7 @@ public abstract class PluginManager extends AbstractModelObject {
PluginWrapper p = strategy.createPluginWrapper(arc);
if (isDuplicate(p)) return;
p.isBundled = bundledPlugins.contains(arc.getName());
p.isBundled = containsHpiJpi(bundledPlugins, arc.getName());
plugins.add(p);
} catch (IOException e) {
failedPlugins.add(new FailedPlugin(arc.getName(),e));
@@ -344,6 +344,15 @@ public abstract class PluginManager extends AbstractModelObject {
}});
}
/*
* contains operation that considers xxx.hpi and xxx.jpi as equal
* this is necessary since the bundled plugins are still called *.hpi
*/
private boolean containsHpiJpi(Collection<String> bundledPlugins, String name) {
return bundledPlugins.contains(name.replaceAll("\\.hpi",".jpi"))
|| bundledPlugins.contains(name.replaceAll("\\.jpi",".hpi"));
}
/**
* TODO: revisit where/how to expose this. This is an experiment.
*/