[webbeans-dev] SimpleBean.create

Peter Royle pete at screamingcoder.com
Mon Mar 30 17:39:27 EDT 2009


OK good points :). By 'safe' I just meant less change to the behaviour
of the equals method so less likely to break any existing functionality
- even though that would have been dead easy to check. Cautious, yet
lazy :).

But you're right - eliminating the CCE as well is the right thing to do
here. 



On Mon, 2009-03-30 at 00:33 +0100, Pete Muir wrote:
> On 29 Mar 2009, at 20:41, Peter Royle wrote:
> 
> > Actually this is probably the safer way to do it:
> > http://fisheye.jboss.com/changelog/Webbeans/?cs=2255.
> >
> > The previous commit changed the behaviour in a couple of subtle ways
> > which is not a particularly good thing.
> 
> Explain - I can't see how this is currently safe given that you will  
> get a CCE if I do
> 
> dependentStorageRequest.equals(new String());
> 
> Anyway, I made this use the standard equals idiom and the test suite  
> appears unaffected...
> 
> >
> >
> > Pete.
> >
> >
> > On Sun, 2009-03-29 at 19:03 +0000, Peter Royle wrote:
> >>> A try-finally doesn't swallow exceptions,
> >>
> >> That's what I thought! But all bets are off when the finally block
> >> throws an uncaught exception :).
> 
> Yes, so (as you say) we make it so we don't throw an exception there :-)
> 
> >>
> >>
> >>> and a catch-rethrow is not necessary unless you need to inspect  
> >>> the exception somehow (e.g. to
> >>> provide more context) and swallow-log is a horrible approach.
> >>
> >> Agreed :)
> >>
> >>> I suspect you have some other problem, probably inside the logic  
> >>> which
> >>> rethrows exceptions invoking constructors as CreationExceptions.
> >>
> >> The problem in this case is that an NPE is thrown in the finally  
> >> block
> >> because it relies on a variable which is initialiesd in the try block
> >> which bailed out. This new NPE causes the original exception to be
> >> buried.
> >>
> >> The fix is easy though - I've jsut made DependentStorageRequest  
> >> capable
> >> of comparing against null.
> >> http://fisheye.jboss.com/changelog/Webbeans/?cs=2254
> >>
> >> Cheers,
> >>
> >> Pete.
> >>
> >>>
> >>> On 24 Mar 2009, at 21:55, Peter Royle wrote:
> >>>
> >>>> Hi,
> >>>>
> >>>> I've noticed that if I do something stupid in one of my bean's
> >>>> constructors (a NPE for example ;) the exception is being buried by
> >>>> SimpleBean.create which has 'trys' and 'finallys' but no catch. I
> >>>> assume
> >>>> there's a good reason for not rethrowing the exception here (what  
> >>>> is
> >>>> it
> >>>> by the way?), but could we maybe log it?
> >>>>
> >>>> Cheers,
> >>>>
> >>>> Pete.
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> webbeans-dev mailing list
> >>>> webbeans-dev at lists.jboss.org
> >>>> https://lists.jboss.org/mailman/listinfo/webbeans-dev
> >>>
> >>> --
> >>> Pete Muir
> >>> http://www.seamframework.org
> >>> http://in.relation.to/Bloggers/Pete
> >>>
> >>
> >>
> >> _______________________________________________
> >> webbeans-dev mailing list
> >> webbeans-dev at lists.jboss.org
> >> https://lists.jboss.org/mailman/listinfo/webbeans-dev
> >
> >
> > _______________________________________________
> > webbeans-dev mailing list
> > webbeans-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/webbeans-dev
> 
> --
> Pete Muir
> http://www.seamframework.org
> http://in.relation.to/Bloggers/Pete
> 





More information about the weld-dev mailing list