Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 29 additions & 6 deletions src/main/java/org/spdx/tools/Verify.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,34 @@ public static void main(String[] args) {
} catch (InvalidFileNameException e) {
System.err.println("Invalid file name: "+args[0]);
System.exit(ERROR_STATUS);
}
if (verify.size() > 0) {
}
// separate out the warning from errors
List<String> warnings = new ArrayList<>();
List<String> errors = new ArrayList<>();
for (String verifyMsg:verify) {
if (verifyMsg.contains(" is deprecated.")) {
warnings.add(verifyMsg);
} else {
errors.add(verifyMsg);
}
}
if (errors.size() > 0) {
System.out.println("This SPDX Document is not valid due to:");
for (int i = 0; i < verify.size(); i++) {
System.out.print("\t" + verify.get(i)+"\n");
for (String errorMsg:errors) {
System.out.print("\t" + errorMsg+"\n");
}
System.exit(ERROR_STATUS);
} else {
}
if (warnings.size() > 0) {
System.out.println("Warning: Deprecated license identifiers were found that should no longer be used.\n"
+ "References to the following deprecated license ID's should be updated:");
for (String warningMsg:warnings) {
System.out.print("\t" + warningMsg+"\n");
}
}
if (errors.size() == 0) {
System.out.println("This SPDX Document is valid.");
} else {
System.exit(ERROR_STATUS);
}
}

Expand Down Expand Up @@ -178,6 +197,10 @@ public static List<String> verify(String filePath, SerFileType fileType) throws
if (!verify.isEmpty()) {
for (String verifyMsg:verify) {
if (!retval.contains(verifyMsg)) {
// Check for deprecated licenses - should be warnings, not errors
if (verifyMsg.contains(" is deprecated.")) {
verifyMsg = verifyMsg.replaceAll("error:", "warning:");
}
retval.add(verifyMsg);
}
}
Expand Down