Browse Source

fix a bug related to plugin dependency

pull/3/head
Decebal Suiu 12 years ago
parent
commit
a2293ed9a8
  1. 2
      pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginDescriptorFinder.java
  2. 14
      pf4j/src/main/java/ro/fortsoft/pf4j/PluginDescriptor.java

2
pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginDescriptorFinder.java

@ -86,6 +86,6 @@ public class DefaultPluginDescriptorFinder implements PluginDescriptorFinder {
}
private boolean isEmpty(String value) {
return (value != null) && !value.isEmpty();
return (value == null) || value.isEmpty();
}
}

14
pf4j/src/main/java/ro/fortsoft/pf4j/PluginDescriptor.java

@ -13,7 +13,6 @@
package ro.fortsoft.pf4j;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@ -107,11 +106,22 @@ public class PluginDescriptor {
void setDependencies(String dependencies) {
if (dependencies != null) {
dependencies = dependencies.trim();
if (dependencies.isEmpty()) {
this.dependencies = Collections.emptyList();
} else {
this.dependencies = new ArrayList<PluginDependency>();
List<String> tokens = Arrays.asList(dependencies.split(","));
String[] tokens = dependencies.split(",");
for (String dependency : tokens) {
dependency = dependency.trim();
if (!dependency.isEmpty()) {
this.dependencies.add(new PluginDependency(dependency));
}
}
if (this.dependencies.isEmpty()) {
this.dependencies = Collections.emptyList();
}
}
} else {
this.dependencies = Collections.emptyList();
}

Loading…
Cancel
Save