dev@glassfish.java.net

Re: regression on dynamic reconfig

From: Amy Roh <Amelia.Roh_at_Sun.COM>
Date: Tue, 16 Sep 2008 19:01:21 -0700

Hi Jerome,

I believe there's an oversight regarding hk2 revision 835 patch that was
integreated for hk2 0.3.22.

The attach diff fixes the oversight which ignored all CHANGE events when
both event.getNewValue() and getOldValue() aren't NULL.

Do we need another integration to include this fix?

Thanks,
Amy

Amy Roh wrote:
> I notice major regression on dynamic reconfig with the latest build.
> Dynamic reconfig tests were passing last time web container related
> changes were made on 9/10 and as late as of 9/12. I'm trying to track
> down the cause. Pls. give me any headsup if you are aware of any config
> changes that might have affected dynamic reconfig.
>
> Thanks,
> Amy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>



Index: external/apache-commons/pom.xml
===================================================================
--- external/apache-commons/pom.xml (revision 22686)
+++ external/apache-commons/pom.xml (working copy)
@@ -80,7 +80,7 @@
                 <configuration>
                     <instructions>
                         <!-- embed all compile and runtime scope dependencies -->
- <Embed-Dependency>*;groupId=commons-beanutils;inline=true,*</Embed-Dependency>
+ <Embed-Dependency>*;groupId=commons-beanutils;inline=true,*;groupId=commons-collections;inline=true,*;groupId=commons-digester;inline=true,*;groupId=commons-modeler;inline=true</Embed-Dependency>
                         <!-- We set a mandatory attribute for these packages, because we don't
                              want them to be visible to just anyone. An importer must specify
                              the mandatory attribute for it to be able to import. See
@@ -132,5 +132,23 @@
             <version>${commons.beanutils.version}</version>
             <optional>true</optional>
         </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>${commons.collections.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>${commons.digester.version}</version>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>commons-modeler</groupId>
+ <artifactId>commons-modeler</artifactId>
+ <version>${commons.modeler.version}</version>
+ <optional>true</optional>
+ </dependency>
     </dependencies>
 </project>

attached mail follows:



Author: dochez
Date: 2008-09-15 05:21:17+0000
New Revision: 835

Modified:
   trunk/hk2/config/src/java/org/jvnet/hk2/config/ConfigSupport.java

Log:
fixed IT 6001 : NPE when old value is null in sortAndDispatch



Modified: trunk/hk2/config/src/java/org/jvnet/hk2/config/ConfigSupport.java
Url: https://hk2.dev.java.net/source/browse/hk2/trunk/hk2/config/src/java/org/jvnet/hk2/config/ConfigSupport.java?view=diff&rev=835&p1=trunk/hk2/config/src/java/org/jvnet/hk2/config/ConfigSupport.java&p2=trunk/hk2/config/src/java/org/jvnet/hk2/config/ConfigSupport.java&r1=834&r2=835
==============================================================================
--- trunk/hk2/config/src/java/org/jvnet/hk2/config/ConfigSupport.java (original)
+++ trunk/hk2/config/src/java/org/jvnet/hk2/config/ConfigSupport.java 2008-09-15 05:21:17+0000
@@ -87,7 +87,7 @@
 public class ConfigSupport {
  
     /**
- * Execute§ some logic on one config bean of type T protected by a transaction
+ * Execute� some logic on one config bean of type T protected by a transaction
      *
      * @param code code to execute
      * @param param config object participating in the transaction
@@ -293,14 +293,23 @@
                     continue;
                 }
                 if (event.getNewValue()==null) {
- final ConfigBeanProxy proxy = ConfigBeanProxy.class.cast(event.getOldValue());
- final NotProcessed nc = target.changed(Changed.TYPE.REMOVE, proxyType(proxy), proxy );
- if ( nc != null ) {
- unprocessed.add( new UnprocessedChangeEvent(event, nc.getReason() ) );
+ ConfigBeanProxy proxy = null;
+ try {
+ // getOldValue() can be null, we will notify a CHANGE event
+ proxy = ConfigBeanProxy.class.cast(event.getOldValue());
+ } catch (ClassCastException e) {
+ // this is ok, the old value was probably a string or something like this...
+ // we will notify the event.getSource() that it changed.
+ }
+ if (proxy!=null) {
+ final NotProcessed nc = target.changed(Changed.TYPE.REMOVE, proxyType(proxy), proxy );
+ if ( nc != null ) {
+ unprocessed.add( new UnprocessedChangeEvent(event, nc.getReason() ) );
+ }
+ continue;
                     }
- } else {
                     if (!changed.contains(eventSource)) {
- final ConfigBeanProxy proxy = ConfigBeanProxy.class.cast(event.getSource());
+ proxy = ConfigBeanProxy.class.cast(event.getSource());
                         changed.add(eventSource);
                         final NotProcessed nc = target.changed(Changed.TYPE.CHANGE, proxyType(proxy), proxy);
                         if ( nc != null ) {

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe_at_hk2.dev.java.net
For additional commands, e-mail: commits-help_at_hk2.dev.java.net