KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > faces > core > event > FatalExceptionHandler


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.faces.core.event;
6
7 import java.util.List JavaDoc ;
8 import javax.faces.context.FacesContext ;
9 import javax.faces.component.UIViewRoot;
10 import org.exoplatform.container.SessionContainer ;
11 import org.exoplatform.faces.core.component.UIFatalError;
12 import org.exoplatform.services.log.LogUtil;
13 /**
14  * Jun 3, 2004
15  * @author: Tuan Nguyen
16  * @email: tuan08@users.sourceforge.net
17  * @version: $ID$
18  **/

19 public class FatalExceptionHandler extends ExceptionHandler {
20   
21   public boolean canHandleError(Throwable JavaDoc error) {
22     return true ;
23   }
24   
25     public void handle(ExoActionEvent action, Throwable JavaDoc error) {
26         UIViewRoot uiroot = FacesContext.getCurrentInstance().getViewRoot() ;
27         List JavaDoc children = uiroot.getChildren();
28         for(int i = 0; i < children.size(); i++) {
29             children.remove(i);
30         }
31         children.add(new UIFatalError(error)) ;
32     LogUtil.getLog(getClass()).error("Handle action " + action.getAction(), error) ;
33     }
34 }
35
Popular Tags