Thanks Mridul, that's exactly right. I'll submit your patch.
> -----Original Message----- > From: Mridul Muralidharan [mailto:[EMAIL PROTECTED] > Sent: Tuesday, March 29, 2005 11:29 AM > To: [email protected] > Subject: Bug in ControlBean ? > > Hi, > > I see the following in > org.apache.beehive.controls.runtime.bean.ControlBean.java : > > "transient final private HashMap<String,Interceptor> > _interceptors = new > HashMap<String,Interceptor>();" > > Having it as transient and final makes invocation of business > method on > a serialised and then deserialised instance the bean to throw > NPE's when > I annotate some methods with interceptors. (ensureInterceptor > throws NPE > when it does "i = _interceptors.get( n );" - after deserialisation , > _interceptors is null). > Did not raise a JIRA issue since there could be possible reason for > doing this ? > > Thanks > Mridul > > The diff that I made to the file to get it fixed is (svn diff) : > > Index: > runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java > =================================================================== > --- > runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java > (revision 159230) > +++ > runtime/org/apache/beehive/controls/runtime/bean/ControlBean.java > (working copy) > @@ -913,7 +913,14 @@ > */ > protected Interceptor ensureInterceptor( String n ) > { > - Interceptor i = _interceptors.get( n ); > + Interceptor i = null; > + if (null == _interceptors){ > + _interceptors = new HashMap<String,Interceptor>(); > + } > + else{ > + i = _interceptors.get( n ); > + } > + > if ( i == null ) > { > try > @@ -1061,5 +1068,5 @@ > * HashMap to hold interceptor impl instances. > * Populated lazily. Maps interceptor interface name to impl. > */ > - transient private final HashMap<String,Interceptor> > _interceptors = > new HashMap<String,Interceptor>(); > + transient private HashMap<String,Interceptor> _interceptors; > } > >
