mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
fix plugin dependencys
fix npe in phonebook ui git-svn-id: http://svn.igniterealtime.org/svn/repos/spark/trunk@11747 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
committed by
michael.will
parent
4bd033ced7
commit
3f7374f36c
@ -440,19 +440,31 @@ public class PluginManager implements MainWindowListener {
|
||||
|
||||
if(plugin1.getName()!= null
|
||||
&& plugin1.getName().equals(dependency.getName())) {
|
||||
|
||||
// if the version is compatible then reorder
|
||||
if(dependency.compareVersion(plugin1.getVersion())){
|
||||
dependsfound = true;
|
||||
// when depended Plugin hadn't been installed yet
|
||||
if(j>i){
|
||||
|
||||
// find the position of plugins-List because it has more entries
|
||||
int counter = 0, x = 0, z = 0;
|
||||
for(Plugin plug : plugins) {
|
||||
// find the position of the aim-object
|
||||
if(plug.getClass().toString().substring(6).equals(publicPlugins.get(j).getPluginClass())) {
|
||||
x = counter;
|
||||
}
|
||||
// find the change-position
|
||||
else if(plug.getClass().toString().substring(6).equals(publicPlugins.get(i).getPluginClass())) {
|
||||
z = counter;
|
||||
}
|
||||
counter ++;
|
||||
}
|
||||
// change the order
|
||||
publicPlugins.add(i, publicPlugins.get(j));
|
||||
publicPlugins.remove(j+1);
|
||||
|
||||
plugins.add(i, plugins.get(j));
|
||||
plugins.remove(j+1);
|
||||
plugins.add(z, plugins.get(x));
|
||||
plugins.remove(x+1);
|
||||
|
||||
// start again, to check the other dependencies
|
||||
i--;
|
||||
@ -460,7 +472,7 @@ public class PluginManager implements MainWindowListener {
|
||||
}
|
||||
// else don't load the plugin and show an error
|
||||
else {
|
||||
Log.error("Depended Plugin " + dependency.getName() + " hasn't the right version (" + dependency.getVersion() + "<>" + ((PublicPlugin)publicPlugins.get(i)).getVersion());
|
||||
Log.error("Depended Plugin " + dependency.getName() + " hasn't the right version (" + dependency.getVersion() + "<>" + plugin1.getVersion());
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -469,9 +481,19 @@ public class PluginManager implements MainWindowListener {
|
||||
// if the depended Plugin wasn't found, then show error
|
||||
if(!dependsfound) {
|
||||
Log.error("Depended Plugin " + dependency.getName() + " is missing for the Plugin " + ((PublicPlugin)publicPlugins.get(i)).getName());
|
||||
|
||||
// find the posiion of plugins-List because it has more entries
|
||||
int counter = 0;
|
||||
for(Plugin plug : plugins) {
|
||||
// find the delete-position
|
||||
if(plug.getClass().toString().substring(6).equals(publicPlugins.get(i).getPluginClass())) {
|
||||
break;
|
||||
}
|
||||
counter ++;
|
||||
}
|
||||
// delete the Plugin, because the depended Plugin is missing
|
||||
publicPlugins.remove(i);
|
||||
plugins.remove(i);
|
||||
plugins.remove(counter);
|
||||
i--;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user