Commit 714672bd authored by Marijan Milicevic's avatar Marijan Milicevic

ESSENTIALS-1046 Improve handling of missing project.basedir property

- log error messages without stacktrace (stacktrace logged only in debug mode)
parent 7f616974
......@@ -52,11 +52,13 @@ public class RequirementsCheckFilter implements Filter {
return;
}
if (!file.isDirectory()) {
sendRedirect(req, res, "Directory: " + directory + " must be a directory");
sendRedirect(req, res, "File: " + directory + " must be a directory");
return;
}
} catch (IllegalStateException e) {
log.error("Error processing req", e);
if (log.isDebugEnabled()) {
log.error("Error processing request:", e);
}
sendRedirect(req, res, e.getMessage());
return;
}
......@@ -65,6 +67,7 @@ public class RequirementsCheckFilter implements Filter {
private void sendRedirect(final ServletRequest req, final ServletResponse resp, final String error) throws IOException {
final HttpServletResponse response = (HttpServletResponse) resp;
log.error(error);
req.setAttribute("error", error);
response.sendError(HttpServletResponse.SC_SERVICE_UNAVAILABLE, error);
}
......
......@@ -116,7 +116,7 @@ public final class ProjectUtils {
if (System.getProperty(EssentialConst.PROJECT_BASEDIR_PROPERTY) != null && !System.getProperty(EssentialConst.PROJECT_BASEDIR_PROPERTY).isEmpty()) {
return System.getProperty(EssentialConst.PROJECT_BASEDIR_PROPERTY);
}
throw new IllegalStateException("System property 'project.basedir' was not null or empty. Please start your application with -D=project.basedir=/project/path");
throw new IllegalStateException("System property 'project.basedir' was null or empty. Please start your application with -D=project.basedir=/project/path");
}
public static String getEssentialsModuleName() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment