%@ page import="com.atlassian.core.logging.DatedLoggingEvent" %> <%@ page import="com.atlassian.core.logging.ThreadLocalErrorCollection" %> <%@ page import="com.atlassian.core.ofbiz.util.OFBizPropertyUtils" %> <%@ page import="com.atlassian.core.util.collection.EasyList" %> <%@ page import="com.atlassian.jira.ComponentManager" %> <%@ page import="com.atlassian.jira.ManagerFactory" %> <%@ page import="com.atlassian.jira.security.Permissions" %> <%@ page import="com.atlassian.jira.service.JiraServiceContainer" %> <%@ page import="com.atlassian.jira.util.ExceptionInterpreterUtil" %> <%@ page import="com.atlassian.jira.util.system.ExtendedSystemInfoUtils" %> <%@ page import="com.atlassian.jira.util.system.ExtendedSystemInfoUtilsImpl" %> <%@ page import="com.atlassian.jira.util.system.SystemInfoUtils" %> <%@ page import="com.atlassian.jira.web.bean.I18nBean" %> <%@ page import="com.atlassian.jira.web.util.ExternalLinkUtil" %> <%@ page import="com.atlassian.jira.web.util.ExternalLinkUtilImpl" %> <%@ page import="com.atlassian.jira.web.util.JiraLocaleUtils" %> <%@ page import="com.atlassian.plugin.Plugin" %> <%@ page import="com.atlassian.plugin.PluginInformation" %> <%@ page import="com.atlassian.seraph.auth.DefaultAuthenticator"%> <%@ page import="com.opensymphony.module.propertyset.PropertySet"%> <%@ page import="com.opensymphony.user.User"%> <%@ page import="com.opensymphony.util.TextUtils"%> <%@ page import="org.apache.log4j.Logger"%> <%@ page import="org.apache.log4j.spi.LoggingEvent"%> <%@ page import="org.ofbiz.core.entity.GenericValue" %> <%@ page import="java.io.PrintWriter" %> <%@ page import="java.io.StringWriter" %> <%@ page import="java.util.*" %> <%@ page import="javax.servlet.ServletException" %> <%@ page isErrorPage="true" %> <%@ taglib uri="webwork" prefix="webwork" %> <%! private static final Logger log = Logger.getLogger("500ErrorPage.jsp"); %>
"))
{
line = ex.substring("".length(), ex.length());
}
else
{
line = ex;
}
line = line.substring(0, line.indexOf("
"));
}
else
line = "No exception";
}
else
{
if (exception != null)
{
Throwable cause = exception;
if (exception instanceof ServletException)
{
Throwable rootCause = ((ServletException) exception).getRootCause();
if (rootCause != null)
cause = rootCause;
}
//log exception to the log files, so that it gets captured somewhere.
log.error("Exception caught in 500 page " + cause.getMessage(), cause);
line = TextUtils.htmlEncode(cause.toString());
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
cause.printStackTrace(pw);
ex = TextUtils.htmlEncode(sw.toString());
}
}
String interpretedMsg = ExceptionInterpreterUtil.execute(extendedSystemInfoUtils, ex);
// Check that the user has the global admin permission to see the services/listeners params (JRA-12081)
HttpSession httpSession = request.getSession(false); //dont create the session if there isnt one
User remoteUser = httpSession != null ? (User) httpSession.getAttribute(DefaultAuthenticator.LOGGED_IN_KEY) : null;
boolean isGlobalAdmin = false;
boolean isSystemAdmin = false;
try {
isGlobalAdmin = remoteUser != null && ManagerFactory.getPermissionManager().hasPermission(Permissions.ADMINISTER, remoteUser);
isSystemAdmin = remoteUser != null && ManagerFactory.getPermissionManager().hasPermission(Permissions.SYSTEM_ADMIN, remoteUser);
} catch (Exception dontCare) {
log.error(dontCare);
}
List sysadminOnlyProperties = EasyList.build("Current Working Directory", "JVM Input Arguments", "Server ID");
%>
<% if(interpretedMsg != null && !"".equals(interpretedMsg.trim()))
{
%>
<%= interpretedMsg %>
<% }
else
{
%>
<% if (!isGlobalAdmin)
{ %>
<%
}
}
%>
<% if (isGlobalAdmin) { %>
<%}%>
"><%= externalLinkUtil.getProperty("external.link.jira.support.site") %>
<% out.println(extendedSystemInfoUtils.getLogPath());%>
:
<%= line %>
<% if(ex != null)
{
%>
: [hide]
<%= ex %>
<% }
else
{ %>
<%= TextUtils.htmlEncode((String) request.getAttribute("javax.servlet.error.message")) %>
<% } %>
:
<%= request.getHeader("Referer") != null ? request.getHeader("Referer") : "Unknown" %>
:
<%
final Map buildstats = extendedSystemInfoUtils.getBuildStats();
for (Iterator i = buildstats.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
%><%= entry.getKey() %> : <%
if (!isGlobalAdmin && "Server ID".equals(entry.getKey()))
{
%>
<%
}
else
{
%><%= entry.getValue() %>
<%
}
}
%>
:
: <%= application.getServerInfo() %>
: <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %>
:
<%
if (isSystemAdmin)
{%>
: <%= extendedSystemInfoUtils.getEntityEngineXmlPath()%>
: <%= extendedSystemInfoUtils.getLogPath()%>
<%}
else
{%>
<%}%>
:
<%
final Map jvmStats = extendedSystemInfoUtils.getJvmStats();
for (Iterator i = jvmStats.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
%><%= entry.getKey() %>: <%= entry.getValue() %>
<%
}
%>
:
<%
final Map sysinfo = extendedSystemInfoUtils.getProps();
for (Iterator i = sysinfo.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry) i.next();
%><%= entry.getKey() %> : <%
if (!isSystemAdmin && sysadminOnlyProperties.contains(entry.getKey()))
{
%>
<%
}
else
{
%><%= entry.getValue() %>
<%
}
}
%>
:
:
<%
JiraLocaleUtils jiraLocaleUtils = new JiraLocaleUtils();
final List installedLocales = jiraLocaleUtils.getInstalledLocales();
for (Iterator localeIt = installedLocales.iterator(); localeIt.hasNext();)
{
Locale locale = (Locale) localeIt.next();
%><%= locale.getDisplayName() %><% if (localeIt.hasNext()) { %>
<% }
}
%>
:
<%= extendedSystemInfoUtils.getDefaultLanguage() %><% if (extendedSystemInfoUtils.isUsingSystemLocale()) { %> - <% } %>
:
<%
try {
String encodedQueryString = request.getQueryString() == null ? " " : TextUtils.htmlEncode(request.getQueryString());
%>
- : <%= request.getRequestURL() %>
- : <%= request.getScheme() %>
- : <%= request.getServerName() %>
- : <%= request.getServerPort() %>
- : <%= request.getRequestURI() %>
- : <%= request.getContextPath() %>
- - : <%= request.getServletPath() %>
- - : <%= request.getPathInfo() %>
- - : <%= encodedQueryString %>
<%
Enumeration attributeNames = request.getAttributeNames();
while (attributeNames.hasMoreElements())
{
String name = (String) attributeNames.nextElement();
Object attribute = request.getAttribute(name);
%>
- <%= name %> : <%= TextUtils.htmlEncode(attribute == null ? "null" : attribute.toString()) %>
<%
}
%>
<%
}
catch (Throwable t)
{
out.println("Error rendering logging information - uh oh.");
t.printStackTrace(new PrintWriter(out));
}
%>
<%
try {
List list = ThreadLocalErrorCollection.getList();
%>
<%= list.size() %> log statements generated by this request:
<%
for (Iterator iterator = list.iterator(); iterator.hasNext();)
{
DatedLoggingEvent dle = (DatedLoggingEvent) iterator.next();
LoggingEvent loggingEvent = dle.getEvent();
Date date = dle.getDate();
%>
<%-- In case of backward compatibility issues with logging functions see JRA-5405 --%>
[<%= loggingEvent.getLevel() %>]
<%= date.toString() %>
[<%= loggingEvent.getLoggerName() %>]
<%= loggingEvent.getRenderedMessage() %>
<% if (loggingEvent.getThrowableInformation() != null) { %>
<%
final String[] throwableStrRep = loggingEvent.getThrowableStrRep();
for (int i = 0; i < throwableStrRep.length && i < 20; i++)
{
String s = throwableStrRep[i];
out.println(s + "
");
}
%>
<% } %>
<%
}
}
catch (Throwable t)
{
out.println("Error rendering logging information - uh oh.");
t.printStackTrace(new PrintWriter(out));
}
%>
<%-- LISTENERS - start --%>
<% try { %>
<%
final Collection listeners = extendedSystemInfoUtils.getListeners();
for (Iterator i = listeners.iterator(); i.hasNext();)
{
GenericValue gv = (GenericValue) i.next();
%>
- <%= gv.getString("name") %> (<%= gv.getString("clazz") %>)
<%
if (isGlobalAdmin)
{
final PropertySet propertySet = OFBizPropertyUtils.getPropertySet(gv);
final Collection keys = propertySet.getKeys("", 5);
if (keys != null && !keys.isEmpty())
{
for (Iterator j = keys.iterator(); j.hasNext();)
{
String key = (String) j.next();
%>
- <%= key %>: <%= propertySet.getString(key)%>
<%
}
}
}
%>
<%
}
%>
<%
}
catch (Exception e) {
System.out.println("Error getting listeners");
e.printStackTrace();
}
%>
<%-- LISTENERS - end --%>
<%-- SERVICES - start --%>
<%
try { %>
<%
final Collection services = extendedSystemInfoUtils.getServices();
for (Iterator i = services.iterator(); i.hasNext();)
{
JiraServiceContainer service = (JiraServiceContainer) i.next();
%>
- <%= service.getName() %> (<%= service.getServiceClass() %>)
- : <%= extendedSystemInfoUtils.getMillisecondsToMinutes(service.getDelay()) %>
<%
if (isGlobalAdmin)
{
final Map servicePropertyMap = extendedSystemInfoUtils.getServicePropertyMap(service);
if (servicePropertyMap != null && !servicePropertyMap.isEmpty())
{
for (Iterator j = servicePropertyMap.entrySet().iterator(); j.hasNext();)
{
Map.Entry entry = (Map.Entry) j.next();
%> - <%= entry.getKey() %>: <%= i18nBean.getText((String) entry.getValue()) %>
<%
}
}
}
}
%>
<%
}
catch (Exception e) {
System.out.println("Error getting services");
e.printStackTrace();
}
%>
<%-- SERVICES - end --%>
<%-- PLUGINS - start --%>
<% try { %>
<%
final Collection plugins = extendedSystemInfoUtils.getPlugins();
for (Iterator i = plugins.iterator(); i.hasNext();)
{
final Plugin plugin = (Plugin) i.next();
final PluginInformation pluginInformation = plugin.getPluginInformation();
%>
- <%= plugin.getName() %> <%= pluginInformation.getVersion() %> -
<%= pluginInformation.getVendorName() %>
<%
if (extendedSystemInfoUtils.isPluginEnabled(plugin))
{
%>
-
<%
}
else
{
%>
-
<%
}
final Map parameters = pluginInformation.getParameters();
if (parameters != null && !parameters.isEmpty())
{
for (Iterator j = parameters.entrySet().iterator(); j.hasNext();)
{
Map.Entry entry = (Map.Entry) j.next();
%> - <%= entry.getKey() %>: <%= i18nBean.getText((String) entry.getValue()) %>
<%
}
}
}
%>
<%
}
catch (Exception e) {
System.out.println("Error getting plugins");
e.printStackTrace();
}
%>
<%-- PLUGINS - end --%>