Return-Path: Delivered-To: apmail-felix-commits-archive@www.apache.org Received: (qmail 73153 invoked from network); 7 Feb 2008 18:38:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Feb 2008 18:38:50 -0000 Received: (qmail 8517 invoked by uid 500); 7 Feb 2008 18:38:43 -0000 Delivered-To: apmail-felix-commits-archive@felix.apache.org Received: (qmail 8456 invoked by uid 500); 7 Feb 2008 18:38:43 -0000 Mailing-List: contact commits-help@felix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@felix.apache.org Delivered-To: mailing list commits@felix.apache.org Received: (qmail 8447 invoked by uid 99); 7 Feb 2008 18:38:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2008 10:38:43 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Feb 2008 18:38:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D9F621A9832; Thu, 7 Feb 2008 10:38:26 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@felix.apache.org From: clement@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080207183826.D9F621A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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