1 4 package com.openedit.error; 5 6 import java.util.ArrayList ; 7 import java.util.Iterator ; 8 import java.util.List ; 9 10 import com.openedit.WebPageRequest; 11 12 15 public class CompoundErrorHandler implements ErrorHandler 16 { 17 protected List fieldErrorHandlers; 18 19 public boolean handleError( Exception inException, WebPageRequest inContext ) 20 { 21 inContext.putPageValue( "oe-exception", inException ); 23 for ( Iterator iter = getErrorHandlers().iterator(); iter.hasNext(); ) 24 { 25 ErrorHandler errorHandler = (ErrorHandler) iter.next(); 26 if ( errorHandler.handleError( inException, inContext ) ) 27 { 28 return true; 29 } 30 } 31 return false; 32 } 33 34 public void addErrorHandler( ErrorHandler inErrorHandler ) 35 { 36 getErrorHandlers().add( inErrorHandler ); 37 } 38 public List getErrorHandlers() 39 { 40 if (fieldErrorHandlers == null) 41 { 42 fieldErrorHandlers = new ArrayList (); 43 } 44 return fieldErrorHandlers; 45 } 46 47 public void setErrorHandlers( List errorHandlers ) 48 { 49 fieldErrorHandlers = errorHandlers; 50 } 51 } 52 | Popular Tags |