mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-23 17:41:28 +01:00
fixed incorrect parsing of license information
This commit is contained in:
@@ -281,6 +281,20 @@ public abstract class AbstractNpmAnalyzer extends AbstractFileTypeAnalyzer {
|
|||||||
final Object value = json.get("license");
|
final Object value = json.get("license");
|
||||||
if (value instanceof JsonString) {
|
if (value instanceof JsonString) {
|
||||||
dependency.setLicense(json.getString("license"));
|
dependency.setLicense(json.getString("license"));
|
||||||
|
} else if (value instanceof JsonArray) {
|
||||||
|
final JsonArray array = (JsonArray) value;
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
boolean addComma = false;
|
||||||
|
for (int x = 0; x < array.size(); x++) {
|
||||||
|
if (!array.isNull(x)) {
|
||||||
|
if (addComma) {
|
||||||
|
sb.append(", ");
|
||||||
|
} else {
|
||||||
|
addComma = true;
|
||||||
|
}
|
||||||
|
sb.append(array.getString(x));
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
dependency.setLicense(json.getJsonObject("license").getString("type"));
|
dependency.setLicense(json.getJsonObject("license").getString("type"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user