You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2013/02/04 13:48:14 UTC

svn commit: r1442094 - in /sis/branches/JDK7: sis-utility/src/main/java/org/apache/sis/internal/jaxb/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/ sis-utility/src/main/java/org/...

Author: desruisseaux
Date: Mon Feb  4 12:48:12 2013
New Revision: 1442094

URL: http://svn.apache.org/viewvc?rev=1442094&view=rev
Log:
Avoid null locale, use Locale.ROOT instead (SIS-78).

Modified:
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
    sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TableColumnTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
    sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java
    sis/branches/JDK7/src/main/docbook/fr/utility.xml

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/MarshalContext.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/LocalNameAdapter.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/ScopedNameAdapter.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gco/StringAdapter.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/PT_FreeText.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Citations.java Mon Feb  4 12:48:12 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;
@@ -86,8 +87,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;
                     }
@@ -126,8 +126,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/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/internal/util/Supervisor.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/CompoundFormat.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/io/TabularFormat.java Mon Feb  4 12:48:12 2013
@@ -132,7 +132,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/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/math/StatisticsFormat.java Mon Feb  4 12:48:12 2013
@@ -112,13 +112,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/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/Angle.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/measure/AngleFormat.java Mon Feb  4 12:48:12 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, '.');
     }
@@ -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() {

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/Localized.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/TreeTableFormat.java Mon Feb  4 12:48:12 2013
@@ -142,7 +142,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/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/collection/WeakValueHashMap.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractInternationalString.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java Mon Feb  4 12:48:12 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<>(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<>(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/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java Mon Feb  4 12:48:12 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/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultScopedName.java Mon Feb  4 12:48:12 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.

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java Mon Feb  4 12:48:12 2013
@@ -123,21 +123,22 @@ public class ResourceInternationalString
 
     /**
      * Returns a string in the specified locale. If there is no string for the specified
-     * {@code locale}, then this method search for a string in an other locale as
+     * {@code locale}, then this method searches for a string in an other locale as
      * specified in the {@link ResourceBundle} class description.
      *
-     * @param  locale The locale to look for, or {@code null} for an unlocalized version.
-     * @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 specified locale, or in a fallback locale.
      * @throws MissingResourceException is the key given to the constructor is invalid.
      */
     @Override
     public String toString(Locale locale) throws MissingResourceException {
         if (locale == null) {
-            // The English locale (NOT the system default) is often used
-            // as the real identifier in OGC IdentifiedObject naming. If
-            // a user wants a string in the system default locale, he
-            // should invokes the 'toString()' method instead.
-            locale = Locale.ENGLISH;
+            locale = Locale.ROOT; // For consistency with DefaultInternationalString.
         }
         return getBundle(locale).getString(key);
     }

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java Mon Feb  4 12:48:12 2013
@@ -217,9 +217,8 @@ public final class Types extends Static 
      *
      * <ul>
      *   <li>If {@code code} is {@code null}, then this method returns {@code null}.</li>
-     *   <li>If {@code locale} is {@code null}, then this method uses {@link Locale#US}
-     *       as a close approximation of "unlocalized" strings since OGC standards are
-     *       defined in English.</li>
+     *   <li>If {@code locale} is {@code null}, then this method uses {@link Locale#ROOT}
+     *       for "unlocalized" (typically English) strings.</li>
      *   <li>If there is no resources for the given code in the given language, then this method
      *       fallback on other languages as described in {@link ResourceBundle} javadoc.</li>
      *   <li>If there is no localized resources for the given code, then this method fallback
@@ -237,7 +236,7 @@ public final class Types extends Static 
             return null;
         }
         if (locale == null) {
-            locale = Locale.US;
+            locale = Locale.ROOT;
         }
         /*
          * The code below is a duplicated - in a different way - of CodeListProxy(CodeList)

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java Mon Feb  4 12:48:12 2013
@@ -294,6 +294,16 @@ public final class Errors extends Indexe
         public static final int NullArgument_1 = 0;
 
         /**
+         * Null key is not allowed in this dictionary.
+         */
+        public static final int NullMapKey = 64;
+
+        /**
+         * Null values are not allowed in this dictionary.
+         */
+        public static final int NullMapValue = 65;
+
+        /**
          * Array length is {0}, while we expected an even length.
          */
         public static final int OddArrayLength_1 = 61;

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties Mon Feb  4 12:48:12 2013
@@ -71,6 +71,9 @@ NonTemporalUnit_1               = \u201c
 NotANumber_1                    = Argument \u2018{0}\u2019 shall not be NaN (Not-a-Number).
 NotAPrimitiveWrapper_1          = Class \u2018{0}\u2019 is not a primitive type wrapper.
 NullArgument_1                  = Argument \u2018{0}\u2019 shall not be null.
+# Use the OGC/ISO "Dictionary" word instead of "Map" for avoiding confusion with geographic map.
+NullMapKey                      = Null key is not allowed in this dictionary.
+NullMapValue                    = Null values are not allowed in this dictionary.
 OddArrayLength_1                = Array length is {0}, while we expected an even length.
 RecursiveCreateCallForKey_1     = Recursive call while creating an object for the \u201c{0}\u201d key.
 RequireDecimalSeparator         = A decimal separator is required.

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties Mon Feb  4 12:48:12 2013
@@ -60,6 +60,8 @@ NonTemporalUnit_1               = \u201c
 NotANumber_1                    = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre NaN (Not-a-Number).
 NotAPrimitiveWrapper_1          = La classe \u2018{0}\u2019 n\u2019est pas un adaptateur d\u2019un type primitif.
 NullArgument_1                  = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre nul.
+NullMapKey                      = La cl\u00e9 nulle n\u2019est pas autoris\u00e9e dans ce dictionnaire.
+NullMapValue                    = Les valeurs nulles ne sont pas autoris\u00e9es dans ce dictionnaire.
 OddArrayLength_1                = La longueur du tableau est {0}, alors qu\u2019on attendait une longueur paire.
 RecursiveCreateCallForKey_1     = Appel r\u00e9cursif lors de la cr\u00e9ation d\u2019un objet pour la cl\u00e9 \u201c{0}\u201d.
 RequireDecimalSeparator         = Un s\u00e9parateur d\u00e9cimal est requis.

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java Mon Feb  4 12:48:12 2013
@@ -35,6 +35,7 @@ import org.opengis.util.InternationalStr
 
 import org.apache.sis.util.Debug;
 import org.apache.sis.util.Classes;
+import org.apache.sis.util.Localized;
 import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.logging.Logging;
@@ -57,7 +58,7 @@ import org.apache.sis.util.logging.Loggi
  * @module
  */
 @ThreadSafe
-public class IndexedResourceBundle extends ResourceBundle {
+public class IndexedResourceBundle extends ResourceBundle implements Localized {
     /**
      * Maximum string length for text inserted into another text. This parameter is used by
      * {@link #summarize}. Resource strings are never cut to this length. However, text replacing
@@ -309,10 +310,10 @@ public class IndexedResourceBundle exten
                     }
                 }
                 /*
-                 * Now, logs the message. This message is not localized.  Note that
-                 * Locale.getDisplayName() may return different string on different
-                 * Java implementation, but it doesn't matter here since we use the
-                 * result only for logging purpose.
+                 * Now, logs the message. This message is provided only in English.
+                 * Note that Locale.getDisplayName() may return different string on
+                 * different Java implementation, but it doesn't matter here since
+                 * we use the result only for logging purpose.
                  */
                 String language = null;
                 final Locale rl = getLocale(); // Sometime null with IBM's JDK.

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java Mon Feb  4 12:48:12 2013
@@ -106,23 +106,15 @@ abstract class ResourceInternationalStri
     /**
      * Returns a string in the specified locale.
      *
-     * @param  locale The locale to look for, or {@code null} for an unlocalized version.
-     * @return The string in the specified locale, or in a default locale.
+     * @param  locale The desired locale for the string to be returned.
+     * @return The string in the specified locale, or in a fallback locale.
      * @throws MissingResourceException is the key given to the constructor is invalid.
      */
     @Override
-    public String toString(Locale locale) throws MissingResourceException {
-        if (locale == null) {
-            // The English locale (NOT the system default) is often used
-            // as the real identifier in OGC IdentifiedObject naming. If
-            // a user wants a string in the system default locale, he
-            // should invokes the 'toString()' method instead.
-            locale = Locale.ENGLISH;
-        }
+    public String toString(final Locale locale) throws MissingResourceException {
         final IndexedResourceBundle resources = getBundle(locale);
-        return (key < 0)
-                ? resources.getString(~key)
-                : resources.getString(key, arguments);
+        return (key < 0) ? resources.getString(~key)
+                         : resources.getString(key, arguments);
     }
 
     /**

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/MarshalContext.java Mon Feb  4 12:48:12 2013
@@ -60,35 +60,30 @@ public abstract class MarshalContext {
      * Returns the locale to use for (un)marshalling, or {@code null} if no locale were explicitly
      * specified. The locale returned by this method can be used for choosing a language in an
      * {@link org.opengis.util.InternationalString}.
-     * This locale may vary in different fragments of the same XML document.
+     *
+     * <p>This locale may vary in different fragments of the same XML document.
      * In particular children of {@link org.opengis.metadata.Metadata} inherit the locale
-     * specified by the {@link org.opengis.metadata.Metadata#getLanguage()} attribute.
+     * specified by the {@link org.opengis.metadata.Metadata#getLanguage()} attribute.</p>
+     *
+     * {@section Handling of <code>Locale.ROOT</code>}
+     * {@link Locale#ROOT} is interpreted as a request for locale-neutral strings.
+     * The meaning of "locale-neutral" is implementation specific - this is usually
+     * very close to the English locale, but not necessarily. For examples dates are
+     * formatted according ISO standard instead than the rules of the English locale.
      *
-     * {@section Null locale}
-     * Null locales are typically interpreted as a request for locale-independent strings in SIS.
-     * The meaning of "locale-independent" is implementation specific -
-     * this is usually very close to the English locale, but not necessarily
-     * (e.g. dates formatted according ISO standard instead then English locale).
-     * If the locale is {@code null}, then callers shall select a default locale as documented
-     * in the {@link org.apache.sis.util.iso.DefaultInternationalString#toString(Locale)} javadoc.
-     * As a matter of rule:
-     *
-     * <ul>
-     *   <li>If the locale is given to an {@code InternationalString.toString(Locale)} method,
-     *       keep the {@code null} value since the international string is already expected to
-     *       returns a "unlocalized" string in such case.</li>
-     *   <li>Otherwise, if a {@code Locale} instance is really needed, use {@link Locale#US}
-     *       as an approximation of "unlocalized" string.</li>
-     * </ul>
+     * {@section Handling of <code>null</code> locale}
+     * A {@code null} value means that the locale is unspecified. Caller is free to
+     * use the root locale, the system default or any other locale.
      *
      * @return The locale for the XML fragment being (un)marshalled, or {@code null} is unspecified.
+     *
+     * @see org.apache.sis.util.iso.DefaultInternationalString#toString(Locale)
      */
     public abstract Locale getLocale();
 
     /**
      * Returns the timezone to use for (un)marshalling, or {@code null} if none were explicitely
-     * specified. If {@code null}, then an implementation-default (typically UTC) timezone is
-     * assumed.
+     * specified. If {@code null}, then the caller is free to use the timezone of its choice.
      *
      * @return The timezone for the XML fragment being (un)marshalled, or {@code null} if unspecified.
      */

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/Namespaces.java Mon Feb  4 12:48:12 2013
@@ -184,7 +184,7 @@ public final class Namespaces extends St
         if (prefix != null) {
             return prefix;
         }
-        namespace = namespace.toLowerCase(Locale.US);
+        namespace = namespace.toLowerCase(Locale.ROOT);
         for (final String baseURL : GENERIC_URLS) {
             if (namespace.startsWith(baseURL)) {
                 final int startAt = baseURL.length();

Modified: sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/XLink.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/XLink.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/XLink.java (original)
+++ sis/branches/JDK7/sis-utility/src/main/java/org/apache/sis/xml/XLink.java Mon Feb  4 12:48:12 2013
@@ -301,7 +301,7 @@ public class XLink implements Serializab
          * Returns the attribute name for this type.
          */
         final String identifier() {
-            return name().toLowerCase(Locale.US);
+            return name().toLowerCase(Locale.ROOT);
         }
     }
 

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TableColumnTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TableColumnTest.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TableColumnTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/collection/TableColumnTest.java Mon Feb  4 12:48:12 2013
@@ -41,11 +41,13 @@ public final strictfp class TableColumnT
     @Test
     public void testConstantHeader() {
         InternationalString i18n = NAME.getHeader();
+        assertEquals("Name", i18n.toString(Locale.ROOT));
         assertEquals("Name", i18n.toString(Locale.ENGLISH));
         assertEquals("Nom",  i18n.toString(Locale.FRENCH));
         assertSame("Test caching", i18n, NAME.getHeader());
 
         i18n = TYPE.getHeader();
+        assertEquals("Type", i18n.toString(Locale.ROOT));
         assertEquals("Type", i18n.toString(Locale.ENGLISH));
         assertEquals("Type", i18n.toString(Locale.FRENCH));
         assertSame("Test caching", i18n, TYPE.getHeader());

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/DefaultInternationalStringTest.java Mon Feb  4 12:48:12 2013
@@ -49,6 +49,7 @@ public final strictfp class DefaultInter
         toTest.add(Locale.ENGLISH, MESSAGE);
         assertSame(MESSAGE, toTest.toString());
         assertSame(MESSAGE, toTest.toString(null));
+        assertSame(MESSAGE, toTest.toString(Locale.ROOT));
         validate(toTest);
     }
 
@@ -85,6 +86,7 @@ public final strictfp class DefaultInter
      */
     private static void assertLocalized(final InternationalString toTest, final String quebecker) {
         assertEquals ("Unlocalized message:", MESSAGE,    toTest.toString(null));
+        assertEquals ("Unlocalized message:", MESSAGE,    toTest.toString(Locale.ROOT));
         assertEquals ("English message:",     MESSAGE_en, toTest.toString(Locale.ENGLISH));
         assertEquals ("French message:",      MESSAGE_fr, toTest.toString(Locale.FRENCH));
         assertEquals ("Quebecker message:",   quebecker,  toTest.toString(Locale.CANADA_FRENCH));
@@ -102,12 +104,14 @@ public final strictfp class DefaultInter
         toTest.add(Locale.FRENCH,        MESSAGE_fr);
         toTest.add(Locale.CANADA_FRENCH, MESSAGE_fr_CA);
 
-        assertEquals("Unlocalized message:", MESSAGE,    String.format((Locale) null,  "%s", toTest));
+        assertEquals("Unlocalized message:", MESSAGE,    String.format(Locale.ROOT,    "%s", toTest));
         assertEquals("English message:",     MESSAGE_en, String.format(Locale.ENGLISH, "%s", toTest));
         assertEquals("French message:",      MESSAGE_fr, String.format(Locale.FRENCH,  "%s", toTest));
 
+        assertEquals("  This", String.format(Locale.ROOT,    "%6.4s",  toTest));
         assertEquals("  This", String.format(Locale.ENGLISH, "%6.4s",  toTest));
         assertEquals(" Voici", String.format(Locale.FRENCH,  "%6.5s",  toTest));
+        assertEquals("THIS  ", String.format(Locale.ROOT,    "%-6.5S", toTest));
         assertEquals("THIS  ", String.format(Locale.ENGLISH, "%-6.5S", toTest));
         assertEquals("VOICI ", String.format(Locale.FRENCH,  "%-6.5S", toTest));
     }

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/SimpleInternationalStringTest.java Mon Feb  4 12:48:12 2013
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.util.iso;
 
+import java.util.Locale;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -41,6 +42,8 @@ public final strictfp class SimpleIntern
         final SimpleInternationalString toTest = new SimpleInternationalString(MESSAGE);
         assertSame(MESSAGE, toTest.toString());
         assertSame(MESSAGE, toTest.toString(null));
+        assertSame(MESSAGE, toTest.toString(Locale.ROOT));
+        assertSame(MESSAGE, toTest.toString(Locale.JAPANESE));
         validate(toTest);
     }
 
@@ -53,6 +56,8 @@ public final strictfp class SimpleIntern
         final SimpleInternationalString after  = assertSerializedEquals(before);
         assertEquals(MESSAGE, after.toString());
         assertEquals(MESSAGE, after.toString(null));
+        assertEquals(MESSAGE, after.toString(Locale.ROOT));
+        assertEquals(MESSAGE, after.toString(Locale.JAPANESE));
         validate(after);
     }
 }

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/iso/TypesTest.java Mon Feb  4 12:48:12 2013
@@ -81,6 +81,8 @@ public final strictfp class TypesTest ex
     @Test
     public void testGetDescription() {
         assertEquals("Name of the character coding standard used in the resource.",
+                Types.getDescription(CharacterSet.class, Locale.ROOT));
+        assertEquals("Name of the character coding standard used in the resource.",
                 Types.getDescription(CharacterSet.class, Locale.ENGLISH));
         assertEquals("Jeu de caractères.",
                 Types.getDescription(CharacterSet.class, Locale.FRENCH));
@@ -92,6 +94,8 @@ public final strictfp class TypesTest ex
     @Test
     public void testGetCodeDescription() {
         assertEquals("ISO/IEC 8859-1, Information technology - 8-bit single byte coded graphic character sets - Part 1 : Latin alphabet No.1.",
+                Types.getDescription(CharacterSet.ISO_8859_1, Locale.ROOT));
+        assertEquals("ISO/IEC 8859-1, Information technology - 8-bit single byte coded graphic character sets - Part 1 : Latin alphabet No.1.",
                 Types.getDescription(CharacterSet.ISO_8859_1, Locale.ENGLISH));
         assertEquals("ISO/IEC 8859-1, alphabet latin 1.",
                 Types.getDescription(CharacterSet.ISO_8859_1, Locale.FRENCH));
@@ -132,6 +136,7 @@ public final strictfp class TypesTest ex
      */
     @Test
     public void testGetLocalizedCodeTitle() {
+        assertEquals("Download",       Types.getCodeTitle(OnLineFunction.DOWNLOAD, Locale.ROOT));
         assertEquals("Download",       Types.getCodeTitle(OnLineFunction.DOWNLOAD, Locale.ENGLISH));
         assertEquals("Téléchargement", Types.getCodeTitle(OnLineFunction.DOWNLOAD, Locale.FRENCH));
     }

Modified: sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java (original)
+++ sis/branches/JDK7/sis-utility/src/test/java/org/apache/sis/util/resources/IndexedResourceBundleTest.java Mon Feb  4 12:48:12 2013
@@ -153,11 +153,13 @@ public final strictfp class IndexedResou
     @DependsOnMethod("testGetResources")
     public void testFormatInternational() {
         InternationalString i18n = Errors.formatInternational(Errors.Keys.NullArgument_1);
+        assertEquals("Argument ‘{0}’ shall not be null.",      i18n.toString(Locale.ROOT));
         assertEquals("Argument ‘{0}’ shall not be null.",      i18n.toString(Locale.ENGLISH));
         assertEquals("L’argument ‘{0}’ ne doit pas être nul.", i18n.toString(Locale.FRENCH));
         assertNotSame(i18n, assertSerializedEquals(i18n));
 
         i18n = Errors.formatInternational(Errors.Keys.NullArgument_1, "CRS");
+        assertEquals("Argument ‘CRS’ shall not be null.",      i18n.toString(Locale.ROOT));
         assertEquals("Argument ‘CRS’ shall not be null.",      i18n.toString(Locale.ENGLISH));
         assertEquals("L’argument ‘CRS’ ne doit pas être nul.", i18n.toString(Locale.FRENCH));
         assertNotSame(i18n, assertSerializedEquals(i18n));

Modified: sis/branches/JDK7/src/main/docbook/fr/utility.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/src/main/docbook/fr/utility.xml?rev=1442094&r1=1442093&r2=1442094&view=diff
==============================================================================
--- sis/branches/JDK7/src/main/docbook/fr/utility.xml (original)
+++ sis/branches/JDK7/src/main/docbook/fr/utility.xml Mon Feb  4 12:48:12 2013
@@ -173,10 +173,10 @@
     </section>
 
     <section>
-      <title>Convention locale nulle</title>
+      <title>Convention <constant>Locale.ROOT</constant></title>
       <para>
-        La plupart des méthodes <acronym>SIS</acronym> recevant ou retournant une valeur de type <classname>Locale</classname>
-        acceptent la valeur <constant>null</constant>. Cette valeur est interprétée comme signifiant de ne pas localiser le texte.
+        Toutes les méthodes <acronym>SIS</acronym> recevant ou retournant une valeur de type <classname>Locale</classname>
+        acceptent la valeur <constant>Locale.ROOT</constant>. Cette valeur est interprétée comme signifiant de ne pas localiser le texte.
         La notion de <quote>texte non-localisé</quote> est un peu fausse, puisqu’il faut bien choisir une convention de format.
         Mais cette convention, bien que très proche de l’anglais, sera généralement légèrement différente.
         Par exemple: