karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Pieber <anpie...@gmail.com>
Subject Re: Hmm. (Re: svn commit: r1182554....)
Date Thu, 13 Oct 2011 05:05:27 GMT
Haven't read the karaf coding standard but I'm very much in favor of using
braces here; it's simply to easy making a mistake otherwise...

Kind regards,
Andreas

On Thu, Oct 13, 2011 at 01:49, Glen Mazza <gmazza@talend.com> wrote:

> Are "if" clauses without braces allowed?  I haven't seen those in a while.
>
> Glen
>
> On 10/12/2011 03:38 PM, jbonofre@apache.org wrote:
>
>> Author: jbonofre
>> Date: Wed Oct 12 19:38:14 2011
>> New Revision: 1182554
>>
>> URL: http://svn.apache.org/viewvc?**rev=1182554&view=rev<http://svn.apache.org/viewvc?rev=1182554&view=rev>
>> Log:
>> [KARAF-932] Initialize the config properties if null to avoid NPE
>>
>> Modified:
>>     karaf/branches/karaf-2.2.x/**management/mbeans/config/src/**
>> main/java/org/apache/karaf/**management/mbeans/config/**
>> internal/ConfigMBeanImpl.java
>>
>> Modified: karaf/branches/karaf-2.2.x/**management/mbeans/config/src/**
>> main/java/org/apache/karaf/**management/mbeans/config/**
>> internal/ConfigMBeanImpl.java
>> URL: http://svn.apache.org/viewvc/**karaf/branches/karaf-2.2.x/**
>> management/mbeans/config/src/**main/java/org/apache/karaf/**
>> management/mbeans/config/**internal/ConfigMBeanImpl.java?**
>> rev=1182554&r1=1182553&r2=**1182554&view=diff<http://svn.apache.org/viewvc/karaf/branches/karaf-2.2.x/management/mbeans/config/src/main/java/org/apache/karaf/management/mbeans/config/internal/ConfigMBeanImpl.java?rev=1182554&r1=1182553&r2=1182554&view=diff>
>> ==============================**==============================**
>> ==================
>> --- karaf/branches/karaf-2.2.x/**management/mbeans/config/src/**
>> main/java/org/apache/karaf/**management/mbeans/config/**internal/ConfigMBeanImpl.java
>> (original)
>> +++ karaf/branches/karaf-2.2.x/**management/mbeans/config/src/**
>> main/java/org/apache/karaf/**management/mbeans/config/**internal/ConfigMBeanImpl.java
>> Wed Oct 12 19:38:14 2011
>> @@ -85,6 +85,8 @@ public class ConfigMBeanImpl extends Sta
>>              throw new IllegalArgumentException("**Configuration PID " +
>> pid + " doesn't exist");
>>          }
>>          Dictionary dictionary = configuration.getProperties();
>> +        if (dictionary == null)
>> +            dictionary = new java.util.Properties();
>>          Map<String, String>  propertiesMap = new HashMap<String,
>> String>();
>>          for (Enumeration e = dictionary.keys(); e.hasMoreElements(); ) {
>>              Object key = e.nextElement();
>> @@ -100,6 +102,8 @@ public class ConfigMBeanImpl extends Sta
>>              throw new IllegalArgumentException("**Configuration PID " +
>> pid + " doesn't exist");
>>          }
>>          Dictionary dictionary = configuration.getProperties();
>> +        if (dictionary == null)
>> +            dictionary = new java.util.Properties();
>>          dictionary.remove(key);
>>          store(pid, dictionary, false);
>>      }
>> @@ -110,6 +114,8 @@ public class ConfigMBeanImpl extends Sta
>>              throw new IllegalArgumentException("**Configuration PID " +
>> pid + " doesn't exist");
>>          }
>>          Dictionary dictionary = configuration.getProperties();
>> +        if (dictionary == null)
>> +            dictionary = new java.util.Properties();
>>          Object currentValue = dictionary.get(key);
>>          if (currentValue == null) {
>>              dictionary.put(key, value);
>> @@ -127,6 +133,8 @@ public class ConfigMBeanImpl extends Sta
>>              throw new IllegalArgumentException("**Configuration PID " +
>> pid + " doesn't exist");
>>          }
>>          Dictionary dictionary = configuration.getProperties();
>> +        if (dictionary == null)
>> +            dictionary = new java.util.Properties();
>>          dictionary.put(key, value);
>>          store(pid, dictionary, false);
>>      }
>>
>>
>>
>
> --
> Glen Mazza
> Talend - http://www.talend.com/apache
> Blog - http://www.jroller.com/gmazza
> Twitter - glenmazza
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message