Polish
This commit is contained in:
parent
445589a5d2
commit
bfe4240ed2
|
|
@ -79,9 +79,9 @@ class DataSourceInitializer implements ApplicationListener<DataSourceInitialized
|
||||||
this.applicationContext.publishEvent(new DataSourceInitializedEvent(
|
this.applicationContext.publishEvent(new DataSourceInitializedEvent(
|
||||||
this.dataSource));
|
this.dataSource));
|
||||||
}
|
}
|
||||||
catch (IllegalStateException e) {
|
catch (IllegalStateException ex) {
|
||||||
logger.warn("Could not send event to complete DataSource initialization ("
|
logger.warn("Could not send event to complete DataSource initialization ("
|
||||||
+ e.getMessage() + ")");
|
+ ex.getMessage() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,18 +136,22 @@ class ErrorPageFilter extends AbstractConfigurableEmbeddedServletContainer imple
|
||||||
request.setAttribute(ERROR_EXCEPTION, ex);
|
request.setAttribute(ERROR_EXCEPTION, ex);
|
||||||
request.setAttribute(ERROR_EXCEPTION_TYPE, type.getName());
|
request.setAttribute(ERROR_EXCEPTION_TYPE, type.getName());
|
||||||
wrapped.sendError(500, ex.getMessage());
|
wrapped.sendError(500, ex.getMessage());
|
||||||
if (!wrapped.isCommitted()) {
|
forwardToErrorPage(errorPath, request, wrapped);
|
||||||
wrapped.reset();
|
}
|
||||||
request.getRequestDispatcher(errorPath).forward(request, wrapped);
|
|
||||||
}
|
private void forwardToErrorPage(String path, HttpServletRequest request,
|
||||||
else {
|
ServletResponse response) throws ServletException, IOException {
|
||||||
String message = "Cannot forward to error page for"
|
if (!response.isCommitted()) {
|
||||||
+ request.getRequestURI()
|
String message = "Cannot forward to error page for" + request.getRequestURI()
|
||||||
+ " (response is committed), so this response may have the wrong status code";
|
+ " (response is committed), so this response may have "
|
||||||
logger.error(message);
|
+ "the wrong status code";
|
||||||
// User might see the error page without all the data here but the exception
|
// User might see the error page without all the data here but the exception
|
||||||
// isn't going to help anyone (and it's already been logged)
|
// isn't going to help anyone (and it's already been logged)
|
||||||
|
logger.error(message);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
response.reset();
|
||||||
|
request.getRequestDispatcher(path).forward(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getErrorPath(Map<Integer, String> map, Integer status) {
|
private String getErrorPath(Map<Integer, String> map, Integer status) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue