null check and debugging code per issue #1071

This commit is contained in:
Jeremy Long
2018-01-22 06:43:28 -05:00
parent 40f70c257d
commit 2ef3fdcc4e

View File

@@ -529,16 +529,16 @@ public class DependencyBundlingAnalyzer extends AbstractDependencyComparingAnaly
} else { } else {
if (!left.matches("^\\d.*$")) { if (!left.matches("^\\d.*$")) {
left = stripLeadingNonNumeric(left); left = stripLeadingNonNumeric(left);
if (left == null) { if (left == null || left.isEmpty()) {
return false; return false;
} }
} }
try { try {
Semver v = new Semver(left, SemverType.NPM); Semver v = new Semver(left, SemverType.NPM);
if (v.satisfies(right)) { if (!right.isEmpty() && v.satisfies(right)) {
return true; return true;
} }
if (!right.contains((" "))) { if (!right.contains(" ")) {
left = current; left = current;
right = stripLeadingNonNumeric(right); right = stripLeadingNonNumeric(right);
if (right != null) { if (right != null) {
@@ -548,6 +548,9 @@ public class DependencyBundlingAnalyzer extends AbstractDependencyComparingAnaly
} }
} catch (SemverException ex) { } catch (SemverException ex) {
LOGGER.trace("ignore", ex); LOGGER.trace("ignore", ex);
} catch (NullPointerException ex) {
LOGGER.error("SemVer comparison error: left:\"{}\", right:\"{}\"", left, right);
LOGGER.debug("SemVer comparison resulted in NPE", ex);
} }
} }
return false; return false;