[seam-issues] [JBoss JIRA] Issue Comment Edited: (SOLDER-50) Throw a specialized exception when BeanManagerAware cannot resolve BeanManager

Dan Allen (JIRA) jira-events at lists.jboss.org
Fri Dec 10 09:35:52 EST 2010


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

Dan Allen edited comment on SOLDER-50 at 12/10/10 9:34 AM:
-----------------------------------------------------------

The issue that I have with isBeanManagerAvailable() is that when I call getBeanManager(), I pay the tax of looking it up again (when using the static BeanManagerAccessor). I have to use that in cases where class extension (w/ BeanManagerAware) isn't an option. Though, I could instead do:

BeanManagerAware locator = new BeanManagerAware();
if (locator.isBeanManagerAvailable())
{
   BeanManager beanManager = locator.getBeanManager();
   beanManager.fireEvent(payload);
}

In this context, the name of the class seems silly. It should probably be BeanManagerLocator. In fact, maybe we just do away with the static methods.

      was (Author: dan.j.allen):
    The issue that I have with isBeanManagerAvailable() is that when I call getBeanManager(), I pay the tax of looking it up again (when using the static BeanManagerAccessor). I have to use that in cases where extension isn't an option. Though, I could instead do:

BeanManagerAware locator = new BeanManagerAware();
if (locator.isBeanManagerAvailable())
{
   BeanManager beanManager = locator.getBeanManager();
   beanManager.fireEvent(payload);
}

In this context, the name of the class seems silly. It should probably be BeanManagerLocator. In fact, maybe we just do away with the static methods.
  
> Throw a specialized exception when BeanManagerAware cannot resolve BeanManager
> ------------------------------------------------------------------------------
>
>                 Key: SOLDER-50
>                 URL: https://issues.jboss.org/browse/SOLDER-50
>             Project: Seam Solder
>          Issue Type: Feature Request
>          Components: Core
>            Reporter: Dan Allen
>            Assignee: Lincoln Baxter III
>            Priority: Minor
>
> The BeanManagerAware#getBeanManager() method currently throws an IllegalArgumentException when the BeanManager cannot be found by any provider. Because this exception is so generic, it's dangerous to bundle the lookup with other code because you aren't sure whether the IllegalArgumentException came from the BeanManager lookup or from a subsequent call, as in:
> try {
>    BeanManager beanManager = BeanManagerAccessor.getBeanManager();
>    beanManager.fireEvent(payload);
> }
> catch (IllegalArgumentException e) {
>    // what caused this?
> }
> Introduce a specialized checked exception for this unique failure. The proposed name is BeanManagerNotAvailable (or BeanManagerNotFound)

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list