~ubuntu-branches/ubuntu/vivid/tomcat6/vivid-proposed

« back to all changes in this revision

Viewing changes to java/org/apache/catalina/valves/ErrorReportValve.java

  • Committer: Package Import Robot
  • Author(s): tony mancill
  • Date: 2013-08-03 21:50:20 UTC
  • mfrom: (1.2.9)
  • Revision ID: package-import@ubuntu.com-20130803215020-glb1brkoau0zxr5x
Tags: 6.0.37-1
* New upstream release.
  - Drop patches for CVE-2012-4534, CVE-2012-4431, CVE-2012-3546,
    CVE-2012-2733, CVE-2012-3439
  - Drop 0011-CVE-02012-0022-regression-fix.patch
  - Drop 0017-eclipse-compiler-update.patch
* Freshened remaining patches.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import java.io.IOException;
23
23
import java.io.Writer;
 
24
import java.util.Scanner;
24
25
 
25
26
import javax.servlet.ServletException;
26
27
import javax.servlet.http.HttpServletResponse;
45
46
 * @author <a href="mailto:nicolaken@supereva.it">Nicola Ken Barozzi</a> Aisa
46
47
 * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
47
48
 * @author Yoav Shapira
48
 
 * @version $Id: ErrorReportValve.java 939353 2010-04-29 15:50:43Z kkolinko $
 
49
 * @version $Id: ErrorReportValve.java 1417925 2012-12-06 14:51:43Z kkolinko $
49
50
 */
50
51
 
51
52
public class ErrorReportValve
155
156
 
156
157
        // Do nothing on a 1xx, 2xx and 3xx status
157
158
        // Do nothing if anything has been written already
158
 
        if ((statusCode < 400) || (response.getContentCount() > 0))
 
159
        if (statusCode < 400 || response.getContentCount() > 0 ||
 
160
                !response.isError()) {
159
161
            return;
 
162
        }
160
163
 
161
164
        String message = RequestUtil.filter(response.getMessage());
162
 
        if (message == null)
163
 
            message = "";
164
 
 
 
165
        if (message == null) {
 
166
            if (throwable != null) {
 
167
                String exceptionMessage = throwable.getMessage();
 
168
                if (exceptionMessage != null && exceptionMessage.length() > 0) {
 
169
                    message = RequestUtil.filter(
 
170
                            (new Scanner(exceptionMessage)).nextLine());
 
171
                }
 
172
            }
 
173
            if (message == null) {
 
174
                message = "";
 
175
            }
 
176
        }
 
177
        
165
178
        // Do nothing if there is no report for the specified status code
166
179
        String report = null;
167
180
        try {
168
 
            report = sm.getString("http." + statusCode, message);
 
181
            report = sm.getString("http." + statusCode);
169
182
        } catch (Throwable t) {
170
183
            ;
171
184
        }