sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1445244 [1/2] - in /sis/branches/JDK6: ./ sis-referencing/src/test/java/org/apache/sis/geometry/ sis-utility/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ sis-utility/s...
Date Tue, 12 Feb 2013 16:32:30 GMT
Author: desruisseaux
Date: Tue Feb 12 16:32:28 2013
New Revision: 1445244

URL: http://svn.apache.org/r1445244
Log:
Merge from the JDK7 branch.

Added:
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Range.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/DateRangeTest.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/DateRangeTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
      - copied unchanged from r1445223, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/NumberRangeTest.java
      - copied unchanged from r1445223, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/NumberRangeTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeFormatTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
      - copied, changed from r1445223, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/measure/RangeTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java
      - copied unchanged from r1445223, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/NumbersTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/resources/LoaderTest.java
      - copied unchanged from r1445223, sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/resources/LoaderTest.java
Modified:
    sis/branches/JDK6/   (props changed)
    sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java
    sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java
    sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
    sis/branches/JDK6/sis-utility/pom.xml
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Localized.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CollectionsExt.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Loader.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/NilObject.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
    sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/CharSequencesTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/CharactersTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/ClassesTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/collection/DerivedMapTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/collection/DerivedSetTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/collection/TableColumnTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/iso/AbstractNameTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
    sis/branches/JDK6/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java
    sis/branches/JDK6/src/main/docbook/fr/utility.xml

Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
  Merged /sis/branches/JDK7:r1441587-1445223

Modified: sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java (original)
+++ sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition1DTest.java Tue Feb 12 16:32:28 2013
@@ -46,7 +46,7 @@ public final strictfp class DirectPositi
     }
 
     /**
-     * Tests the {@link DirectPosition1D#DirectPosition2D(String)} constructor.
+     * Tests the {@link DirectPosition1D#DirectPosition1D(CharSequence)} constructor.
      */
     @Test
     public void testWktParsing() {

Modified: sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java (original)
+++ sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/DirectPosition2DTest.java Tue Feb 12 16:32:28 2013
@@ -46,7 +46,7 @@ public final strictfp class DirectPositi
     }
 
     /**
-     * Tests the {@link DirectPosition2D#DirectPosition2D(String)} constructor.
+     * Tests the {@link DirectPosition2D#DirectPosition2D(CharSequence)} constructor.
      */
     @Test
     public void testWktParsing() {

Modified: sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java (original)
+++ sis/branches/JDK6/sis-referencing/src/test/java/org/apache/sis/geometry/GeneralDirectPositionTest.java Tue Feb 12 16:32:28 2013
@@ -61,7 +61,7 @@ public final strictfp class GeneralDirec
     }
 
     /**
-     * Tests the {@link GeneralDirectPosition#GeneralDirectPosition(String)} constructor.
+     * Tests the {@link GeneralDirectPosition#GeneralDirectPosition(CharSequence)} constructor.
      */
     @Test
     public void testWktParsing() {

Modified: sis/branches/JDK6/sis-utility/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/pom.xml?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/pom.xml (original)
+++ sis/branches/JDK6/sis-utility/pom.xml Tue Feb 12 16:32:28 2013
@@ -90,6 +90,12 @@ Miscellaneous utilities.
         <role>Developer</role>
       </roles>
     </contributor>
+    <contributor>
+      <name>Joe White</name>
+      <roles>
+        <role>Developer</role>
+      </roles>
+    </contributor>
   </contributors>
 
 

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java Tue Feb 12 16:32:28 2013
@@ -185,8 +185,7 @@ public final class MarshalContext extend
 
     /**
      * Returns the locale to use for marshalling, or {@code null} if no locale were explicitly
-     * specified. A {@code null} value means that some locale-neutral language should be used
-     * if available, or an implementation-default locale (typically English) otherwise.
+     * specified.
      */
     @Override
     public final Locale getLocale() {
@@ -194,8 +193,8 @@ public final class MarshalContext extend
     }
 
     /**
-     * Returns the timezone, or {@code null} if none were explicitely defined.
-     * In the later case, an implementation-default (typically UTC) timezone is used.
+     * Returns the timezone to use for marshalling, or {@code null} if none were explicitely
+     * specified.
      */
     @Override
     public final TimeZone getTimeZone() {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java Tue Feb 12 16:32:28 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
+import java.util.Locale;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.LocalName;
 import org.opengis.util.NameFactory;
@@ -70,7 +71,7 @@ public final class LocalNameAdapter exte
      */
     @Override
     public String marshal(final LocalName value) {
-        return (value == null) ? null : value.toInternationalString().toString(null);
+        return (value == null) ? null : value.toInternationalString().toString(Locale.ROOT);
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java Tue Feb 12 16:32:28 2013
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.jaxb.gco;
 
 import java.util.List;
+import java.util.Locale;
 import java.util.ConcurrentModificationException;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.LocalName;
@@ -64,7 +65,7 @@ public final class ScopedNameAdapter ext
         int i=0;
         for (final LocalName name : parsedNames) {
             // Asks for the unlocalized name, since we are going to marshal that.
-            names[i++] = name.toInternationalString().toString(null);
+            names[i++] = name.toInternationalString().toString(Locale.ROOT);
         }
         if (i != names.length) {
             throw new ConcurrentModificationException(Errors.format(Errors.Keys.UnexpectedChange_1, "parsedNames"));

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java Tue Feb 12 16:32:28 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.jaxb.gco;
 
+import java.util.Locale;
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 import org.opengis.util.InternationalString;
 import org.apache.sis.internal.jaxb.MarshalContext;
@@ -44,6 +45,8 @@ public final class StringAdapter extends
      * Returns a string representation of the given character sequence. If the given
      * sequence is an instance of {@link InternationalString}, then the locale from
      * the current unmashalling context is used in order to get a string.
+     * If the context is {@code null} or does not specify any locale, then the choice
+     * of locale is left to the {@link InternationalString#toString()} implementation.
      *
      * @param  value The wrapper for the value, or {@code null}.
      * @return The string representation of the given text, or {@code null}.
@@ -54,7 +57,14 @@ public final class StringAdapter extends
             if (text != null) {
                 if (text instanceof InternationalString) {
                     final MarshalContext context = MarshalContext.current();
-                    return ((InternationalString) text).toString(context != null ? context.getLocale() : null);
+                    if (context != null) {
+                        final Locale locale = context.getLocale();
+                        if (locale != null) {
+                            // While Apache SIS accepts null locale, foreigner
+                            // implementations are not guaranteed to support null.
+                            return ((InternationalString) text).toString(locale);
+                        }
+                    }
                 }
                 return text.toString();
             }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java Tue Feb 12 16:32:28 2013
@@ -27,6 +27,7 @@ import org.apache.sis.internal.jaxb.Mars
 import org.apache.sis.internal.jaxb.gco.GO_CharacterString;
 import org.apache.sis.util.iso.DefaultInternationalString;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.ArraysExt;
 
 
 /**
@@ -80,42 +81,29 @@ public final class PT_FreeText extends G
     }
 
     /**
-     * Constructs a {@linkplain TextGroup text group} from a {@link DefaultInternationalString}
-     * which could contains several localized strings.
+     * Constructs a {@code PT_FreeText} containing the given text groups.
      *
-     * <p>The {@code <gco:CharacterString> element will typically be set for the {@code null} locale,
+     * <p>The {@code <gco:CharacterString>} element will typically be set for the {@link Locale#ROOT},
      * which is the "unlocalized" string (not the same thing than the string in the default locale).
      * Note that the {@link TextGroup} constructor works better if the {@code <gco:CharacterString>}
-     * have been set for the {@code null} locale (the default behavior). If a different locale were
+     * have been set for the {@code ROOT} locale (the default behavior). If a different locale were
      * set, the list of localized strings in {@code TextGroup} may contains an element which
      * duplicate the {@code <gco:CharacterString>} element, or the unlocalized string normally
      * written in {@code <gco:CharacterString>} may be missing.</p>
      *
-     * @param context The current (un)marshalling context, or {@code null} if none.
-     * @param text    An international string which could have several translations
-     *                embedded for the same text.
+     * @param text The text to write in the {@code <gco:CharacterString>} element.
+     * @param textGroup The text group elements.
      *
      * @see org.apache.sis.xml.XML#LOCALE
      */
-    private PT_FreeText(final MarshalContext context, final DefaultInternationalString text) {
-        super(text.toString(context != null ? context.getLocale() : null));
-        final Set<Locale> locales = text.getLocales();
-        int n = locales.size();
-        if (locales.contains(null)) {
-            n--;
-        }
-        textGroup = new TextGroup[n];
-        int i = 0;
-        for (final Locale locale : locales) {
-            if (locale != null) {
-                textGroup[i++] = new TextGroup(locale, text.toString(locale));
-            }
-        }
+    private PT_FreeText(final String text, final TextGroup[] textGroup) {
+        super(text);
+        this.textGroup = textGroup;
     }
 
     /**
      * Constructs a {@linkplain TextGroup text group} from the given {@link InternationalString}
-     * if it contains at least one non-null locale. Otherwise returns {@code null}, meaning that
+     * if it contains at least one non-root locale. Otherwise returns {@code null}, meaning that
      * the simpler {@link GO_CharacterString} construct should be used instead.
      *
      * @param context The current (un)marshalling context, or {@code null} if none.
@@ -129,10 +117,22 @@ public final class PT_FreeText extends G
         if (text instanceof DefaultInternationalString) {
             final DefaultInternationalString df = (DefaultInternationalString) text;
             final Set<Locale> locales = df.getLocales();
-            switch (locales.size()) {
-                case 0:  break;
-                case 1:  if (locales.contains(null)) break; // Otherwise fallthrough
-                default: return new PT_FreeText(context, df);
+            final TextGroup[] textGroup = new TextGroup[locales.size()];
+            int n = 0;
+            for (final Locale locale : locales) {
+                if (locale != null && !locale.equals(Locale.ROOT)) {
+                    textGroup[n++] = new TextGroup(locale, text.toString(locale));
+                }
+            }
+            if (n != 0) {
+                /*
+                 * Invoke toString(Locale) instead than toString() even if the locale is null,
+                 * since the desired fallback is typically Locale.ROOT instead than the system
+                 * default. It is usually safer to avoid null value, but in this particular case
+                 * the implementation (DefaultInternationalString) is known to support null.
+                 */
+                return new PT_FreeText(df.toString(context != null ? context.getLocale() : null),
+                        ArraysExt.resize(textGroup, n));
             }
         }
         return null;

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java Tue Feb 12 16:32:28 2013
@@ -18,6 +18,7 @@ package org.apache.sis.internal.util;
 
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Locale;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
 import org.opengis.util.InternationalString;
@@ -83,8 +84,7 @@ public final class Citations extends Sta
             Iterator<? extends InternationalString> iterator = null;
             do {
                 if (candidate != null) {
-                    // The "null" locale argument is required for getting the unlocalized version.
-                    final String unlocalized = candidate.toString(null);
+                    final String unlocalized = candidate.toString(Locale.ROOT);
                     if (titleMatches(c1, unlocalized)) {
                         return true;
                     }
@@ -123,8 +123,7 @@ public final class Citations extends Sta
             Iterator<? extends InternationalString> iterator = null;
             do {
                 if (candidate != null) {
-                    // The "null" locale argument is required for getting the unlocalized version.
-                    final String unlocalized = candidate.toString(null);
+                    final String unlocalized = candidate.toString(Locale.ROOT);
                     if (equalsFiltered(unlocalized, title, LETTERS_AND_DIGITS, true)) {
                         return true;
                     }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java Tue Feb 12 16:32:28 2013
@@ -34,6 +34,7 @@ import java.lang.management.ManagementFa
 
 import org.apache.sis.util.About;
 import org.apache.sis.util.Localized;
+import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.collection.TreeTable;
@@ -116,6 +117,7 @@ public final class Supervisor extends St
      */
     public Supervisor(final Locale locale) throws NotCompliantMBeanException {
         super(SupervisorMBean.class);
+        ArgumentChecks.ensureNonNull("locale", locale);
         this.locale = locale;
     }
 

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java Tue Feb 12 16:32:28 2013
@@ -30,7 +30,6 @@ import java.text.NumberFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import net.jcip.annotations.NotThreadSafe;
-import org.opengis.util.InternationalString;
 
 import org.apache.sis.measure.Angle;
 import org.apache.sis.measure.AngleFormat;
@@ -82,8 +81,8 @@ public abstract class CompoundFormat<T> 
     private static final long serialVersionUID = -7094915750367581487L;
 
     /**
-     * The locale given at construction time, or {@code null} for unlocalized format.
-     * See {@link #getLocale()} for more information on {@code null} locale.
+     * The locale given at construction time, or {@link Locale#ROOT} (never {@code null}) for
+     * unlocalized format. See {@link #getLocale()} for more information on {@code ROOT} locale.
      */
     protected final Locale locale;
 
@@ -99,31 +98,30 @@ public abstract class CompoundFormat<T> 
     private transient Map<Class<?>,Format> formats;
 
     /**
-     * Creates a new format for the given locale. The given locale can be {@code null} if this
-     * format shall parse and format "unlocalized" strings. See {@link #getLocale()} for more
-     * information on {@code null} locale.
+     * Creates a new format for the given locale. The given locale can be {@code null} or
+     * {@link Locale#ROOT} if this format shall parse and format "unlocalized" strings.
+     * See {@link #getLocale()} for more information on {@code ROOT} locale.
      *
-     * @param locale   The locale, or {@code null} for unlocalized format.
+     * @param locale   The locale to use for numbers, dates and angles formatting,
+     *                 or {@code null} for the {@linkplain Locale#ROOT root locale}.
      * @param timezone The timezone, or {@code null} for UTC.
      */
     protected CompoundFormat(final Locale locale, final TimeZone timezone) {
-        this.locale   = locale;
+        this.locale   = (locale != null) ? locale : Locale.ROOT;
         this.timezone = timezone;
     }
 
     /**
-     * Returns the locale given at construction time. The returned locale may be {@code null}
+     * Returns the locale given at construction time. The returned value may be {@link Locale#ROOT}
      * if this format does not apply any localization. The definition of "unlocalized string"
      * is implementation-dependent, but some typical examples are:
      *
      * <ul>
      *   <li>Format {@link Number}s using {@code toString()} instead than {@code NumberFormat}.</li>
-     *   <li>Format {@link InternationalString}s using {@code toString(null)}. This has the desired
-     *       behavior at least with the {@linkplain org.apache.sis.util.iso.DefaultInternationalString#toString(Locale)
-     *       SIS implementation}.</li>
+     *   <li>Format {@link Date}s using the ISO pattern instead than the English one.</li>
      * </ul>
      *
-     * @return The locale used for this format, or {@code null} for unlocalized format.
+     * @return The locale used for this format, or {@link Locale#ROOT} for unlocalized format.
      */
     @Override
     public Locale getLocale() {
@@ -373,22 +371,22 @@ public abstract class CompoundFormat<T> 
          * DefaultFormat.getInstance(…) will indirectly perform this kind of comparison.
          */
         if (Number.class.isAssignableFrom(valueType)) {
-            if (locale == null) {
+            if (Locale.ROOT.equals(locale)) {
                 return DefaultFormat.getInstance(valueType);
             } else if (valueType == Number.class) {
                 return NumberFormat.getInstance(locale);
             }
         } else if (valueType == Date.class) {
             final DateFormat format;
-            if (locale != null) {
+            if (!Locale.ROOT.equals(locale)) {
                 format = DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, locale);
             } else {
-                format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.US);
+                format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss", Locale.ROOT);
             }
             format.setTimeZone(timezone != null ? timezone : TimeZone.getTimeZone("UTC"));
             return format;
         } else if (valueType == Angle.class) {
-            return AngleFormat.getInstance(locale != null ? locale : Locale.US);
+            return AngleFormat.getInstance(locale);
         }
         return null;
     }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TableAppender.java Tue Feb 12 16:32:28 2013
@@ -77,7 +77,7 @@ import org.apache.sis.internal.util.JDK7
  * @version 0.3
  * @module
  *
- * @see org.apache.sis.util.tree.TreeTableFormat
+ * @see org.apache.sis.util.collection.TreeTableFormat
  */
 @Decorator(Appendable.class)
 public class TableAppender extends Appender implements Flushable {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java Tue Feb 12 16:32:28 2013
@@ -135,7 +135,8 @@ public abstract class TabularFormat<T> e
     /**
      * Creates a new tabular format.
      *
-     * @param locale   The locale to use for numbers, dates and angles formatting.
+     * @param locale   The locale to use for numbers, dates and angles formatting,
+     *                 or {@code null} for the {@linkplain Locale#ROOT root locale}.
      * @param timezone The timezone, or {@code null} for UTC.
      */
     public TabularFormat(final Locale locale, final TimeZone timezone) {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java Tue Feb 12 16:32:28 2013
@@ -110,13 +110,14 @@ public class StatisticsFormat extends Ta
      * Constructs a new format for the given numeric and header locales.
      * The timezone is used only if the values added to the {@link Statistics} are dates.
      *
-     * @param locale       The locale for numeric values, or {@code null} for unlocalized format.
+     * @param locale       The locale to use for numbers, dates and angles formatting,
+     *                     or {@code null} for the {@linkplain Locale#ROOT root locale}.
      * @param headerLocale The locale for row and column headers. Usually same as {@code locale}.
      * @param timezone     The timezone, or {@code null} for UTC.
      */
     public StatisticsFormat(final Locale locale, final Locale headerLocale, final TimeZone timezone) {
         super(locale, timezone);
-        this.headerLocale = headerLocale;
+        this.headerLocale = (headerLocale != null) ? headerLocale : Locale.ROOT;
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Angle.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Angle.java Tue Feb 12 16:32:28 2013
@@ -102,7 +102,7 @@ public class Angle implements Comparable
         } catch (ParseException exception) {
             /*
              * Use Exception.getMessage() instead than getLocalizedMessage() because the later
-             * is formatted in the AngleFormat locale, which is hard-coded to Locale.US in our
+             * is formatted in the AngleFormat locale, which is hard-coded to Locale.ROOT in our
              * 'getAngleFormat()' implementation. The getMessage() method uses the system locale,
              * which is what we actually want.
              */
@@ -240,7 +240,7 @@ public class Angle implements Comparable
     private static Format getAngleFormat() {
         assert Thread.holdsLock(Angle.class);
         if (format == null) {
-            format = AngleFormat.getInstance(Locale.US);
+            format = AngleFormat.getInstance(Locale.ROOT);
         }
         return format;
     }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java Tue Feb 12 16:32:28 2013
@@ -239,7 +239,7 @@ public class AngleFormat extends Format 
     }
 
     /**
-     * The locale specified at construction time.
+     * The locale specified at construction time (never null).
      */
     private final Locale locale;
 
@@ -361,6 +361,7 @@ public class AngleFormat extends Format 
      * @param  locale The locale to use.
      */
     public AngleFormat(final Locale locale) {
+        ArgumentChecks.ensureNonNull("locale", locale);
         this.locale = locale;
         degreesFieldWidth     = 1;
         minutesFieldWidth     = 2;
@@ -392,6 +393,7 @@ public class AngleFormat extends Format 
      * @throws IllegalArgumentException If the specified pattern is illegal.
      */
     public AngleFormat(final String pattern, final Locale locale) throws IllegalArgumentException {
+        ArgumentChecks.ensureNonNull("locale", locale);
         this.locale = locale;
         applyPattern(pattern, SYMBOLS, '.');
     }
@@ -911,7 +913,7 @@ scan:   for (int i=0; i<length;) {
              * heavy formatToCharacterIterator(…). Otherwise the usual format(…) method fits well.
              */
             final int startPosition = toAppendTo.length();
-            if (characterIterator instanceof FormattedCharacterIterator) {
+            if (characterIterator != null) {
                 final FormattedCharacterIterator it = (FormattedCharacterIterator) characterIterator;
                 it.append(numberFormat.formatToCharacterIterator(value), toAppendTo);
                 if (suffix != null) {
@@ -1001,7 +1003,7 @@ scan:   for (int i=0; i<length;) {
             pos.setBeginIndex(startPosition);
             pos.setEndIndex(toAppendTo.length());
         }
-        if (characterIterator instanceof FormattedCharacterIterator) {
+        if (characterIterator != null) {
             ((FormattedCharacterIterator) characterIterator).addFieldLimit(
                     Field.HEMISPHERE, suffix, startPosition);
         }
@@ -1609,9 +1611,9 @@ BigBoss:    switch (skipSuffix(source, p
 
     /**
      * Returns this formatter locale. This is the locale specified at construction time if any,
-     * or the default locale at construction time otherwise.
+     * or the {@linkplain Locale#getDefault() default locale} at construction time otherwise.
      *
-     * @return This formatter locale.
+     * @return This formatter locale (never {@code null}).
      */
     @Override
     public Locale getLocale() {

Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java (from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java&r1=1445223&r2=1445244&rev=1445244&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/DateRange.java Tue Feb 12 16:32:28 2013
@@ -132,8 +132,8 @@ public class DateRange extends Range<Dat
         if (range == null || range instanceof DateRange) {
             return (DateRange) range;
         }
-        return new DateRange((Date) range.getMinValue(), range.isMinIncluded(),
-                             (Date) range.getMaxValue(), range.isMaxIncluded());
+        return new DateRange((Date) (Object) range.getMinValue(), range.isMinIncluded(),
+                             (Date) (Object) range.getMaxValue(), range.isMaxIncluded());
     }
 
     /**

Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java (from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java&r1=1445223&r2=1445244&rev=1445244&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/MeasurementRange.java Tue Feb 12 16:32:28 2013
@@ -24,7 +24,7 @@ import org.apache.sis.util.Numbers;
 import org.apache.sis.util.resources.Errors;
 
 // Related to JDK7
-import java.util.Objects;
+import org.apache.sis.internal.util.Objects;
 
 
 /**
@@ -59,7 +59,7 @@ public class MeasurementRange<T extends 
      * @return The new range of numeric values for the given bounds and unit of measurement.
      */
     public static MeasurementRange<Float> create(float minValue, float maxValue, Unit<?> units) {
-        return new MeasurementRange<>(Float.class,
+        return new MeasurementRange<Float>(Float.class,
                 valueOf("minValue", minValue, Float.NEGATIVE_INFINITY),
                 valueOf("maxValue", maxValue, Float.POSITIVE_INFINITY), units);
     }
@@ -77,7 +77,7 @@ public class MeasurementRange<T extends 
     public static MeasurementRange<Float> create(float minValue, boolean isMinIncluded,
                                                  float maxValue, boolean isMaxIncluded, Unit<?> units)
     {
-        return new MeasurementRange<>(Float.class,
+        return new MeasurementRange<Float>(Float.class,
                 valueOf("minValue", minValue, Float.NEGATIVE_INFINITY), isMinIncluded,
                 valueOf("maxValue", maxValue, Float.POSITIVE_INFINITY), isMaxIncluded, units);
     }
@@ -91,7 +91,7 @@ public class MeasurementRange<T extends 
      * @return The new range of numeric values for the given bounds and unit of measurement.
      */
     public static MeasurementRange<Double> create(double minValue, double maxValue, Unit<?> units) {
-        return new MeasurementRange<>(Double.class,
+        return new MeasurementRange<Double>(Double.class,
                 valueOf("minValue", minValue, Double.NEGATIVE_INFINITY),
                 valueOf("maxValue", maxValue, Double.POSITIVE_INFINITY), units);
     }
@@ -109,7 +109,7 @@ public class MeasurementRange<T extends 
     public static MeasurementRange<Double> create(double minValue, boolean isMinIncluded,
                                                   double maxValue, boolean isMaxIncluded, Unit<?> units)
     {
-        return new MeasurementRange<>(Double.class,
+        return new MeasurementRange<Double>(Double.class,
                 valueOf("minValue", minValue, Double.NEGATIVE_INFINITY), isMinIncluded,
                 valueOf("maxValue", maxValue, Double.POSITIVE_INFINITY), isMaxIncluded, units);
     }
@@ -207,7 +207,7 @@ public class MeasurementRange<T extends 
     MeasurementRange<T> create(final T minValue, final boolean isMinIncluded,
                                final T maxValue, final boolean isMaxIncluded)
     {
-        return new MeasurementRange<>(elementType, minValue, isMinIncluded, maxValue, isMaxIncluded, units);
+        return new MeasurementRange<T>(elementType, minValue, isMinIncluded, maxValue, isMaxIncluded, units);
     }
 
     /**
@@ -265,7 +265,7 @@ public class MeasurementRange<T extends 
                         Errors.Keys.IncompatibleUnits_2, casted.units, units), e);
             }
         }
-        return new MeasurementRange<>(type, range, units);
+        return new MeasurementRange<N>(type, range, units);
     }
 
     /**
@@ -286,15 +286,15 @@ public class MeasurementRange<T extends 
             if (type.equals(elementType)) {
                 return (MeasurementRange<N>) this;
             } else {
-                return new MeasurementRange<>(type, this, units);
+                return new MeasurementRange<N>(type, this, units);
             }
         }
         if (units == null) {
-            return new MeasurementRange<>(type, this, targetUnits);
+            return new MeasurementRange<N>(type, this, targetUnits);
         }
         final UnitConverter converter = units.getConverterToAny(targetUnits);
         if (converter.equals(UnitConverter.IDENTITY)) {
-            return new MeasurementRange<>(type, this, targetUnits);
+            return new MeasurementRange<N>(type, this, targetUnits);
         }
         boolean isMinIncluded = isMinIncluded();
         boolean isMaxIncluded = isMaxIncluded();
@@ -308,7 +308,7 @@ public class MeasurementRange<T extends 
             isMinIncluded = isMaxIncluded;
             isMaxIncluded = tb;
         }
-        return new MeasurementRange<>(type,
+        return new MeasurementRange<N>(type,
                 Numbers.cast(minimum, type), isMinIncluded,
                 Numbers.cast(maximum, type), isMaxIncluded, targetUnits);
     }

Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java (from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java&r1=1445223&r2=1445244&rev=1445244&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/NumberRange.java Tue Feb 12 16:32:28 2013
@@ -60,7 +60,7 @@ public class NumberRange<T extends Numbe
      * @return The new range of numeric values for the given bounds.
      */
     public static NumberRange<Byte> create(final byte minValue, final byte maxValue) {
-        return new NumberRange<>(Byte.class, Byte.valueOf(minValue), Byte.valueOf(maxValue));
+        return new NumberRange<Byte>(Byte.class, Byte.valueOf(minValue), Byte.valueOf(maxValue));
     }
 
     /**
@@ -75,7 +75,7 @@ public class NumberRange<T extends Numbe
     public static NumberRange<Byte> create(final byte minValue, final boolean isMinIncluded,
                                            final byte maxValue, final boolean isMaxIncluded)
     {
-        return new NumberRange<>(Byte.class,
+        return new NumberRange<Byte>(Byte.class,
                 Byte.valueOf(minValue), isMinIncluded,
                 Byte.valueOf(maxValue), isMaxIncluded);
     }
@@ -88,7 +88,7 @@ public class NumberRange<T extends Numbe
      * @return The new range of numeric values for the given bounds.
      */
     public static NumberRange<Short> create(final short minValue, final short maxValue) {
-        return new NumberRange<>(Short.class, Short.valueOf(minValue), Short.valueOf(maxValue));
+        return new NumberRange<Short>(Short.class, Short.valueOf(minValue), Short.valueOf(maxValue));
     }
 
     /**
@@ -103,7 +103,7 @@ public class NumberRange<T extends Numbe
     public static NumberRange<Short> create(final short minValue, final boolean isMinIncluded,
                                             final short maxValue, final boolean isMaxIncluded)
     {
-        return new NumberRange<>(Short.class,
+        return new NumberRange<Short>(Short.class,
                 Short.valueOf(minValue), isMinIncluded,
                 Short.valueOf(maxValue), isMaxIncluded);
     }
@@ -116,7 +116,7 @@ public class NumberRange<T extends Numbe
      * @return The new range of numeric values for the given bounds.
      */
     public static NumberRange<Integer> create(final int minValue, final int maxValue) {
-        return new NumberRange<>(Integer.class, Integer.valueOf(minValue), Integer.valueOf(maxValue));
+        return new NumberRange<Integer>(Integer.class, Integer.valueOf(minValue), Integer.valueOf(maxValue));
     }
 
     /**
@@ -131,7 +131,7 @@ public class NumberRange<T extends Numbe
     public static NumberRange<Integer> create(final int minValue, final boolean isMinIncluded,
                                               final int maxValue, final boolean isMaxIncluded)
     {
-        return new NumberRange<>(Integer.class,
+        return new NumberRange<Integer>(Integer.class,
                 Integer.valueOf(minValue), isMinIncluded,
                 Integer.valueOf(maxValue), isMaxIncluded);
     }
@@ -144,7 +144,7 @@ public class NumberRange<T extends Numbe
      * @return The new range of numeric values for the given bounds.
      */
     public static NumberRange<Long> create(final long minValue, final long maxValue) {
-        return new NumberRange<>(Long.class, Long.valueOf(minValue), Long.valueOf(maxValue));
+        return new NumberRange<Long>(Long.class, Long.valueOf(minValue), Long.valueOf(maxValue));
     }
 
     /**
@@ -159,7 +159,7 @@ public class NumberRange<T extends Numbe
     public static NumberRange<Long> create(final long minValue, final boolean isMinIncluded,
                                            final long maxValue, final boolean isMaxIncluded)
     {
-        return new NumberRange<>(Long.class,
+        return new NumberRange<Long>(Long.class,
                 Long.valueOf(minValue), isMinIncluded,
                 Long.valueOf(maxValue), isMaxIncluded);
     }
@@ -173,7 +173,7 @@ public class NumberRange<T extends Numbe
      * @return The new range of numeric values for the given bounds.
      */
     public static NumberRange<Float> create(final float minValue, final float maxValue) {
-        return new NumberRange<>(Float.class,
+        return new NumberRange<Float>(Float.class,
                 valueOf("minValue", minValue, Float.NEGATIVE_INFINITY),
                 valueOf("maxValue", maxValue, Float.POSITIVE_INFINITY));
     }
@@ -191,7 +191,7 @@ public class NumberRange<T extends Numbe
     public static NumberRange<Float> create(final float minValue, final boolean isMinIncluded,
                                             final float maxValue, final boolean isMaxIncluded)
     {
-        return new NumberRange<>(Float.class,
+        return new NumberRange<Float>(Float.class,
                 valueOf("minValue", minValue, Float.NEGATIVE_INFINITY), isMinIncluded,
                 valueOf("maxValue", maxValue, Float.POSITIVE_INFINITY), isMaxIncluded);
     }
@@ -216,7 +216,7 @@ public class NumberRange<T extends Numbe
      * @return The new range of numeric values for the given bounds.
      */
     public static NumberRange<Double> create(final double minValue, final double maxValue) {
-        return new NumberRange<>(Double.class,
+        return new NumberRange<Double>(Double.class,
                 valueOf("minValue", minValue, Double.NEGATIVE_INFINITY),
                 valueOf("maxValue", maxValue, Double.POSITIVE_INFINITY));
     }
@@ -234,7 +234,7 @@ public class NumberRange<T extends Numbe
     public static NumberRange<Double> create(final double minValue, final boolean isMinIncluded,
                                              final double maxValue, final boolean isMaxIncluded)
     {
-        return new NumberRange<>(Double.class,
+        return new NumberRange<Double>(Double.class,
                 valueOf("minValue", minValue, Double.NEGATIVE_INFINITY), isMinIncluded,
                 valueOf("maxValue", maxValue, Double.POSITIVE_INFINITY), isMaxIncluded);
     }
@@ -299,7 +299,7 @@ public class NumberRange<T extends Numbe
             return (NumberRange<N>) range;
         }
         // The constructor will ensure that the range element class is a subclass of Number.
-        return new NumberRange<>(range);
+        return new NumberRange<N>(range);
     }
 
     /**
@@ -366,7 +366,7 @@ public class NumberRange<T extends Numbe
     NumberRange<T> create(final T minValue, final boolean isMinIncluded,
                           final T maxValue, final boolean isMaxIncluded)
     {
-        return new NumberRange<>(elementType, minValue, isMinIncluded, maxValue, isMaxIncluded);
+        return new NumberRange<T>(elementType, minValue, isMinIncluded, maxValue, isMaxIncluded);
     }
 
     /**
@@ -426,7 +426,7 @@ public class NumberRange<T extends Numbe
             // Safe because we checked in the line just above.
             return (NumberRange<N>) wrap((Range) range);
         }
-        return new NumberRange<>(type, range);
+        return new NumberRange<N>(type, range);
     }
 
     /**

Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Range.java (from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Range.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Range.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java&r1=1445223&r2=1445244&rev=1445244&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Range.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/Range.java Tue Feb 12 16:32:28 2013
@@ -26,7 +26,7 @@ import org.apache.sis.util.Numbers;
 import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
 
 // Related to JDK7
-import java.util.Objects;
+import org.apache.sis.internal.util.Objects;
 
 
 /**
@@ -150,7 +150,7 @@ public class Range<T extends Comparable<
     Range<T> create(final T minValue, final boolean isMinIncluded,
                     final T maxValue, final boolean isMaxIncluded)
     {
-        return new Range<>(elementType, minValue, isMinIncluded, maxValue, isMaxIncluded);
+        return new Range<T>(elementType, minValue, isMinIncluded, maxValue, isMaxIncluded);
     }
 
     /**

Copied: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java (from r1445223, sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java?p2=sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java&p1=sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java&r1=1445223&r2=1445244&rev=1445244&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/RangeFormat.java Tue Feb 12 16:32:28 2013
@@ -240,7 +240,7 @@ public class RangeFormat extends Format 
      * using the {@linkplain Locale#getDefault() default locale}.
      */
     public RangeFormat() {
-        this(Locale.getDefault(Locale.Category.FORMAT));
+        this(Locale.getDefault());
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/package-info.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/package-info.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/measure/package-info.java Tue Feb 12 16:32:28 2013
@@ -24,6 +24,10 @@
  *   <li>{@link org.apache.sis.measure.Angle} and its subclasses
  *      ({@link org.apache.sis.measure.Longitude},
  *       {@link org.apache.sis.measure.Latitude})</li>
+ *   <li>{@link org.apache.sis.measure.Range} and its subclasses
+ *      ({@link org.apache.sis.measure.DateRange},
+ *       {@link org.apache.sis.measure.NumberRange},
+ *       {@link org.apache.sis.measure.MeasurementRange})</li>
  *   <li>Formatters
  *      ({@link org.apache.sis.measure.AngleFormat},
  *       {@link org.apache.sis.measure.CoordinateFormat},

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Localized.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Localized.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Localized.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Localized.java Tue Feb 12 16:32:28 2013
@@ -35,10 +35,14 @@ public interface Localized {
      *
      * <ul>
      *   <li>A synonymous of the {@linkplain Locale#getDefault() system default locale};</li>
-     *   <li>or an "unlocalized" service, for example formatting numbers using
-     *       {@link Double#toString(double)} instead than {@link java.text.NumberFormat}.</li>
+     *   <li>A synonymous of {@link Locale#ROOT} for an "unlocalized" service. For example the
+     *       service may format numbers using {@link Double#toString(double)} instead than
+     *       {@link java.text.NumberFormat}.</li>
      * </ul>
      *
+     * Implementations are encouraged to return a non-null value in every cases.
+     * Nevertheless client codes should be prepared to receive null values.
+     *
      * @return The locale, or {@code null} if not explicitly defined.
      *
      * @see org.apache.sis.io.CompoundFormat#getLocale()

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Numbers.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Numbers.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/Numbers.java Tue Feb 12 16:32:28 2013
@@ -516,14 +516,21 @@ public final class Numbers extends Stati
      * </ul>
      *
      * {@note This method is intentionally restricted to primitive types. Other types
-     *        like <code>BigDecimal</code> are not the purpose of this method. See the
-     *        <code>ConverterRegistry</code> class for a more generic method.}
+     *        like <code>BigDecimal</code> are not the purpose of this method.
+     *        See <code>ObjectConverter</code> for more generic methods.}
      *
-     * @param <N> The class to cast to.
-     * @param n The number to cast.
-     * @param c The destination type.
+     * This method does not verify if the given type is wide enough for the given value,
+     * because the type has typically been calculated by {@link #widestClass(Class, Class)}
+     * or {@link #narrowestClass(Number)}. If nevertheless the given type is not wide enough,
+     * then the behavior depends on the implementation of the corresponding
+     * {@code Number.fooValue()} method - typically, the value is just rounded or truncated.
+     *
+     * @param  <N> The class to cast to.
+     * @param  n The number to cast.
+     * @param  c The destination type.
      * @return The number casted to the given type.
-     * @throws IllegalArgumentException If the given type is unknown.
+     * @throws IllegalArgumentException If the given type is not one of the primitive
+     *         wrappers for numeric types.
      */
     @SuppressWarnings("unchecked")
     public static <N extends Number> N cast(final Number n, final Class<N> c)

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CollectionsExt.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CollectionsExt.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/CollectionsExt.java Tue Feb 12 16:32:28 2013
@@ -128,7 +128,7 @@ public final class CollectionsExt extend
      * <p>The {@link Set#add(Object) Set.add(E)} method is supported only if the given converter
      * is {@linkplain org.apache.sis.math.FunctionProperty#INVERTIBLE invertible}.
      * An invertible converter is not mandatory for other {@code Set} operations.
-     * However {@link Set#contains(Object) contains} and {@link #remove(Object) remove}
+     * However {@link Set#contains(Object) contains} and {@link Set#remove(Object) remove}
      * operations are likely to be faster if the inverse converter is available.</p>
      *
      * <p>The derived set may contain fewer elements than the original set if some elements
@@ -618,7 +618,7 @@ public final class CollectionsExt extend
     }
 
     /**
-     * Returns a comparator for map entries having comparable {@linkplain Map.Entry#getValue() values}.
+     * Returns a comparator for map entries having comparable {@linkplain java.util.Map.Entry#getValue() values}.
      * For any pair of entries {@code e1} and {@code e2}, this method performs the comparison as below:
      *
      * {@preformat java

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/DefaultTreeTable.java Tue Feb 12 16:32:28 2013
@@ -506,8 +506,8 @@ public class DefaultTreeTable implements
 
         /**
          * Adds a new child in the {@linkplain #getChildren() children list}.
-         * The default implementation delegates to {@link #Node(Node)}, which
-         * has the following implications:
+         * The default implementation delegates to {@link Node#Node(Node)},
+         * which has the following implications:
          *
          * <ul>
          *   <li>The new node inherits the columns of this node, on the assumption that

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java Tue Feb 12 16:32:28 2013
@@ -145,7 +145,8 @@ public class TreeTableFormat extends Tab
     /**
      * Creates a new tree table format.
      *
-     * @param locale   The locale to use for numbers, dates and angles formatting.
+     * @param locale   The locale to use for numbers, dates and angles formatting,
+     *                 or {@code null} for the {@linkplain Locale#ROOT root locale}.
      * @param timezone The timezone, or {@code null} for UTC.
      */
     public TreeTableFormat(final Locale locale, final TimeZone timezone) {

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/UnmodifiableArrayList.java Tue Feb 12 16:32:28 2013
@@ -63,7 +63,7 @@ public class UnmodifiableArrayList<E> ex
      * retained (i.e. the array is <strong>not</strong> cloned). Consequently the given array
      * shall not be modified after construction if this list is intended to be immutable.
      *
-     * <p>This constructor is for sub-classing only. Users should invoke the {@link #wrap(E[])}
+     * <p>This constructor is for sub-classing only. Users should invoke the {@link #wrap(Object[])}
      * static method instead.</p>
      *
      * @param array The array to wrap.
@@ -253,7 +253,7 @@ public class UnmodifiableArrayList<E> ex
      * @return A view of the specified range within this list.
      * @throws IndexOutOfBoundsException If the lower or upper value are out of bounds.
      *
-     * @see #wrap(E[], int, int)
+     * @see #wrap(Object[], int, int)
      */
     @Override
     public UnmodifiableArrayList<E> subList(final int lower, final int upper)

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java Tue Feb 12 16:32:28 2013
@@ -30,8 +30,8 @@ import org.apache.sis.util.Debug;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Workaround;
-import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.NullArgumentException;
+import org.apache.sis.util.resources.Errors;
 
 import static org.apache.sis.util.collection.WeakEntry.*;
 
@@ -386,8 +386,10 @@ public class WeakValueHashMap<K,V> exten
      */
     @Override
     public V put(final K key, final V value) throws NullArgumentException {
-        ArgumentChecks.ensureNonNull("key",   key);
-        ArgumentChecks.ensureNonNull("value", value);
+        if (key == null || value == null) {
+            throw new NullArgumentException(Errors.format(key == null
+                    ? Errors.Keys.NullMapKey : Errors.Keys.NullMapValue));
+        }
         return intern(key, value);
     }
 

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java Tue Feb 12 16:32:28 2013
@@ -44,11 +44,11 @@ public abstract class AbstractInternatio
      * The string in the {@linkplain Locale#getDefault() system default} locale, or {@code null}
      * if this string has not yet been determined. This is the default string returned by
      * {@link #toString()} and others methods from the {@link CharSequence} interface.
-     * <P>
-     * This field is not serialized because serialization is often used for data transmission
+     *
+     * <p>This field is not serialized because serialization is often used for data transmission
      * between a server and a client, and the client may not use the same locale than the server.
-     * We want the locale to be examined again on the client side.
-     * <P>
+     * We want the locale to be examined again on the client side.</p>
+     *
      * This field is read and written by {@link SimpleInternationalString}.
      */
     transient String defaultValue;
@@ -127,15 +127,33 @@ public abstract class AbstractInternatio
 
     /**
      * Returns this string in the given locale. If no string is available in the given locale,
-     * then some default locale is used. The default locale is implementation-dependent.
-     * It may or may not be the {@linkplain Locale#getDefault() system default}.
+     * then some fallback locale is used. The fallback locale is implementation-dependent, and
+     * is not necessarily the same than the default locale used by the {@link #toString()} method.
+     *
+     * {@section Handling of <code>Locale.ROOT</code> argument value}
+     * {@link Locale#ROOT} can be given to this method for requesting a "unlocalized" string,
+     * typically some programmatic values like enumerations or identifiers. While identifiers
+     * often look like English words, {@code Locale.ROOT} is not considered synonymous to
+     * {@link Locale#ENGLISH} because the values may differ in the way numbers and dates are
+     * formatted (e.g. using the ISO 8601 standard for dates instead than English conventions).
+     *
+     * {@section Handling of <code>null</code> argument value}
+     * The {@code Locale.ROOT} constant is new in Java 6. Some other libraries designed for Java 5
+     * use the {@code null} value for "unlocalized" strings. Apache SIS accepts {@code null} value
+     * for inter-operability with those libraries. However the behavior is implementation dependent:
+     * some subclasses will take {@code null} as a synonymous of the system default locale, while
+     * other subclasses will take {@code null} as a synonymous of the root locale. In order to
+     * ensure determinist behavior, client code are encouraged to specify only non-null values.
+     *
+     * @param  locale The desired locale for the string to be returned.
+     * @return The string in the given locale if available, or in an
+     *         implementation-dependent fallback locale otherwise.
      *
-     * @param  locale The desired locale for the string to be returned,
-     *         or {@code null} for a string in the implementation default locale.
-     * @return The string in the given locale if available, or in the default locale otherwise.
+     * @see Locale#getDefault()
+     * @see Locale#ROOT
      */
     @Override
-    public abstract String toString(final Locale locale);
+    public abstract String toString(Locale locale);
 
     /**
      * Returns this string in the default locale. Invoking this method is equivalent to invoking

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java Tue Feb 12 16:32:28 2013
@@ -234,8 +234,8 @@ public abstract class AbstractName imple
             }
             asString = buffer.toString();
         }
-        // Note: there is no need to invoke InternationalString.toString(null) for the
-        // unlocalized version, because our International inner class is implemented in
+        // Note: there is no need to invoke InternationalString.toString(Locale.ROOT) for
+        // the unlocalized version, because our International inner class is implemented in
         // such a way that InternationalString.toString() returns AbstractName.toString().
         return asString.toString();
     }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java Tue Feb 12 16:32:28 2013
@@ -29,6 +29,7 @@ import java.util.Locale;
 import net.jcip.annotations.ThreadSafe;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.Locales;
+import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 
 import static org.apache.sis.util.collection.CollectionsExt.isNullOrEmpty;
@@ -85,7 +86,7 @@ public class DefaultInternationalString 
      */
     public DefaultInternationalString(final String string) {
         if (string != null) {
-            localeMap = Collections.singletonMap(null, string);
+            localeMap = Collections.singletonMap(Locale.ROOT, string);
         } else {
             localeMap = Collections.emptyMap();
         }
@@ -111,43 +112,48 @@ public class DefaultInternationalString 
                 // If HashMap is replaced by an other type, please revisit 'getLocales()'.
             }
         }
+        final boolean nullMapKey = localeMap.containsKey(null);
+        if (nullMapKey || localeMap.containsValue(null)) {
+            throw new IllegalArgumentException(Errors.format(nullMapKey
+                    ? Errors.Keys.NullMapKey : Errors.Keys.NullMapValue));
+        }
     }
 
     /**
      * Adds a string for the given locale.
      *
-     * @param  locale The locale for the {@code string} value, or {@code null}.
+     * @param  locale The locale for the {@code string} value.
      * @param  string The localized string.
      * @throws IllegalArgumentException if a different string value was already set for
      *         the given locale.
      */
     public synchronized void add(final Locale locale, final String string) throws IllegalArgumentException {
-        if (string != null) {
-            switch (localeMap.size()) {
-                case 0: {
-                    localeMap = Collections.singletonMap(locale, string);
-                    localeSet = null;
-                    defaultValue = null; // Will be recomputed when first needed.
-                    return;
-                }
-                case 1: {
-                    // If HashMap is replaced by an other type, please revisit 'getLocales()'.
-                    localeMap = new LinkedHashMap<Locale,String>(localeMap);
-                    localeSet = null;
-                    break;
-                }
+        ArgumentChecks.ensureNonNull("locale", locale);
+        ArgumentChecks.ensureNonNull("string", string);
+        switch (localeMap.size()) {
+            case 0: {
+                localeMap = Collections.singletonMap(locale, string);
+                localeSet = null;
+                defaultValue = null; // Will be recomputed when first needed.
+                return;
             }
-            final String old = localeMap.put(locale, string);
-            if (old != null) {
-                localeMap.put(locale, old);
-                if (string.equals(old)) {
-                    return;
-                }
-                throw new IllegalArgumentException(Errors.format(
-                        Errors.Keys.ValueAlreadyDefined_1, locale));
+            case 1: {
+                // If HashMap is replaced by an other type, please revisit 'getLocales()'.
+                localeMap = new LinkedHashMap<Locale,String>(localeMap);
+                localeSet = null;
+                break;
             }
-            defaultValue = null; // Will be recomputed when first needed.
         }
+        final String old = localeMap.put(locale, string);
+        if (old != null) {
+            localeMap.put(locale, old);
+            if (string.equals(old)) {
+                return;
+            }
+            throw new IllegalArgumentException(Errors.format(
+                    Errors.Keys.ValueAlreadyDefined_1, locale));
+        }
+        defaultValue = null; // Will be recomputed when first needed.
     }
 
     /**
@@ -250,60 +256,69 @@ public class DefaultInternationalString 
      * part. If no string are found, then this method searches for a locale without the
      * {@linkplain Locale#getCountry() country} part. For example if the {@code "fr_CA"} locale
      * was requested but not found, then this method looks for the {@code "fr"} locale.
-     * The {@code null} locale (which stand for unlocalized message) is tried last.
+     * The {@linkplain Locale#ROOT root locale} is tried last.
      *
-     * {@section Handling of <code>null</code> argument value}
-     * A {@code null} argument value can be given to this method for requesting a "unlocalized" string,
-     * typically some programmatic strings like {@linkplain org.opengis.annotation.UML#identifier() UML
-     * identifiers}. While such identifiers often look like English words, the {@code null} locale is
-     * not considered synonymous to the {@linkplain Locale#ENGLISH English locale} since the values may
-     * differ in the way numbers and dates are formatted (e.g. using the ISO 8601 standard for dates
-     * instead than English conventions). In order to produce a value close to the common practice,
-     * this method handles {@code null} argument value as below:
+     * {@section Handling of <code>Locale.ROOT</code> argument value}
+     * {@link Locale#ROOT} can be given to this method for requesting a "unlocalized" string,
+     * typically some programmatic values like enumerations or identifiers.
+     * While identifiers often look like English words, {@code Locale.ROOT} is not considered
+     * synonymous to {@link Locale#ENGLISH} because the values may differ in the way numbers and
+     * dates are formatted (e.g. using the ISO 8601 standard for dates instead than English conventions).
+     * In order to produce a value close to the common practice, this method handles {@code Locale.ROOT}
+     * as below:
      *
      * <ul>
-     *   <li>If a string has been explicitly {@linkplain #add(Locale, String) added} for the
-     *       {@code null} locale, then that string is returned.</li>
+     *   <li>If a string has been explicitly {@linkplain #add(Locale, String) added} for
+     *       {@code Locale.ROOT}, then that string is returned.</li>
      *   <li>Otherwise, acknowledging that UML identifiers in OGC/ISO specifications are primarily
-     *       expressed in the English language, this method looks for an English string as an
-     *       approximation of a "unlocalized" string.</li>
-     *   <li>If no English string was found, this method looks for a string for the
+     *       expressed in the English language, this method looks for strings associated to
+     *       {@link Locale#US} as an approximation of "unlocalized" strings.</li>
+     *   <li>If no English string was found, then this method looks for a string for the
      *       {@linkplain Locale#getDefault() system default locale}.</li>
      *   <li>If none of the above steps found a string, then this method returns
      *       an arbitrary string.</li>
      * </ul>
      *
-     * @param  locale The locale to look for, or {@code null}.
-     * @return The string in the specified locale, or in a default locale.
+     * {@section Handling of <code>null</code> argument value}
+     * In the default implementation, the {@code null} locale is handled as a synonymous of
+     * {@code Locale.ROOT}. However subclasses are free to use a different fallback. Client
+     * code are encouraged to specify only non-null values for more determinist behavior.
+     *
+     * @param  locale The desired locale for the string to be returned.
+     * @return The string in the given locale if available, or in an
+     *         implementation-dependent fallback locale otherwise.
      */
     @Override
     public synchronized String toString(final Locale locale) {
         String text = getString(locale);
         if (text == null) {
             /*
-             * No string for the requested locale. Try the string in the 'null' locale first, then
-             * the string in the system-default last.  Note: in a previous version we were looking
-             * for the system default first, but it produced unexpected results in many cases. The
-             * i18n string is often constructed with an English sentence for the "null" locale (the
-             * unlocalized text) without explicit entry for the English locale since the "null" one
-             * is supposed to be the default according javadoc. If we were looking for the default
-             * locale on a system having French as the default, the effect would be to return a
-             * sentence in French when the user asked for a sentence in English (or any language
-             * not explicitly declared). Generally the "unlocalized" text is in English, so it is
-             * a better bet as a fallback.
+             * No localized string for the requested locale.
+             * Try fallbacks in the following order:
+             *
+             *  1) Locale.ROOT
+             *  2) Locale.US, as an approximation of "unlocalized" strings.
+             *  3) Locale.getDefault()
+             *
+             * Locale.getDefault() must be last because the i18n string is often constructed with
+             * an English sentence for the 'ROOT' locale (the unlocalized text), without explicit
+             * entry for the English locale since the 'ROOT' locale is the fallback. If we were
+             * looking for the default locale first on a system having French as the default locale,
+             * we would get a sentence in French when the user asked for a sentence in English or
+             * any language not explicitly declared.
              */
-            text = localeMap.get(null);
+            text = localeMap.get(Locale.ROOT);
             if (text == null) {
-                Locale def = Locale.US; // The default language for "unlocalized" string.
-                if (locale != def) { // Avoid requesting the same locale twice (optimization).
-                    text = getString(def);
+                Locale fallback = Locale.US; // The fallback language for "unlocalized" string.
+                if (fallback != locale) { // Avoid requesting the same locale twice (optimization).
+                    text = getString(fallback);
                     if (text != null) {
                         return text;
                     }
                 }
-                def = Locale.getDefault();
-                if (locale != def && def != Locale.US) {
-                    text = getString(def);
+                fallback = Locale.getDefault();
+                if (fallback != locale && fallback != Locale.US) {
+                    text = getString(fallback);
                     if (text != null) {
                         return text;
                     }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java Tue Feb 12 16:32:28 2013
@@ -18,6 +18,7 @@ package org.apache.sis.util.iso;
 
 import java.util.List;
 import java.util.Collections;
+import java.util.Locale;
 import java.io.ObjectStreamException;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
@@ -89,7 +90,7 @@ public class DefaultLocalName extends Ab
     /**
      * Constructs a local name from the given character sequence.
      * If the character sequence is an instance of {@link InternationalString},
-     * then its {@link InternationalString#toString(java.util.Locale) toString(null)}
+     * then its {@link InternationalString#toString(java.util.Locale) toString(Locale.ROOT)}
      * method will be invoked for fetching an unlocalized name.
      * Otherwise the {@link CharSequence#toString()} method will be used.
      *
@@ -182,13 +183,12 @@ public class DefaultLocalName extends Ab
     public synchronized String toString() {
         if (asString == null) {
             if (name instanceof InternationalString) {
-                // We really want the 'null' locale, not the system default one.
-                asString = ((InternationalString) name).toString(null);
+                asString = ((InternationalString) name).toString(Locale.ROOT);
             } else {
                 asString = name.toString();
             }
         } else if (asString instanceof InternationalString) {
-            return ((InternationalString) asString).toString(null);
+            return ((InternationalString) asString).toString(Locale.ROOT);
         }
         return asString.toString();
     }

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java Tue Feb 12 16:32:28 2013
@@ -19,6 +19,7 @@ package org.apache.sis.util.iso;
 import java.util.Map;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Locale;
 import java.io.Serializable;
 import java.io.ObjectStreamException;
 import net.jcip.annotations.Immutable;
@@ -344,7 +345,7 @@ public class DefaultNameSpace implements
      */
     private static String key(final CharSequence name) {
         return (name instanceof InternationalString) ?
-                ((InternationalString) name).toString(null) : name.toString();
+                ((InternationalString) name).toString(Locale.ROOT) : name.toString();
     }
 
     /**

Modified: sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java?rev=1445244&r1=1445243&r2=1445244&view=diff
==============================================================================
--- sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java (original)
+++ sis/branches/JDK6/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java Tue Feb 12 16:32:28 2013
@@ -103,8 +103,8 @@ public class DefaultScopedName extends A
     /**
      * Constructs a scoped name from the specified list of strings.
      * If any of the given names is an instance of {@link InternationalString}, then its
-     * {@link InternationalString#toString(java.util.Locale) toString(null)} method will
-     * be invoked for fetching an unlocalized name.
+     * {@link InternationalString#toString(java.util.Locale) toString(Locale.ROOT)}
+     * method will be invoked for fetching an unlocalized name.
      * Otherwise the {@link CharSequence#toString()} method will be used.
      *
      * @param scope The scope of this name, or {@code null} for the global scope.



Mime
View raw message