-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException in Semver for hyphenated NPM version matches #5128
Labels
Comments
Even simpler, this fails import com.vdurmont.semver4j.Semver;
public class Main {
public static void main(String[] args) {
Semver semver = new Semver("3.1.4", Semver.SemverType.NPM);
System.out.println(semver.satisfies("^3.0.0-0"));
}
} This returns import com.vdurmont.semver4j.Semver;
public class Main {
public static void main(String[] args) {
Semver semver = new Semver("3.1.4", Semver.SemverType.NPM);
System.out.println(semver.satisfies("^2.9.12 || ^3.0.0"));
}
} |
A simple fix for this might be to strip off the "-#" in try {
final Semver v = new Semver(right, SemverType.NPM);
// strip hyphen in "left" here
return v.satisfies(left);
} catch (SemverException ex) {
LOGGER.trace("ignore", ex);
} |
Perhaps upgrading to https://github.com/semver4j/semver4j would be a good idea as the original lib development stalled |
jeremylong
added a commit
that referenced
this issue
Dec 10, 2022
jeremylong
added a commit
that referenced
this issue
Dec 10, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
As of the
7.4.0
release of DependencyCheck, we are encountering aNullPointerException
in the NodePackageAnalyzer when the match range has a hyphen.This is the exception I get in dependency-check when I run it against my node repository:
I know this isn't specifically a bug in DependencyCheck, but it is causing failures in our CI process.
see: vdurmont/semver4j#63
Version of dependency-check used
version 7.4.0
To Reproduce
This class throws a NPE
This returns true
The text was updated successfully, but these errors were encountered: