xref: /OpenGrok/opengrok-web/src/main/webapp/error.jsp (revision aa18fa2876e3629259023f79466c3f639b53b9d0) !
1<%--
2CDDL HEADER START
3
4The contents of this file are subject to the terms of the
5Common Development and Distribution License (the "License").
6You may not use this file except in compliance with the License.
7
8See LICENSE.txt included in this distribution for the specific
9language governing permissions and limitations under the License.
10
11When distributing Covered Code, include this CDDL HEADER in each
12file and include the License file at LICENSE.txt.
13If applicable, add the following below this CDDL HEADER, with the
14fields enclosed by brackets "[]" replaced with your own identifying
15information: Portions Copyright [yyyy] [name of copyright owner]
16
17CDDL HEADER END
18
19Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
20Portions Copyright 2011 Jens Elkner.
21Portions Copyright (c) 2018, Chris Fraire <cfraire@me.com>.
22
23--%>
24<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
25<%@page import="jakarta.servlet.http.HttpServletResponse"%>
26<%@ page session="false" isErrorPage="true" import="
27java.io.PrintWriter,
28java.io.StringWriter,
29
30org.opengrok.indexer.web.Util"
31%><%
32/* ---------------------- error.jsp start --------------------- */
33{
34    PageConfig cfg = PageConfig.get(request);
35    cfg.setTitle("Error!");
36
37    // Set status to Internal error. This should help to avoid caching
38    // the page by some proxies.
39    response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
40
41    String context = request.getContextPath();
42}
43%><%@
44
45include file="httpheader.jspf"
46
47%>
48<body>
49<div id="page">
50    <header id="whole_header">
51        <%@include file="pageheader.jspf" %>
52    </header>
53<%
54{
55    PageConfig cfg = PageConfig.get(request);
56    String configError = "";
57    if (cfg.getSourceRootPath() == null || cfg.getSourceRootPath().isEmpty()) {
58        configError = "The source root path has not been configured! "
59            + "Please configure your webapp.";
60    } else if (!cfg.getEnv().getSourceRootFile().isDirectory()) {
61        configError = "The source root " +  cfg.getEnv().getSourceRootPath()
62            + " specified in your configuration does "
63            + "not point to a valid directory! Please configure your webapp.";
64    }
65%><h3 class="error">There was an error!</h3>
66    <p class="error"><%= configError %></p><%
67    if (exception != null) {
68%>
69        <p class="error"><%= exception.getMessage() %></p>
70        <pre><%
71        StringWriter wrt = new StringWriter();
72        PrintWriter prt = new PrintWriter(wrt);
73        exception.printStackTrace(prt);
74        prt.close();
75        out.write(Util.htmlize(wrt.toString()));
76        %></pre><%
77    } else {
78        %><p class="error">Unknown Error</p><%
79    }
80}
81/* ---------------------- error.jsp end --------------------- */
82%><%@
83
84include file="foot.jspf"
85
86%>
87