tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lar...@locus.apache.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/context DefaultCMSetter.java
Date Thu, 21 Sep 2000 10:25:14 GMT
larryi      00/09/21 03:25:11

  Modified:    src/share/org/apache/tomcat/context Tag: tomcat_32
                        DefaultCMSetter.java
  Log:
  I didn't see simple way to configure stack traces off, so I removed them
  from ExceptionHandler() for security reasons.  If I have missed a simple
  configuration method, they can be restored.
  
  As an alternative, I added DisplayException.jsp to "/examples/jsp".
  If set as the error page for java.lang.Throwable, you will get roughly the
  same behavior that ExceptionHandler used to provide. Information about
  how to do this displays with the page is executed directly.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.45.2.3  +28 -3     jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/context/DefaultCMSetter.java,v
  retrieving revision 1.45.2.2
  retrieving revision 1.45.2.3
  diff -u -r1.45.2.2 -r1.45.2.3
  --- DefaultCMSetter.java	2000/09/20 11:30:32	1.45.2.2
  +++ DefaultCMSetter.java	2000/09/21 10:25:09	1.45.2.3
  @@ -233,8 +233,13 @@
   
   	buf.append("<b>")
   	    .append(sm.getString("defaulterrorpage.internalservleterror"))
  -	    .append("</b><br>");
  -        buf.append("<pre>");
  +	    .append("</b>")
  +	    .append(e.getMessage())
  +	    .append("<br>\r\n");
  +	    //.append("</b><br>");
  +
  +/* Disable stack trace for security reasons
  +	buf.append("<pre>");
   
   	StringWriter sw = new StringWriter();
   	PrintWriter pw = new PrintWriter(sw);
  @@ -243,13 +248,18 @@
   	buf.append(sw.toString());
   
   	buf.append("</pre>\r\n");
  +*/
   
           if (e instanceof ServletException) {
   	    Throwable cause = ((ServletException)e).getRootCause();
   	    if (cause != null) {
   		buf.append("<b>")
   		    .append(sm.getString("defaulterrorpage.rootcause"))
  -		    .append("</b>\r\n");
  +		    .append("</b>")
  +		    .append(cause.getMessage())
  +		    .append("\r\n");
  +		    //.append("</b>\r\n");
  +/*
   	    buf.append("<pre>");
   
   	    sw=new StringWriter();
  @@ -258,6 +268,7 @@
   	    buf.append( sw.toString());
   
   	    buf.append("</pre>\r\n");
  +*/
   	    }
   	}
   	
  @@ -296,6 +307,18 @@
   	int sc=res.getStatus();
   	
   	StringBuffer buf = new StringBuffer();
  +	buf.append("<head><title>");
  +	if( res.isIncluded() ) {
  +	    // use error code from include
  +	    sc = ((Integer)req.getAttribute("javax.servlet.error.status_code")).intValue();
  +	    buf.append(sm.getString("defaulterrorpage.includedservlet") );
  +	}  else {
  +	    buf.append("Error: ");
  +	}
  +
  +	buf.append( sc );
  +	buf.append("</title></head>\r\n");
  +
   	buf.append("<h1>");
   	if( res.isIncluded() ) {
   	    buf.append(sm.getString("defaulterrorpage.includedservlet") );
  @@ -315,6 +338,8 @@
   	buf.append("<b>")
   	    .append(msg)
   	    .append("</b><br>");
  +
  +	buf.append("</body>\r\n");
   
   	if( res.isUsingStream() ) {
   	    ServletOutputStream out = res.getOutputStream();
  
  
  

Mime
View raw message