myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gurkan Erdogdu (JIRA)" <...@myfaces.apache.org>
Subject [jira] Created: (MYFACES-2796) org/apache/myfaces/shared/context/ExceptionHandlerImpl.java # getRootCause(Throwalbe) not work correctly
Date Thu, 08 Jul 2010 08:38:49 GMT
org/apache/myfaces/shared/context/ExceptionHandlerImpl.java # getRootCause(Throwalbe) not work
correctly
--------------------------------------------------------------------------------------------------------

                 Key: MYFACES-2796
                 URL: https://issues.apache.org/jira/browse/MYFACES-2796
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-314
    Affects Versions: 2.0.0
            Reporter: Gurkan Erdogdu


I throw exception from my EL method and handling exceptions with my custom exception handler.

//Exception class
public class MyException extends RuntimeException{
}

//Bean action method
//Using from #{bean.log} in a page
public String log(){
   if(ok){
      throw new MyException();
  }
}

I write custom exception handler with wrapped semantic.
public class MyExceptionHandler extends ExceptionHandlerWrapper{
         public void handle(){
                        .....................
			ExceptionQueuedEvent event = i.next();
			ExceptionQueuedEventContext context = (ExceptionQueuedEventContext) event
					.getSource();
			Throwable t = context.getException();
                        Throeable cause = getRootCause(t);  --> But it does not give MyException,
it gives ELEvaluationException!!!!
                 ...............
          }
}

Probiem is that http://svn.apache.org/repos/asf/myfaces/shared/trunk/core/src/main/java/org/apache/myfaces/shared/context/ExceptionHandlerImpl.java
 # getRootCause compare classes with equals(), but must use isAssignableFrom().
            
           //Current Implementation
           if (!clazz.equals(FacesException.class) && !clazz.equals(ELException.class))
            {
                return t;
            }
            
           //I think it must be
          if(!FacesException.isAssignableFrom(clazz) && !ELException.isAssignableFrom(clazz)){
             return t;
         }



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message