[Schmitzm-commits] r1455 - in trunk/schmitzm-core/src: main/java/de/schmitzm/lang main/resources/de/schmitzm/swing/resource/locales test/java/de/schmitzm/lang
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Thu Jan 27 17:18:29 CET 2011
Author: mojays
Date: 2011-01-27 17:18:29 +0100 (Thu, 27 Jan 2011)
New Revision: 1455
Added:
trunk/schmitzm-core/src/main/java/de/schmitzm/lang/SortedProperties.java
Removed:
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/locales/SwingResourceBundle.removedKeys.properties
trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/locales/SwingResourceBundle_de.removedKeys.properties
Modified:
trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ResourceProviderOperator.java
trunk/schmitzm-core/src/test/java/de/schmitzm/lang/ResourceProviderTest.java
Log:
new class SortedProperties to force the internal Properties methods to store the property files in a sorted way.
Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ResourceProviderOperator.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ResourceProviderOperator.java 2011-01-27 15:03:00 UTC (rev 1454)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/ResourceProviderOperator.java 2011-01-27 16:18:29 UTC (rev 1455)
@@ -373,8 +373,8 @@
// split the key/value pairs of the bundle in the removed
// pairs and the remaining pairs
- Properties removedKeys = new Properties();
- Properties remainingKeys = new Properties();
+ Properties removedKeys = new SortedProperties();
+ Properties remainingKeys = new SortedProperties();
checkBundle.setIgnoreMissingResource(false);
for (String key : checkBundle.getKeys()) {
String value = null;
Added: trunk/schmitzm-core/src/main/java/de/schmitzm/lang/SortedProperties.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/lang/SortedProperties.java 2011-01-27 15:03:00 UTC (rev 1454)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/lang/SortedProperties.java 2011-01-27 16:18:29 UTC (rev 1455)
@@ -0,0 +1,39 @@
+package de.schmitzm.lang;
+
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.Vector;
+
+/**
+ * Provides the same functionality like the standard JDK {@link Properties},
+ * exception that {@link #keys()} and {@link #keySet()} methods
+ * return sorted sets, so that the internal {@code store(..)}-methods
+ * automatically write the properties file in a sorted way.
+ * @author <a href="mailto:martin.schmitz at koeln.de">Martin Schmitz</a>
+ */
+public class SortedProperties extends Properties {
+
+ /**
+ * Creates a new {@link TreeSet} for the internal key set and
+ * returns an {@link Enumeration} for this {@link TreeSet}.<br>
+ * <br>
+ * <b>Note:</b>
+ * In my mind the original {@link Properties} already stores
+ * the property files an a sorted way. But since a few days/weeks
+ * it seems that it does not!
+ */
+ @Override
+ public Enumeration<Object> keys() {
+ return new Vector<Object>(new TreeSet<Object>( super.keySet() )).elements();
+ }
+
+ /**
+ * Returns a new {@link TreeSet} for the internal key set.
+ */
+ @Override
+ public Set<Object> keySet() {
+ return new TreeSet<Object>( super.keySet() );
+ }
+}
Deleted: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/locales/SwingResourceBundle.removedKeys.properties
===================================================================
Deleted: trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/locales/SwingResourceBundle_de.removedKeys.properties
===================================================================
--- trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/locales/SwingResourceBundle_de.removedKeys.properties 2011-01-27 15:03:00 UTC (rev 1454)
+++ trunk/schmitzm-core/src/main/resources/de/schmitzm/swing/resource/locales/SwingResourceBundle_de.removedKeys.properties 2011-01-27 16:18:29 UTC (rev 1455)
@@ -1,8 +0,0 @@
-#======================================================
-#Removed Keys: de.schmitzm.swing.resource.locales.SwingResourceBundle
-#Thu Jan 27 15:55:49 WAT 2011
-Dummy=Dummy DE Label
-#======================================================
-#Removed Keys: de.schmitzm.swing.resource.locales.SwingResourceBundle
-#Thu Jan 27 15:56:51 WAT 2011
-Dummy=Dummy DE Label
Modified: trunk/schmitzm-core/src/test/java/de/schmitzm/lang/ResourceProviderTest.java
===================================================================
--- trunk/schmitzm-core/src/test/java/de/schmitzm/lang/ResourceProviderTest.java 2011-01-27 15:03:00 UTC (rev 1454)
+++ trunk/schmitzm-core/src/test/java/de/schmitzm/lang/ResourceProviderTest.java 2011-01-27 16:18:29 UTC (rev 1455)
@@ -20,7 +20,7 @@
public class ResourceProviderTest extends TestingClass {
@Test
- @Ignore
+// @Ignore
public void testResourceProviderOperator() throws Exception {
ResourceProviderOperator.main( new String[] {
"-s",
More information about the Schmitzm-commits
mailing list