Fix NPE that can hide guice CreationException on site init
Note that the --show-stack-trace option is needed to print the stack trace when a program stops with a Die exception. Change-Id: Icf6a9cb8b2c14841ad9c354985f7c12f583e84c8 Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
This commit is contained in:
@@ -141,12 +141,12 @@ public class Init extends SiteProgram {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final StringBuilder buf = new StringBuilder();
|
final StringBuilder buf = new StringBuilder();
|
||||||
buf.append(why.getMessage());
|
|
||||||
why = why.getCause();
|
|
||||||
while (why != null) {
|
while (why != null) {
|
||||||
buf.append("\n caused by ");
|
buf.append(why.getMessage());
|
||||||
buf.append(why.toString());
|
|
||||||
why = why.getCause();
|
why = why.getCause();
|
||||||
|
if (why != null) {
|
||||||
|
buf.append("\n caused by ");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
throw die(buf.toString(), new RuntimeException("InitInjector failed", ce));
|
throw die(buf.toString(), new RuntimeException("InitInjector failed", ce));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user