]> source.dussan.org Git - pf4j.git/commitdiff
Fixed Dependency version check fails even if required is * (#451)
authorwolframhaussig <13997737+wolframhaussig@users.noreply.github.com>
Sun, 13 Jun 2021 09:30:07 +0000 (11:30 +0200)
committerGitHub <noreply@github.com>
Sun, 13 Jun 2021 09:30:07 +0000 (12:30 +0300)
pf4j/src/main/java/org/pf4j/DefaultVersionManager.java
pf4j/src/test/java/org/pf4j/DefaultVersionManagerTest.java

index 8c60d085d5018e535ac606c147da502392d680fb..fc9bc47d3533b587a5adbd82ae71b06a8e5efdbd 100644 (file)
@@ -39,7 +39,7 @@ public class DefaultVersionManager implements VersionManager {
      */
     @Override
     public boolean checkVersionConstraint(String version, String constraint) {
-        return StringUtils.isNullOrEmpty(constraint) || Version.valueOf(version).satisfies(constraint);
+        return StringUtils.isNullOrEmpty(constraint) || "*".equals(constraint) || Version.valueOf(version).satisfies(constraint);
     }
 
     @Override
index 3a277db78f66afbbb9c1712022b21822b6b674d5..a7a007e2fd95e34a00d66595bac70726de1731b4 100644 (file)
@@ -39,6 +39,7 @@ public class DefaultVersionManagerTest {
     public void checkVersionConstraint() {
         assertFalse(versionManager.checkVersionConstraint("1.4.3", ">2.0.0")); // simple
         assertTrue(versionManager.checkVersionConstraint("1.4.3", ">=1.4.0 & <1.6.0")); // range
+        assertTrue(versionManager.checkVersionConstraint("undefined", "*"));
     }
 
     @Test