felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clem...@apache.org
Subject svn commit: r619551 - /felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
Date Thu, 07 Feb 2008 18:38:26 GMT
Author: clement
Date: Thu Feb  7 10:38:23 2008
New Revision: 619551

URL: http://svn.apache.org/viewvc?rev=619551&view=rev
Log:
Fix a bug in the configure method when no attributes are declared.

Modified:
    felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java

Modified: felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
URL: http://svn.apache.org/viewvc/felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java?rev=619551&r1=619550&r2=619551&view=diff
==============================================================================
--- felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
(original)
+++ felix/sandbox/clement/ipojo/jmx.handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java
Thu Feb  7 10:38:23 2008
@@ -82,43 +82,46 @@
         
         // set property 
         Element[] attributes = mbeans[0].getElements("property");
+        FieldMetadata[] fields = null;
         //String[] fields = new String[attributes.length];
-        FieldMetadata[] fields = new FieldMetadata[attributes.length];
-        for (int i = 0 ; attributes != null && i < attributes.length ; i++) {
-            boolean notif = false;
-            String rights;
-            String name;
-            String field = attributes[i].getAttribute("field");
+        if (attributes != null) {
+            fields = new FieldMetadata[attributes.length];
+            for (int i = 0 ; attributes != null && i < attributes.length ; i++)
{
+                boolean notif = false;
+                String rights;
+                String name;
+                String field = attributes[i].getAttribute("field");
             
-            if (attributes[i].containsAttribute("name")) {
-                name = attributes[i].getAttribute("name");
-            } else {
-                name = field;
-            }
-            if (attributes[i].containsAttribute("rights")) {
-                rights = attributes[i].getAttribute("rights");
-            } else {
-                rights = "w";
-            }
+                if (attributes[i].containsAttribute("name")) {
+                    name = attributes[i].getAttribute("name");
+                } else {
+                    name = field;
+                }
+                if (attributes[i].containsAttribute("rights")) {
+                    rights = attributes[i].getAttribute("rights");
+                } else {
+                    rights = "w";
+                }
             
-            PropertyField property = new PropertyField(name, field, rights, getTypeFromAttributeField(field,
manipulation));
+                PropertyField property = new PropertyField(name, field, rights, getTypeFromAttributeField(field,
manipulation));
             
-            if (attributes[i].containsAttribute("notification")) {
-                notif = Boolean.parseBoolean(attributes[i].getAttribute("notification"));
-            }
+                if (attributes[i].containsAttribute("notification")) {
+                    notif = Boolean.parseBoolean(attributes[i].getAttribute("notification"));
+                }
             
-            property.setNotifiable(notif);
+                property.setNotifiable(notif);
             
-            if (notif) {
-                //add the new notifiable property in structure
-                NotificationField notification = new NotificationField(name, this.getClass().getName()
+ "." + field, null);
-                m_jmxConfigFieldMap.addNotificationFromName(name, notification);
-            }
-            m_jmxConfigFieldMap.addPropertyFromName(name, property);
-            fields[i] = manipulation.getField(field);
-            System.out.println("DEBUG: property exposed:" + name + " " + field + ":" 
+                if (notif) {
+                    //add the new notifiable property in structure
+                    NotificationField notification = new NotificationField(name, this.getClass().getName()
+ "." + field, null);
+                    m_jmxConfigFieldMap.addNotificationFromName(name, notification);
+                }
+                m_jmxConfigFieldMap.addPropertyFromName(name, property);
+                fields[i] = manipulation.getField(field);
+                System.out.println("DEBUG: property exposed:" + name + " " + field + ":"

                     + getTypeFromAttributeField(field, manipulation) + " " + rights 
                     + ", Notif=" + notif);
+            }
         }
         
         //set methods 



Mime
View raw message