Coverage Report - org.apache.tapestry.error.RequestExceptionReporterImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RequestExceptionReporterImpl
0% 
0% 
1.333
 
 1  
 // Copyright 2004, 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.error;
 16  
 
 17  
 import org.apache.commons.logging.Log;
 18  
 import org.apache.tapestry.util.exception.ExceptionAnalyzer;
 19  
 import org.apache.tapestry.web.WebRequest;
 20  
 import org.apache.tapestry.web.WebSession;
 21  
 
 22  
 /**
 23  
  * @author Howard M. Lewis Ship
 24  
  * @since 4.0
 25  
  */
 26  0
 public class RequestExceptionReporterImpl implements RequestExceptionReporter
 27  
 {
 28  
 
 29  
     private Log _log;
 30  
 
 31  
     private WebRequest _request;
 32  
 
 33  
     public void setLog(Log log)
 34  
     {
 35  0
         _log = log;
 36  0
     }
 37  
 
 38  
     public void setRequest(WebRequest request)
 39  
     {
 40  0
         _request = request;
 41  0
     }
 42  
 
 43  
     public void reportRequestException(String message, Throwable cause)
 44  
     {
 45  0
         _log.warn(message, cause);
 46  
 
 47  0
         System.err
 48  
                 .println("\n\n**********************************************************\n\n");
 49  
 
 50  0
         System.err.println(message);
 51  
 
 52  0
         System.err.println("\n");
 53  
 
 54  0
         WebSession session = _request.getSession(false);
 55  
 
 56  0
         if (session != null)
 57  0
             System.err.println("      Session id    : " + session.getId());
 58  
 
 59  0
         System.err.println("\nExceptions:\n");
 60  
 
 61  0
         new ExceptionAnalyzer().reportException(cause, System.err);
 62  
 
 63  0
         System.err
 64  
                 .println("\n**********************************************************\n");
 65  0
     }
 66  
 
 67  
 }