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:
Sasa Zivkov
2012-06-27 16:57:43 +02:00
parent 73c8dda3b2
commit ab006acf61

View File

@@ -141,12 +141,12 @@ public class Init extends SiteProgram {
}
final StringBuilder buf = new StringBuilder();
buf.append(why.getMessage());
why = why.getCause();
while (why != null) {
buf.append("\n caused by ");
buf.append(why.toString());
buf.append(why.getMessage());
why = why.getCause();
if (why != null) {
buf.append("\n caused by ");
}
}
throw die(buf.toString(), new RuntimeException("InitInjector failed", ce));
}