From: wolframhaussig <13997737+wolframhaussig@users.noreply.github.com> Date: Sun, 13 Jun 2021 09:30:07 +0000 (+0200) Subject: Fixed Dependency version check fails even if required is * (#451) X-Git-Tag: release-3.7.0~13 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a6bcc3bb33f7aee51ae8d6108f4cd28cf468054f;p=pf4j.git Fixed Dependency version check fails even if required is * (#451) --- diff --git a/pf4j/src/main/java/org/pf4j/DefaultVersionManager.java b/pf4j/src/main/java/org/pf4j/DefaultVersionManager.java index 8c60d08..fc9bc47 100644 --- a/pf4j/src/main/java/org/pf4j/DefaultVersionManager.java +++ b/pf4j/src/main/java/org/pf4j/DefaultVersionManager.java @@ -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 diff --git a/pf4j/src/test/java/org/pf4j/DefaultVersionManagerTest.java b/pf4j/src/test/java/org/pf4j/DefaultVersionManagerTest.java index 3a277db..a7a007e 100644 --- a/pf4j/src/test/java/org/pf4j/DefaultVersionManagerTest.java +++ b/pf4j/src/test/java/org/pf4j/DefaultVersionManagerTest.java @@ -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