[ 
https://issues.jboss.org/browse/SEAMCATCH-48?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12587253#comment-12587253
 ] 

yangju commented on SEAMCATCH-48:
---------------------------------

Controller:
@Named("myController")
public class MyController implements Serializable {


    @Inject
    Logger log;

    @Inject
    UserSession userSession;

   
   
    
   

    public void search() {
        log.info("search is called.");
        try {
                 if(true){
                        throw new NullPointerException("artifical NPE");
        }
            
    }

   
}

View (Primefaces 2.2)
<p:commandButton action="#{myController.search}"                        
update="id_my_form" value="#{msg.Search}"></p:commandButton>

Exception handler:
@HandlesExceptions
public class StandardExceptionHandler {

    private MessageUtils mu;
    @Inject
    Logger log;

    @PostConstruct
    public void init() {
       
    }

    
    public void nullPointerHandlerInWeb(@Handles 
CaughtException<NullPointerException> event, HttpServletResponse response) {
        log.error("Something bad happened in web: " + 
event.getException().getMessage());
        event.handled();
    }
    
    public void nullPointerHandler(@Handles(precedence =200) 
CaughtException<NullPointerException> event) {
        log.error("Something bad happened: " + 
event.getException().getMessage());
        event.handled();
    }

    public void illegalArgumenBreadthFirsttHandler(
            @Handles(during = TraversalMode.BREADTH_FIRST) 
CaughtException<IllegalArgumentException> event,
            HttpServletResponse response) {

        event.dropCause();
    }

    public void illegalArgumentHandler(@Handles 
CaughtException<IllegalArgumentException> event,
            HttpServletResponse response) {

        event.handled();
    }

    public void illegalStateHandler(@Handles 
CaughtException<IllegalStateException> event, HttpServletResponse response) {

        event.abort();
    }

    public void ioExceptionHandler(@Handles CaughtException<IOException> event, 
HttpServletResponse response) {
        event.rethrow(new ArithmeticException("Re-thrown"));
    }
    




> HandlesException never got invoked in jboss AS 6 Final
> ------------------------------------------------------
>
>                 Key: SEAMCATCH-48
>                 URL: https://issues.jboss.org/browse/SEAMCATCH-48
>             Project: Seam Catch
>          Issue Type: Bug
>         Environment: jboss AS 6 with seam 3 persistence, seam 3 Config, seam 
> 3 internationalizarion, jsf 2
>            Reporter: yangju
>            Assignee: Jason Porter
>
> I have the following method in my exception handler class:
>  public void nullPointerHandler(@Handles(precedence =200) 
> CaughtException<NullPointerException> event) {
>         log.error("Something bad happened: " + 
> event.getException().getMessage());
>         event.handled();
>     }
> I throw an artificial NPE from my weld managed bean (jsf controller), but the 
> exception seems to be handled first by JSF facesException handler and never 
> reached to the seam catch handler.
> Is this a bug or did I do something wrong?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
seam-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/seam-issues

Reply via email to