1 package org.apache.turbine.exception; 2 3 56 57 import org.apache.turbine.ExceptionHandler; 58 import org.apache.turbine.RunData; 59 import org.apache.turbine.Turbine; 60 import org.apache.turbine.ValveContext; 61 import org.apache.turbine.pipeline.DefaultTargetValve; 62 import org.apache.turbine.pipeline.CleanUpValve; 63 import org.apache.commons.lang.exception.ExceptionUtils; 64 65 73 public class DefaultExceptionHandler implements ExceptionHandler 74 { 75 78 public void handleException( RunData data, Throwable throwable ) 79 throws Exception 80 { 81 data.setTarget( Turbine.getConfiguration() 82 .getString( "template.error", "/Error.vm" ) ); 83 84 data.setStackTrace( ExceptionUtils.getStackTrace( throwable ), throwable ); 85 86 try 87 { 88 new DefaultTargetValve().invoke(data, new NullValveContext()); 90 } 91 finally 92 { 93 new CleanUpValve().invoke(data, new NullValveContext()); 95 } 96 } 97 98 103 protected final class NullValveContext implements ValveContext 104 { 105 108 public void invokeNext(RunData ignored) 109 { 110 } 112 } 113 } 114 | Popular Tags |