You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2010/06/29 15:12:25 UTC

svn commit: r958959 - in /karaf/trunk/features/management/src: main/java/org/apache/karaf/features/management/internal/ test/ test/java/ test/java/org/ test/java/org/apache/ test/java/org/apache/karaf/ test/java/org/apache/karaf/features/ test/java/org...

Author: gnodet
Date: Tue Jun 29 13:12:24 2010
New Revision: 958959

URL: http://svn.apache.org/viewvc?rev=958959&view=rev
Log:
KARAF-65: NPE in StandardEmitterMBean on JDK 6

Added:
    karaf/trunk/features/management/src/test/
    karaf/trunk/features/management/src/test/java/
    karaf/trunk/features/management/src/test/java/org/
    karaf/trunk/features/management/src/test/java/org/apache/
    karaf/trunk/features/management/src/test/java/org/apache/karaf/
    karaf/trunk/features/management/src/test/java/org/apache/karaf/features/
    karaf/trunk/features/management/src/test/java/org/apache/karaf/features/management/
    karaf/trunk/features/management/src/test/java/org/apache/karaf/features/management/internal/
    karaf/trunk/features/management/src/test/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImplTest.java
Modified:
    karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
    karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/StandardEmitterMBean.java

Modified: karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java?rev=958959&r1=958958&r2=958959&view=diff
==============================================================================
--- karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java (original)
+++ karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImpl.java Tue Jun 29 13:12:24 2010
@@ -61,12 +61,7 @@ public class FeaturesServiceMBeanImpl ex
     private FeaturesService featuresService;
 
     public FeaturesServiceMBeanImpl() throws NotCompliantMBeanException {
-        super(FeaturesServiceMBean.class, new NotificationBroadcasterSupport() {
-            @Override
-            public MBeanNotificationInfo[] getNotificationInfo() {
-                return getBroadcastInfo();
-            }
-        });
+        super(FeaturesServiceMBean.class);
     }
 
     public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception {
@@ -175,6 +170,9 @@ public class FeaturesServiceMBeanImpl ex
         };
     }
 
+    public MBeanNotificationInfo[] getNotificationInfo() {
+        return getBroadcastInfo();
+    }
 
     private static MBeanNotificationInfo[] getBroadcastInfo() {
         String type = Notification.class.getCanonicalName();

Modified: karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/StandardEmitterMBean.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/StandardEmitterMBean.java?rev=958959&r1=958958&r2=958959&view=diff
==============================================================================
--- karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/StandardEmitterMBean.java (original)
+++ karaf/trunk/features/management/src/main/java/org/apache/karaf/features/management/internal/StandardEmitterMBean.java Tue Jun 29 13:12:24 2010
@@ -17,11 +17,16 @@ import javax.management.*;
 
 public class StandardEmitterMBean extends StandardMBean implements NotificationEmitter {
 
-    private NotificationBroadcasterSupport emitter;
+    private final NotificationBroadcasterSupport emitter;
 
-    public StandardEmitterMBean(Class mbeanInterface, NotificationBroadcasterSupport emitter) throws NotCompliantMBeanException {
+    public StandardEmitterMBean(Class mbeanInterface) throws NotCompliantMBeanException {
         super(mbeanInterface);
-        this.emitter = emitter;
+        this.emitter = new NotificationBroadcasterSupport() {
+            @Override
+            public MBeanNotificationInfo[] getNotificationInfo() {
+                return StandardEmitterMBean.this.getNotificationInfo();
+            }
+        };
     }
 
     public void sendNotification(Notification notification) {
@@ -42,7 +47,7 @@ public class StandardEmitterMBean extend
     }
 
     public MBeanNotificationInfo[] getNotificationInfo() {
-        return emitter.getNotificationInfo();
+        return new MBeanNotificationInfo[0];
     }
 
     @Override

Added: karaf/trunk/features/management/src/test/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImplTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/features/management/src/test/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImplTest.java?rev=958959&view=auto
==============================================================================
--- karaf/trunk/features/management/src/test/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImplTest.java (added)
+++ karaf/trunk/features/management/src/test/java/org/apache/karaf/features/management/internal/FeaturesServiceMBeanImplTest.java Tue Jun 29 13:12:24 2010
@@ -0,0 +1,24 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.karaf.features.management.internal;
+
+import org.junit.Test;
+
+public class FeaturesServiceMBeanImplTest {
+
+    @Test
+    public void testInstantiation() throws Exception {
+        new FeaturesServiceMBeanImpl();
+    }
+}