deltaspike-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Arne Limburg <>
Subject AW: [DISCUSS] BeanManagerProvider API
Date Mon, 23 Jan 2012 08:19:27 GMT
I am with you here, IllegalStateException should suffice.

Btw. Which Exception will be thrown by CDI.current() in CDI 1.1 when no CDI is available or
does it throw none? We should throw the same exception unless it does not exist in CDI 1.0.


-----Urspr√ľngliche Nachricht-----
Von: Mark Struberg [] 
Gesendet: Montag, 23. Januar 2012 08:19
Betreff: Re: [DISCUSS] BeanManagerProvider API

I'd say we should throw an IllegalStateException. 

IllegalStateException and not BeanManagerUnavailableException because I don't like to have
too many custom Exceptions if they don't carry business information.
This is clearly a non-expected and non-recoverable situation, thus a RuntimeException is excactly
what we need imo.


----- Original Message -----
> From: Christian Kaltepoth <>
> To:
> Cc: 
> Sent: Monday, January 23, 2012 7:19 AM
> Subject: [DISCUSS] BeanManagerProvider API
> Hey @all,
> yesterday I had a deeper look at the BeanManagerProvider 
> implementation and found something that could be improved. I created
> DELTASPIKE-56 (see [1]) for this but it turned out that we should 
> discuss this topic on the mailing list.
> I saw that getBeanManager() may return null in some rare 
> circumstances. Unfortunately this forces everyone calling this method 
> to check the result for null. I think most code calling the method 
> absolutely requires the BeanManager and cannot proceed without it.
> My first idea was to add another method getRequiredBeanManager() that 
> doesn't return null if the BeanManager is not available but instead 
> throws a meaningful runtime exception. That's what Solder does per 
> default. Calling Solder's BeanManagerLocator.getBeanManager() without 
> a BeanManager being available will result in a 
> BeanManagerUnavailableException (see [2]).
> However Mark suggested that throwing an exception should be the 
> default behavior. I for myself like Mark's idea.
> What do you think?
> Christian
> [1]
> [2]
> /solder/beanManager/
> --
> Christian Kaltepoth
> Blog:
> Twitter:

View raw message