From: Alex <a...@cbnl.com>

This string most likely contains useful information when debugging
errors. This can include things like the actual compile error and line
it occurred on instead of an unhelpful back-trace caused by the
org.apache.jasper.JasperException.

As this has the potential to leak sensitive information this is
disabled by default and can be enabled by setting:

opennms.webapp.exception_info=true

in the opennms.properties file
---
 .../src/main/filtered/etc/opennms.properties       |    6 ++++++
 .../src/main/webapp/errors/unknownexception.jsp    |   14 ++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/opennms-base-assembly/src/main/filtered/etc/opennms.properties 
b/opennms-base-assembly/src/main/filtered/etc/opennms.properties
index 6c99752..8683830 100644
--- a/opennms-base-assembly/src/main/filtered/etc/opennms.properties
+++ b/opennms-base-assembly/src/main/filtered/etc/opennms.properties
@@ -138,6 +138,12 @@ opennms.bin.dir=${install.bin.dir}
 opennms.webapplogs.dir=${install.webapplogs.dir}
 java.awt.headless=true
 
+# show extra debug info in web-ui exceptions
+# by default this is disabled as it has the potential to leak sensitive 
information
+# however for submitting debug information it can give a bit more for the 
developers
+# to go on
+# opennms.webapp.exception_info=false
+
 # findByServiceType query
 # org.opennms.dao.ipinterface.findByServiceType=select distinct ipIf from 
OnmsIpInterface as ipIf join ipIf.monitoredServices as monSvc where 
monSvc.serviceType.name = ?
 
diff --git a/opennms-webapp/src/main/webapp/errors/unknownexception.jsp 
b/opennms-webapp/src/main/webapp/errors/unknownexception.jsp
index 9ddf9f6..19f0f79 100644
--- a/opennms-webapp/src/main/webapp/errors/unknownexception.jsp
+++ b/opennms-webapp/src/main/webapp/errors/unknownexception.jsp
@@ -94,6 +94,7 @@ function toggleDiv(divName) {
 
 <%
 StringBuilder stBuilder = new StringBuilder();
+StringBuilder exBuilder = new StringBuilder();
 
 if (exception != null) {
   if (exception instanceof ServletException && 
((ServletException)exception).getRootCause() != null) {
@@ -105,6 +106,18 @@ if (exception != null) {
   for (StackTraceElement ste : exception.getStackTrace()) {
     stBuilder.append("\tat ").append(ste.toString()).append("\n");
   }
+
+  String exception_info = System.getProperty("opennms.webapp.exception_info", 
"false");
+  boolean exception_info_bool = Boolean.parseBoolean(exception_info);
+  if (exception_info_bool) {
+    exBuilder.append("Exception info:");
+    exBuilder.append("<pre>");
+    exBuilder.append(exception.toString());
+    exBuilder.append("</pre>");
+  } else {
+    exBuilder.append("Enable opennms.webapp.exception_info for more verbose 
error reporting");
+  }
+
 } else {
   stBuilder.append("No exception to see here, please move along.");
 }
@@ -153,6 +166,7 @@ userSession.setAttribute("errorReportDetails", 
errorDetails);
 <p>
 Please include the information below when reporting problems.
 </p>
+<%=exBuilder.toString()%>
 
 <h3>Exception Trace</h3>
   <pre id="exceptionTrace">
-- 
1.7.5.2


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev
_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

opennms-devel mailing list

To *unsubscribe* or change your subscription options, see the bottom of this 
page:
https://lists.sourceforge.net/lists/listinfo/opennms-devel

Reply via email to