From 07768b1a78035e543d4609863b98db9ad9dd8707 Mon Sep 17 00:00:00 2001 From: mguessan Date: Fri, 19 Mar 2010 10:28:35 +0000 Subject: [PATCH] Sort properties file git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@960 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/Settings.java | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/java/davmail/Settings.java b/src/java/davmail/Settings.java index f76f4c51..9675e9c6 100644 --- a/src/java/davmail/Settings.java +++ b/src/java/davmail/Settings.java @@ -20,7 +20,7 @@ package davmail; import davmail.ui.tray.DavGatewayTray; -import java.util.Properties; +import java.util.*; import java.io.*; import org.apache.log4j.*; @@ -34,7 +34,28 @@ public final class Settings { private Settings() { } - private static final Properties SETTINGS = new Properties(); + private static final Properties SETTINGS = new Properties() { + @Override + public synchronized Enumeration keys() { + Enumeration keysEnumeration = super.keys(); + TreeSet sortedKeySet = new TreeSet(); + while (keysEnumeration.hasMoreElements()) { + sortedKeySet.add((String) keysEnumeration.nextElement()); + } + final Iterator sortedKeysIterator = sortedKeySet.iterator(); + return new Enumeration() { + + public boolean hasMoreElements() { + return sortedKeysIterator.hasNext(); + } + + public Object nextElement() { + return sortedKeysIterator.next(); + } + }; + } + + }; private static String configFilePath; private static boolean isFirstStart; @@ -158,7 +179,7 @@ public final class Settings { logFilePath = System.getProperty("user.home") + "/Library/Logs/DavMail/davmail.log"; } } else { - File logFile = new File(logFilePath); + File logFile = new File(logFilePath); if (logFile.isDirectory()) { logFilePath += "/davmail.log"; }