Order sip-communicator.properties alphabetically.

cusax-fix
Sebastien Vincent 15 years ago
parent d1a7be7244
commit 65cdfb0240

@ -9,14 +9,16 @@
import java.io.*;
import java.util.*;
import net.java.sip.communicator.util.*;
/**
* Implements a <code>ConfigurationStore</code> which stores property name-value
* associations in a <code>Properties</code> instance and supports its
* Implements a <tt>ConfigurationStore</tt> which stores property name-value
* associations in a <tt>Properties</tt> instance and supports its
* serialization format for the configuration file of
* <code>ConfigurationServiceImpl</code>. Because of the <code>Properties</code>
* backend which can associate names only <code>String</code> values, instances
* of <code>PropertyConfigurationStore</code> convert property values to
* <code>String</code> using <code>Object#toString()</code>.
* <tt>ConfigurationServiceImpl</tt>. Because of the <tt>Properties</tt>
* backend which can associate names only <tt>String</tt> values, instances
* of <tt>PropertyConfigurationStore</tt> convert property values to
* <tt>String</tt> using <tt>Object#toString()</tt>.
*
* @author Lubomir Marinov
*/
@ -30,7 +32,7 @@ public class PropertyConfigurationStore
* is effectively adapted by this instance to
* <code>ConfigurationStore</code>.
*/
private final Properties properties = new Properties();
private final Properties properties = new SortedProperties();
/**
* Implements {@link ConfigurationStore#getProperty(String)}. If this

@ -0,0 +1,49 @@
/*
* SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.util;
import java.util.*;
/**
* This class is a sorted version of classical <tt>java.util.Properties</tt>.
* It is strongly inspired by http://forums.sun.com/thread.jspa?threadID=141144.
*
* @author Sebastien Vincent
*/
public class SortedProperties extends Properties
{
/**
* Serial version UID.
*/
private static final long serialVersionUID = 0L;
/**
* Get an enumeration of keys hold by the <tt>Properties</tt> object.
* Contrary to the original <tt>Properties</tt> implementation, it force
* the keys to be sorted alphabetically.
*/
public synchronized Enumeration<Object> keys()
{
final Object[] keys = keySet().toArray();
Arrays.sort(keys);
return new Enumeration<Object>()
{
int i = 0;
public boolean hasMoreElements()
{
return i < keys.length;
}
public Object nextElement()
{
return keys[i++];
}
};
}
}
Loading…
Cancel
Save