Coverage Report - org.apache.tapestry.pages.Exception
 
Classes in this File Line Coverage Branch Coverage Complexity
Exception
0%
0/17
0%
0/6
1.429
 
 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.pages;
 16  
 
 17  
 import org.apache.tapestry.INamespace;
 18  
 import org.apache.tapestry.TapestryUtils;
 19  
 import org.apache.tapestry.engine.ISpecificationSource;
 20  
 import org.apache.tapestry.event.PageDetachListener;
 21  
 import org.apache.tapestry.html.BasePage;
 22  
 import org.apache.tapestry.util.exception.ExceptionAnalyzer;
 23  
 import org.apache.tapestry.util.exception.ExceptionDescription;
 24  
 
 25  
 /**
 26  
  * Default exception reporting page.
 27  
  * 
 28  
  * @author Howard Lewis Ship
 29  
  */
 30  
 
 31  0
 public abstract class Exception extends BasePage implements PageDetachListener
 32  
 {
 33  
     /** @since 4.1.4 */
 34  
     public abstract String getPagePackages();
 35  
     /** @since 4.1.4 */
 36  
     public abstract String getComponentPackages();
 37  
     /** @since 4.1.4 */
 38  
     public abstract ISpecificationSource getSpecificationSource();
 39  
 
 40  
     /** Transient property. */
 41  
     public abstract void setExceptions(ExceptionDescription[] exceptions);
 42  
 
 43  
     public void setException(Throwable value)
 44  
     {
 45  0
         ExceptionAnalyzer analyzer = new ExceptionAnalyzer();
 46  
 
 47  0
         ExceptionDescription[] exceptions = analyzer.analyze(value);
 48  
 
 49  0
         setExceptions(exceptions);
 50  0
     }
 51  
 
 52  
     public boolean isDynamic()
 53  
     {
 54  0
         return getRequestCycle().getResponseBuilder().isDynamic();
 55  
     }
 56  
     
 57  
     public String[] getPackages()
 58  
     {
 59  0
         INamespace namespace = getSpecificationSource().getApplicationNamespace();
 60  0
         String pages = namespace.getPropertyValue(getPagePackages());
 61  0
         String comps = namespace.getPropertyValue(getComponentPackages());
 62  
         
 63  0
         StringBuffer sb = new StringBuffer();
 64  0
         if (pages != null)
 65  
         {
 66  0
             sb.append(pages);
 67  
 
 68  0
             if (comps!=null)
 69  0
                 sb.append(",");
 70  
         }
 71  
         
 72  0
         if (comps != null)
 73  0
             sb.append(comps);
 74  
 
 75  0
         return TapestryUtils.split(sb.toString(), ',');
 76  
     }
 77  
 }