Browse Source

Fixed Dependency version check fails even if required is * (#451)

pull/453/head
wolframhaussig 3 years ago committed by GitHub
parent
commit
a6bcc3bb33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      pf4j/src/main/java/org/pf4j/DefaultVersionManager.java
  2. 1
      pf4j/src/test/java/org/pf4j/DefaultVersionManagerTest.java

2
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

1
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

Loading…
Cancel
Save