From a6bcc3bb33f7aee51ae8d6108f4cd28cf468054f Mon Sep 17 00:00:00 2001 From: wolframhaussig <13997737+wolframhaussig@users.noreply.github.com> Date: Sun, 13 Jun 2021 11:30:07 +0200 Subject: [PATCH] Fixed Dependency version check fails even if required is * (#451) --- pf4j/src/main/java/org/pf4j/DefaultVersionManager.java | 2 +- pf4j/src/test/java/org/pf4j/DefaultVersionManagerTest.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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 -- 2.39.5