mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-19 15:54:52 +01:00
improved error reporting for issue #547
This commit is contained in:
@@ -90,6 +90,7 @@ public class ExceptionCollection extends Exception {
|
|||||||
this.exceptions.add(exceptions);
|
this.exceptions.add(exceptions);
|
||||||
this.fatal = fatal;
|
this.fatal = fatal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new exception collection.
|
* Instantiates a new exception collection.
|
||||||
*
|
*
|
||||||
@@ -195,7 +196,7 @@ public class ExceptionCollection extends Exception {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void printStackTrace(PrintStream s) {
|
public void printStackTrace(PrintStream s) {
|
||||||
s.println("Multiple Exceptions Occured");
|
s.println("Multiple Exceptions Occurred");
|
||||||
super.printStackTrace(s);
|
super.printStackTrace(s);
|
||||||
for (Throwable t : this.exceptions) {
|
for (Throwable t : this.exceptions) {
|
||||||
s.println("Next Exception:");
|
s.println("Next Exception:");
|
||||||
@@ -204,11 +205,23 @@ public class ExceptionCollection extends Exception {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints the stack trace to standard error.
|
* Returns the error message, including the message from all contained
|
||||||
|
* exceptions.
|
||||||
|
*
|
||||||
|
* @return the error message
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void printStackTrace() {
|
public String getMessage() {
|
||||||
this.printStackTrace(System.err);
|
StringBuilder sb = new StringBuilder();
|
||||||
|
final String msg = super.getMessage();
|
||||||
|
if (msg == null || msg.isEmpty()) {
|
||||||
|
sb.append("One or more exceptions occured during analysis:");
|
||||||
|
} else {
|
||||||
|
sb.append(msg);
|
||||||
|
}
|
||||||
|
for (Throwable t : this.exceptions) {
|
||||||
|
sb.append("\n\t").append(t.getMessage());
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user