]> source.dussan.org Git - pf4j.git/commitdiff
The requires Expression does not print well, instead we get the className. This fix...
authorJan Høydahl <janhoy@users.noreply.github.com>
Mon, 3 Apr 2017 17:39:23 +0000 (19:39 +0200)
committerDecebal Suiu <decebal.suiu@gmail.com>
Mon, 3 Apr 2017 17:39:23 +0000 (20:39 +0300)
pf4j/src/main/java/ro/fortsoft/pf4j/AbstractPluginManager.java
pf4j/src/main/java/ro/fortsoft/pf4j/PluginDescriptor.java
pf4j/src/test/java/ro/fortsoft/pf4j/PropertiesPluginDescriptorFinderTest.java

index c8cb41d804aa30d5d9be15a465d13114c7a8ec7d..96f2c1548d1d5144970246bc9533b0e36edecd48 100644 (file)
@@ -703,10 +703,11 @@ public abstract class AbstractPluginManager implements PluginManager {
             return true;
         }
 
-        log.warn("Plugin '{}:{}' requires a minimum system version of {}",
+        log.warn("Plugin '{}:{}' requires a minimum system version of {}, and you have {}",
             pluginWrapper.getPluginId(),
             pluginWrapper.getDescriptor().getVersion(),
-            requires);
+            pluginWrapper.getDescriptor().getRequiresString(),
+            system);
 
         return false;
     }
index aa018a19a2ed1557128da5cf82384e59373fcfd8..17f60af18c86c1e3de885ee56cf820e86365de1b 100644 (file)
@@ -37,6 +37,7 @@ public class PluginDescriptor {
     private String pluginClass;
     private Version version;
     private Expression requires;
+    private String requiresString;
     private String provider;
     private List<PluginDependency> dependencies;
     private String license;
@@ -81,6 +82,13 @@ public class PluginDescriptor {
         return requires;
     }
 
+    /**
+     * Returns the requires of this plugin as a string.
+     */
+    public String getRequiresString() {
+        return requiresString;
+    }
+
     /**
      * Returns the provider name of this plugin.
      */
@@ -108,7 +116,7 @@ public class PluginDescriptor {
                return "PluginDescriptor [pluginId=" + pluginId + ", pluginClass="
                                + pluginClass + ", version=" + version + ", provider="
                                + provider + ", dependencies=" + dependencies + ", description="
-                + pluginDescription + ", requires=" + requires + ", license="
+                + pluginDescription + ", requires=" + requiresString + ", license="
                                + license + "]";
        }
 
@@ -133,6 +141,7 @@ public class PluginDescriptor {
     }
 
     void setRequires(String requires) {
+        requiresString = requires;
         Parser<Expression> parser = ExpressionParser.newInstance();
         setRequires(parser.parse(requires));
     }
index ca6277068dd01eabeabcc6ef2d13c74cd541df6a..ddd839b809a54402cf28ab697c370a388977b086 100644 (file)
@@ -79,6 +79,7 @@ public class PropertiesPluginDescriptorFinderTest {
         assertEquals("test-plugin-3", plugin1.getDependencies().get(1).getPluginId());
         assertEquals("~1.0", plugin1.getDependencies().get(1).getPluginVersionSupport());
         assertEquals("Apache-2.0", plugin1.getLicense());
+        assertEquals("*", plugin1.getRequiresString());
         assertTrue(plugin1.getRequires().interpret(Version.valueOf("1.0.0")));
 
         assertEquals("test-plugin-2", plugin2.getPluginId());