sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1550973 - in /sis/branches/JDK7: application/sis-console/src/main/java/org/apache/sis/console/ core/sis-metadata/src/test/java/org/apache/sis/test/suite/ core/sis-utility/src/main/java/org/apache/sis/internal/converter/ core/sis-utility/sr...
Date Sat, 14 Dec 2013 21:20:04 GMT
Author: desruisseaux
Date: Sat Dec 14 21:20:04 2013
New Revision: 1550973

URL: http://svn.apache.org/r1550973
Log:
Marshal country codes using the 2-letters code instead than the 3-letters ones (SIS-153),
and consolidation of the way we handle language codes.

Added:
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
      - copied, changed from r1550935, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageMarshallingTest.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java   (with props)
Removed:
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageMarshallingTest.java
Modified:
    sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
    sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
    sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
    sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java

Modified: sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java [UTF-8] (original)
+++ sis/branches/JDK7/application/sis-console/src/main/java/org/apache/sis/console/SubCommand.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -189,7 +189,7 @@ abstract class SubCommand {
         final boolean explicitEncoding;
         try {
             value = options.get(option = Option.LOCALE);
-            locale = (value != null) ? Locales.parse(value) : Locale.getDefault(Locale.Category.DISPLAY);
+            locale = (value != null) ? Locales.parseLanguage(value, 0) : Locale.getDefault(Locale.Category.DISPLAY);
 
             value = options.get(option = Option.TIMEZONE);
             timezone = (value != null) ? TimeZone.getTimeZone(value) : TimeZone.getDefault();

Modified: sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-metadata/src/test/java/org/apache/sis/test/suite/MetadataTestSuite.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -50,7 +50,7 @@ import org.junit.BeforeClass;
 
     // XML marshalling.
     org.apache.sis.internal.jaxb.code.CodeListMarshallingTest.class,
-    org.apache.sis.internal.jaxb.gmd.LanguageMarshallingTest.class,
+    org.apache.sis.internal.jaxb.gmd.LanguageCodeTest.class,
     org.apache.sis.internal.jaxb.gml.TimePeriodTest.class,
     org.apache.sis.xml.FreeTextMarshallingTest.class,
     org.apache.sis.xml.NilReasonMarshallingTest.class,

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/converter/StringConverter.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -249,7 +249,7 @@ abstract class StringConverter<T> extend
         public Locale() {super(java.util.Locale.class);} // Instantiated by ServiceLoader.
 
         @Override java.util.Locale doConvert(String source) throws IllegalArgumentException {
-            return Locales.parse(source);
+            return Locales.parseLanguage(source, 0);
         }
     }
 

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListAdapter.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -46,8 +46,6 @@ import org.apache.sis.internal.jaxb.Cont
  * @since   0.3 (derived from geotk-2.5)
  * @version 0.3
  * @module
- *
- * @see CodeListLocaleAdapter
  */
 public abstract class CodeListAdapter<ValueType extends CodeListAdapter<ValueType,BoundType>,
         BoundType extends CodeList<BoundType>> extends XmlAdapter<ValueType,BoundType>
@@ -64,8 +62,7 @@ public abstract class CodeListAdapter<Va
     }
 
     /**
-     * Creates a wrapper for a {@link CodeList}, in order to handle the format specified
-     * in ISO-19139.
+     * Creates a wrapper for a {@link CodeList}, in order to handle the format specified in ISO-19139.
      *
      * @param proxy The proxy version of {@link CodeList} to be marshalled.
      */

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/CodeListProxy.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -30,8 +30,8 @@ import org.apache.sis.internal.jaxb.Cont
 /**
  * Stores information about {@link CodeList}, in order to handle format defined in ISO-19139
  * about the {@code CodeList} tags. This object is wrapped by {@link CodeListAdapter} or, in
- * the spacial case of {@link Locale} type, by {@link CodeListLocaleAdapter}. It provides the
- * {@link #codeList} and {@link #codeListValue} attribute to be marshalled.
+ * the spacial case of {@link Locale} type, by {@link LanguageCode} or {@link Country}. This
+ * class provides the {@link #codeList} and {@link #codeListValue} attributes to be marshalled.
  *
  * @author  Cédric Briançon (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
@@ -40,9 +40,8 @@ import org.apache.sis.internal.jaxb.Cont
  * @module
  *
  * @see CodeListAdapter
- * @see CodeListLocaleAdapter
  */
-@XmlType(name = "CodeList", propOrder = { "codeSpace", "codeListValue", "codeList" })
+@XmlType(name = "CodeList", propOrder = { "codeList", "codeListValue", "codeSpace" })
 public final class CodeListProxy {
     /**
      * The default schema to be given to {@link Context#schema(Context, String, String)} (last argument).
@@ -122,7 +121,7 @@ public final class CodeListProxy {
     }
 
     /**
-     * Builds a {@link CodeList} as defined in ISO-19139 standard.
+     * Builds a value for {@link LanguageCode} and {@link Country} elements.
      *
      * @param context       The current (un)marshalling context, or {@code null} if none.
      * @param catalog       The file which defines the code list (for example {@code "ML_gmxCodelists.xml"}), without its path.
@@ -141,7 +140,7 @@ public final class CodeListProxy {
     }
 
     /**
-     * Builds a proxy instance of {@link CodeList}.
+     * Builds a value for {@link CodeListAdapter} elements.
      * This constructors stores the values that will be used for marshalling.
      *
      * @param context The current (un)marshalling context, or {@code null} if none.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/Country.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -104,17 +104,12 @@ public final class Country extends GO_Ch
                     return new Country(string);
                 }
             }
-            String codeSpace = null;
-            String value = null;
-            if (context != null) {
-                final Locale marshalLocale = context.getLocale();
-                if (marshalLocale != null) {
-                    codeSpace = Context.converter(context).toLanguageCode(context, locale);
-                    value = locale.getDisplayCountry(marshalLocale);
-                    if (value.isEmpty()) {
-                        value = null;
-                    }
-                }
+            final Locale marshalLocale = LanguageCode.marshalLocale(context);
+            String codeSpace = Context.converter(context).toLanguageCode(context, marshalLocale);
+            String value = locale.getDisplayCountry(marshalLocale);
+            if (value.isEmpty()) {
+                codeSpace = null;
+                value = null;
             }
             if (!codeListValue.isEmpty() || value != null) {
                 return new Country(context, codeListValue, codeSpace, value);
@@ -133,9 +128,10 @@ public final class Country extends GO_Ch
      */
     public static Locale getLocale(final Country value) {
         if (value != null) {
+            final CodeListProxy proxy = value.proxy;
             String code = null;
-            if (value.proxy != null) {
-                code = value.proxy.codeListValue;
+            if (proxy != null) {
+                code = proxy.codeListValue;
             }
             // If the country was not specified as a code list,
             // look for a simple character string declaration.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/internal/jaxb/gmd/LanguageCode.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -102,11 +102,11 @@ public final class LanguageCode extends 
                     return new LanguageCode(string);
                 }
             }
-            final Locale marshalLocale = (context != null) ? context.getLocale() : null;
-            final String codeSpace = Context.converter(context).toLanguageCode(context, locale);
-            String value = (marshalLocale != null) ? locale.getDisplayLanguage(marshalLocale)
-                                                   : locale.getDisplayLanguage();
+            final Locale marshalLocale = marshalLocale(context);
+            String codeSpace = Context.converter(context).toLanguageCode(context, marshalLocale);
+            String value = locale.getDisplayLanguage(marshalLocale);
             if (value.isEmpty()) {
+                codeSpace = null;
                 value = null;
             }
             if (!codeListValue.isEmpty() || value != null) {
@@ -117,6 +117,19 @@ public final class LanguageCode extends 
     }
 
     /**
+     * Returns the locale to use at marshalling time, or the default locale if unspecified.
+     */
+    static Locale marshalLocale(final Context context) {
+        if (context != null) {
+            final Locale marshalLocale = context.getLocale();
+            if (marshalLocale != null) {
+                return marshalLocale;
+            }
+        }
+        return Locale.getDefault(Locale.Category.DISPLAY);
+    }
+
+    /**
      * Returns the locale for the given language (which may be null), or {@code null} if none.
      *
      * @param context The current (un)marshalling context, or {@code null} if none.

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -629,10 +629,12 @@ pathTree:   for (int j=0; ; j++) {
 
     /**
      * Returns the ISO language or country code for the given locale.
+     * Whether we use 2-letters or 3-letters code shall be consistent
+     * with {@link org.apache.sis.xml.ValueConverter}.
      */
     private static String getCode(final Locale locale, final boolean country) {
         try {
-            return country ? locale.getISO3Country() : locale.getISO3Language();
+            return country ? locale.getCountry() : locale.getISO3Language();
         } catch (MissingResourceException e) {
             Logging.recoverableException(About.class, "configuration", e);
             return null;

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -45,7 +45,7 @@ import static org.apache.sis.util.collec
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.4)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class Locales extends Static {
@@ -66,9 +66,7 @@ public final class Locales extends Stati
          * since we want to give precedence to references to the static constants.
          */
         try {
-            final Field[] fields = Locale.class.getFields();
-            for (int i=0; i<fields.length; i++) {
-                final Field field = fields[i];
+            for (final Field field : Locale.class.getFields()) {
                 if (Modifier.isStatic(field.getModifiers())) {
                     if (Locale.class.isAssignableFrom(field.getType())) {
                         final Locale toAdd = (Locale) field.get(null);
@@ -76,7 +74,7 @@ public final class Locales extends Stati
                     }
                 }
             }
-        } catch (ReflectiveOperationException exception) {
+        } catch (IllegalAccessException exception) {
             /*
              * Not a big deal if this operation fails (this is actually just an
              * optimization for reducing memory usage). Log a warning and stop.
@@ -134,8 +132,7 @@ public final class Locales extends Stati
         final Locale[] languages = getAvailableLanguages();
         Locale[] locales = Locale.getAvailableLocales();
         int count = 0;
-        for (int i=0; i<locales.length; i++) {
-            final Locale locale = locales[i];
+        for (final Locale locale : locales) {
             if (containsLanguage(languages, locale)) {
                 locales[count++] = unique(locale);
             }
@@ -164,7 +161,10 @@ public final class Locales extends Stati
      *
      * @param  locale The locale to use for formatting the strings to be returned.
      * @return String descriptions of available locales.
+     *
+     * @deprecated Not useful in practice, since we typically also need the original Locale object.
      */
+    @Deprecated // Remove for simplifiying the API.
     public String[] getAvailableLocales(final Locale locale) {
         final Locale[] locales = getAvailableLocales();
         final String[] display = new String[locales.length];
@@ -182,7 +182,10 @@ public final class Locales extends Stati
      *
      * @param  locales The locales from which to get the languages.
      * @return The languages, without country or variant information.
+     *
+     * @deprecated Users can easily perform this operation themselves, thus avoiding this class initialization.
      */
+    @Deprecated // Make this method private for simplifiying the API.
     public static Locale[] getLanguages(final Locale... locales) {
         final Set<String> codes = new LinkedHashSet<>(hashMapCapacity(locales.length));
         for (final Locale locale : locales) {
@@ -197,36 +200,37 @@ public final class Locales extends Stati
     }
 
     /**
-     * Parses the given locale. The string is the language code either as the 2 letters or the
-     * 3 letters ISO code. It can optionally be followed by the {@code '_'} character and the
-     * country code (again either as 2 or 3 letters), optionally followed by {@code '_'} and
-     * the variant.
-     *
-     * <p>This method can be used when the caller wants the same {@code Locale} constants no
-     * matter if the language and country codes use 2 or 3 letters. Apache SIS usually don't
-     * distinguish those two cases since ISO 19139 documents have to use the 3 letters codes
-     * anyway.</p>
+     * @deprecated Renamed as {@link #parseLanguage(String, int)}.
      *
      * @param  code The language code, which may be followed by country code.
      * @return The language for the given code (never {@code null}).
      * @throws IllegalArgumentException If the given code doesn't seem to be a valid locale.
-     *
-     * @see Locale#forLanguageTag(String)
      */
+    @Deprecated
     public static Locale parse(final String code) throws IllegalArgumentException {
-        ArgumentChecks.ensureNonNull("code", code);
-        return parse(code, 0);
+        return parseLanguage(code, 0);
     }
 
     /**
-     * Implementation of {@link #parse(String)} which start the parsing process from the given {@code fromIndex}.
+     * Parses the given language code. The given string can be either the 2 letters or the 3 letters ISO 639 code.
+     * It can optionally be followed by the {@code '_'} character and the country code (again either as 2 or 3 letters),
+     * optionally followed by {@code '_'} and the variant.
+     *
+     * <p>This method can be used when the caller wants the same {@code Locale} constants no matter if the language
+     * and country codes use 2 or 3 letters. This method tries to convert 3-letters codes to 2-letters code on a
+     * <cite>best effort</cite> basis.</p>
      *
      * @param  code The language code, which may be followed by country code.
      * @param  fromIndex Index of the first character to parse.
      * @return The language for the given code (never {@code null}).
      * @throws IllegalArgumentException If the given code doesn't seem to be a valid locale.
+     *
+     * @see Locale#forLanguageTag(String)
+     * @see org.apache.sis.util.iso.Types#toInternationalString(Map, String)
      */
-    private static Locale parse(final String code, final int fromIndex) throws IllegalArgumentException {
+    public static Locale parseLanguage(final String code, final int fromIndex) throws IllegalArgumentException {
+        ArgumentChecks.ensureNonNull("code", code);
+        ArgumentChecks.ensurePositive("fromIndex", fromIndex);
         final String language, country, variant;
         int ci = code.indexOf('_', fromIndex);
         if (ci < 0) {
@@ -284,14 +288,13 @@ public final class Locales extends Stati
     }
 
     /**
-     * Parses the locale encoded in the suffix of a property key. This convenience method
+     * Parses the language encoded in the suffix of a property key. This convenience method
      * is used when a property in a {@link java.util.Map} may have many localized variants.
      * For example the {@code "remarks"} property may be defined by values associated to the
      * {@code "remarks_en"} and {@code "remarks_fr"} keys, for English and French locales
      * respectively.
      *
-     * <p>This method infers the {@code Locale} from the property {@code key}
-     * with the following steps:</p>
+     * <p>This method infers the {@code Locale} from the property {@code key} with the following steps:</p>
      *
      * <ul>
      *   <li>If the given {@code key} is exactly equals to {@code prefix},
@@ -299,7 +302,7 @@ public final class Locales extends Stati
      *   <li>Otherwise if the given {@code key} does not start with the specified {@code prefix}
      *       followed by the {@code '_'} character, then this method returns {@code null}.</li>
      *   <li>Otherwise, the characters after the {@code '_'} are parsed as an ISO language
-     *       and country code by the {@link #parse(String)} method.</li>
+     *       and country code by the {@link #parseLanguage(String, int)} method.</li>
      * </ul>
      *
      * @param  prefix The prefix to skip at the beginning of the {@code key}.
@@ -308,7 +311,10 @@ public final class Locales extends Stati
      * @throws IllegalArgumentException if the locale after the prefix is an illegal code.
      *
      * @see org.apache.sis.util.iso.Types#toInternationalString(Map, String)
+     *
+     * @deprecated Users can easily perform this operation themselves, thus avoiding this class initialization.
      */
+    @Deprecated
     public static Locale parseSuffix(final String prefix, final String key) throws IllegalArgumentException {
         ArgumentChecks.ensureNonNull("prefix", prefix);
         if (key != null) { // Tolerance for Map that accept null keys.
@@ -318,7 +324,7 @@ public final class Locales extends Stati
                     return Locale.ROOT;
                 }
                 if (key.charAt(offset) == '_') {
-                    return parse(key, offset + 1);
+                    return parseLanguage(key, offset + 1);
                 }
             }
         }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultInternationalString.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -420,8 +420,7 @@ public class DefaultInternationalString 
             localeMap = Collections.singletonMap(Locales.unique(entry.getKey()), entry.getValue());
         } else {
             localeMap.clear();
-            for (int i=0; i<entries.length; i++) {
-                final Map.Entry<Locale,String> entry = entries[i];
+            for (final Map.Entry<Locale,String> entry : entries) {
                 localeMap.put(Locales.unique(entry.getKey()), entry.getValue());
             }
         }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -567,21 +567,23 @@ public final class Types extends Static 
     }
 
     /**
-     * Returns an international strings for the values in the given properties map, or {@code null} if none.
-     * If the given map is {@code null}, then this method returns {@code null}.
-     * Otherwise this method iterates over the entries having a key that starts with the specified prefix.
-     * For each such key:
+     * Returns an international string for the values in the given properties map, or {@code null} if none.
+     * This method is used when a property in a {@link java.util.Map} may have many localized variants.
+     * For example the given map may contains a {@code "remarks"} property defined by values associated to
+     * the {@code "remarks_en"} and {@code "remarks_fr"} keys, for English and French locales respectively.
+     *
+     * <p>If the given map is {@code null}, then this method returns {@code null}.
+     * Otherwise this method iterates over the entries having a key that starts with the specified prefix,
+     * followed by the {@code '_'} character. For each such key:</p>
      *
      * <ul>
-     *   <li>The part after the prefix is parsed as specified by the {@link Locales#parseSuffix(String, String)}
-     *       method.</li>
-     *   <li>If {@code parseSuffix(…)} returned a non-null locale, then the value for that locale is added in the
-     *       international string to be returned.</li>
+     *   <li>If the key is exactly equals to {@code prefix}, selects {@link Locale#ROOT}.</li>
+     *   <li>Otherwise the characters after {@code '_'} are parsed as an ISO language and country code
+     *       by the {@link Locales#parseLanguage(String, int)} method. Note that 3-letters codes are replaced
+     *       by their 2-letters counterparts on a <cite>best effort</cite> basis.</li>
+     *   <li>The value for the decoded locale is added in the international string to be returned.</li>
      * </ul>
      *
-     * For example the given map may contains a {@code "remarks"} property defined by values associated to the
-     * {@code "remarks_en"} and {@code "remarks_fr"} keys, for English and French locales respectively.
-     *
      * @param  properties The map from which to get the string values for an international string, or {@code null}.
      * @param  prefix     The prefix of keys to use for creating the international string.
      * @return The international string, or {@code null} if the given map is null or does not contain values
@@ -592,7 +594,7 @@ public final class Types extends Static 
      *           <li>or the value associated to that key is a not a {@link CharSequence}.</li>
      *         </ul>
      *
-     * @see Locales#parseSuffix(String, String)
+     * @see Locales#parseLanguage(String, int)
      * @see DefaultInternationalString#DefaultInternationalString(Map)
      *
      * @since 0.4
@@ -623,39 +625,43 @@ public final class Types extends Static 
         CharSequence i18n = null;
         Locale firstLocale = null;
         DefaultInternationalString dis = null;
-        final int length = prefix.length();
+        final int offset = prefix.length();
         for (final Map.Entry<String,?> entry : properties.entrySet()) {
             final String key = entry.getKey();
-            final Locale locale = Locales.parseSuffix(prefix, key);
-            if (locale == null) {
-                if (isSorted) {
-                    /*
-                     * If the map is sorted using natural ordering, we can stop as soon as we find a key which
-                     * is lexicographically greater than prefix + '_'. We check 'startsWith' last since the other
-                     * tests are cheaper and usually sufficient.
-                     */
-                    if (key.length() <= length || key.charAt(length) > '_' || !key.startsWith(prefix)) {
-                        break;
-                    }
-                }
+            if (key == null) {
+                continue; // Tolerance for Map that accept null keys.
+            }
+            if (!key.startsWith(prefix)) {
+                if (isSorted) break; // If the map is sorted, there is no need to check next entries.
+                continue;
+            }
+            final Locale locale;
+            if (key.length() == offset) {
+                locale = Locale.ROOT;
             } else {
-                final Object value = entry.getValue();
-                if (value != null) {
-                    if (!(value instanceof CharSequence)) {
-                        throw new IllegalArgumentException(Errors.format(
-                                Errors.Keys.IllegalPropertyClass_2, key, value.getClass()));
-                    }
-                    if (i18n == null) {
-                        i18n = (CharSequence) value;
-                        firstLocale = locale;
-                    } else {
-                        if (dis == null) {
-                            dis = new DefaultInternationalString();
-                            dis.add(firstLocale, i18n);
-                            i18n = dis;
-                        }
-                        dis.add(locale, (CharSequence) value);
+                final char c = key.charAt(offset);
+                if (c != '_') {
+                    if (isSorted && c > '_') break;
+                    continue;
+                }
+                locale = Locales.parseLanguage(key, offset + 1);
+            }
+            final Object value = entry.getValue();
+            if (value != null) {
+                if (!(value instanceof CharSequence)) {
+                    throw new IllegalArgumentException(Errors.format(
+                            Errors.Keys.IllegalPropertyClass_2, key, value.getClass()));
+                }
+                if (i18n == null) {
+                    i18n = (CharSequence) value;
+                    firstLocale = locale;
+                } else {
+                    if (dis == null) {
+                        dis = new DefaultInternationalString();
+                        dis.add(firstLocale, i18n);
+                        i18n = dis;
                     }
+                    dis.add(locale, (CharSequence) value);
                 }
             }
         }

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/Pooled.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -326,7 +326,7 @@ abstract class Pooled {
         try {
             switch (name) {
                 case XML.LOCALE: {
-                    locale = (value instanceof CharSequence) ? Locales.parse(value.toString()) : (Locale) value;
+                    locale = (value instanceof CharSequence) ? Locales.parseLanguage(value.toString(), 0) : (Locale) value;
                     return;
                 }
                 case XML.TIMEZONE: {

Modified: sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -63,7 +63,7 @@ import static org.apache.sis.util.CharSe
  *
  * @author Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.07)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public class ValueConverter {
@@ -111,13 +111,13 @@ public class ValueConverter {
     }
 
     /**
-     * Converts the given locale to a language code. For strict ISO 19139 compliance, the language
-     * code shall be a 3-letters ISO code as returned by {@link Locale#getISO3Language()}.
+     * Converts the given locale to a language code. For better ISO 19139 compliance, the language code
+     * should be a 3-letters ISO 639-2 code (e.g. {@code "jpn"} for {@linkplain Locale#JAPANESE Japanese}).
      * However those codes may not be available for every locales.
      *
-     * <p>The default implementation performs the following step:</p>
+     * <p>The default implementation performs the following steps:</p>
      * <ul>
-     *   <li>Try {@code value.getISO3Language()}:<ul>
+     *   <li>Try {@link Locale#getISO3Language()}</code>:<ul>
      *     <li>On success, return that value if non-empty, or {@code null} otherwise.</li>
      *     <li>If an exception has been thrown, then:<ul>
      *       <li>If {@link #exceptionOccured exceptionOccured(…)} return {@code true}, then
@@ -130,9 +130,8 @@ public class ValueConverter {
      *
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The locale to convert to a language code, or {@code null}.
-     * @return The language code, or {@code null} if the given value was null or does not contains
-     *         a language code.
-     * @throws MissingResourceException If there is no ISO 3-letters language code for the given locale.
+     * @return The language code, or {@code null} if the given value was null or does not contains a language code.
+     * @throws MissingResourceException If no language code can be found for the given locale.
      *
      * @see Locale#getISO3Language()
      * @see Locale#getLanguage()
@@ -156,43 +155,22 @@ public class ValueConverter {
     }
 
     /**
-     * Converts the given locale to a country code. For strict ISO 19139 compliance, the country
-     * code shall be a 3-letters ISO code as returned by {@link Locale#getISO3Country()}.
-     * However those codes may not be available for every locales.
+     * Converts the given locale to a country code. For better ISO 19139 compliance, the country code
+     * should be a 2-letters ISO 3166 code (e.g. {@code "JP"} for {@linkplain Locale#JAPAN Japan}).
      *
-     * <p>The default implementation performs the following step:</p>
-     * <ul>
-     *   <li>Try {@code value.getISO3Country()}:<ul>
-     *     <li>On success, return that value if non-empty, or {@code null} otherwise.</li>
-     *     <li>If an exception has been thrown, then:<ul>
-     *       <li>If {@link #exceptionOccured exceptionOccured(…)} return {@code true}, then
-     *           returns {@code value.getCountry()} if non-empty or {@code null} otherwise.</li>
-     *       <li>If {@code exceptionOccured(…)} returned {@code false} (which is the default
-     *           behavior), then let the exception propagate.</li>
-     *     </ul></li>
-     *   </ul></li>
-     * </ul>
+     * <p>The default implementation returns {@link Locale#getCountry()} if non-empty, or {@code null} otherwise.</p>
      *
      * @param  context Context (GML version, locale, <i>etc.</i>) of the (un)marshalling process.
      * @param  value The locale to convert to a country code, or {@code null}.
-     * @return The country code, or {@code null} if the given value was null or does not contains
-     *         a country code.
-     * @throws MissingResourceException If there is no ISO 3-letters country code for the given locale.
+     * @return The country code, or {@code null} if the given value was null or does not contains a country code.
+     * @throws MissingResourceException If no country code can be found for the given locale.
      *
      * @see Locale#getISO3Country()
      * @see Locale#getCountry()
      */
     public String toCountryCode(final MarshalContext context, final Locale value) throws MissingResourceException {
         if (value != null) {
-            String code;
-            try {
-                code = value.getISO3Country();
-            } catch (MissingResourceException e) {
-                if (!exceptionOccured(context, value, Locale.class, String.class, e)) {
-                    throw e;
-                }
-                code = value.getCountry();
-            }
+            String code = value.getCountry();
             if (!code.isEmpty()) {
                 return code;
             }
@@ -211,11 +189,13 @@ public class ValueConverter {
      * @return The converted locale, or {@code null} if the given value was null or empty, or
      *         if an exception was thrown and {@code exceptionOccured(…)} returned {@code true}.
      * @throws IllegalArgumentException If the given string can not be converted to a locale.
+     *
+     * @see Locales#parseLanguage(String, int)
      */
     public Locale toLocale(final MarshalContext context, String value) throws IllegalArgumentException {
         value = trimWhitespaces(value);
         if (value != null && !value.isEmpty()) try {
-            return Locales.parse(value);
+            return Locales.parseLanguage(value, 0);
         } catch (IllegalArgumentException e) {
             if (!exceptionOccured(context, value, String.class, Locale.class, e)) {
                 throw e;

Copied: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java (from r1550935, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageMarshallingTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java?p2=sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java&p1=sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageMarshallingTest.java&r1=1550935&r2=1550973&rev=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageMarshallingTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -45,7 +45,7 @@ import static org.apache.sis.test.TestUt
  * @version 0.3
  * @module
  */
-public final strictfp class LanguageMarshallingTest extends XMLTestCase {
+public final strictfp class LanguageCodeTest extends XMLTestCase {
     /**
      * A poll of configured {@link Marshaller} and {@link Unmarshaller}, created when first needed.
      */

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -120,6 +120,7 @@ import org.junit.BeforeClass;
     // XML most basic types.
     org.apache.sis.xml.XLinkTest.class,
     org.apache.sis.xml.NilReasonTest.class,
+    org.apache.sis.xml.ValueConverterTest.class,
     org.apache.sis.xml.OGCNamespacePrefixMapperTest.class,
     org.apache.sis.xml.MarshallerPoolTest.class,
     org.apache.sis.internal.jaxb.XmlUtilitiesTest.class,
@@ -128,7 +129,7 @@ import org.junit.BeforeClass;
     org.apache.sis.internal.jaxb.gco.StringAdapterTest.class,
     org.apache.sis.internal.jaxb.gco.MeasureTest.class,
     org.apache.sis.internal.jaxb.gco.PropertyTypeTest.class,
-    org.apache.sis.internal.jaxb.gmd.LanguageMarshallingTest.class,
+    org.apache.sis.internal.jaxb.gmd.LanguageCodeTest.class,
     org.apache.sis.util.iso.NameMarshallingTest.class
 })
 public final strictfp class UtilityTestSuite extends TestSuite {

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -30,7 +30,7 @@ import static org.junit.Assert.*;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-3.04)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @DependsOn(ArraysExtTest.class)
@@ -68,31 +68,32 @@ public final strictfp class LocalesTest 
     }
 
     /**
-     * Tests the {@link Locales#parse(String)} method.
+     * Tests the {@link Locales#parseLanguage(String, int)} method.
      */
     @Test
     @DependsOnMethod("testUnique")
-    public void testParse() {
-        assertSame(Locale.FRENCH,        Locales.parse("fr"));
-        assertSame(Locale.FRENCH,        Locales.parse("fra"));
-        assertSame(Locale.CANADA_FRENCH, Locales.parse("fr_CA"));
-        assertSame(Locale.CANADA_FRENCH, Locales.parse("fra_CA"));
-        assertSame(Locale.CANADA_FRENCH, Locales.parse("fr_CAN"));
-        assertSame(Locale.CANADA_FRENCH, Locales.parse("fra_CAN"));
-        assertSame(Locale.ENGLISH,       Locales.parse("en"));
+    public void testParseLanguage() {
+        assertSame(Locale.FRENCH,        Locales.parseLanguage("fr", 0));
+        assertSame(Locale.FRENCH,        Locales.parseLanguage("fra", 0));
+        assertSame(Locale.CANADA_FRENCH, Locales.parseLanguage("fr_CA", 0));
+        assertSame(Locale.CANADA_FRENCH, Locales.parseLanguage("fra_CA", 0));
+        assertSame(Locale.CANADA_FRENCH, Locales.parseLanguage("fr_CAN", 0));
+        assertSame(Locale.CANADA_FRENCH, Locales.parseLanguage("fra_CAN", 0));
+        assertSame(Locale.ENGLISH,       Locales.parseLanguage("en", 0));
 
-        assertEquals(new Locale("de", "DE"),        Locales.parse("de_DE"));
-        assertEquals(new Locale("",   "GB"),        Locales.parse("_GB"));
-        assertEquals(new Locale("en", "US", "WIN"), Locales.parse("en_US_WIN"));
-        assertEquals(new Locale("de", "", "POSIX"), Locales.parse("de__POSIX"));
-        assertEquals(new Locale("fr", "", "MAC"),   Locales.parse("fr__MAC"));
+        assertEquals(new Locale("de", "DE"),        Locales.parseLanguage("de_DE", 0));
+        assertEquals(new Locale("",   "GB"),        Locales.parseLanguage("_GB", 0));
+        assertEquals(new Locale("en", "US", "WIN"), Locales.parseLanguage("en_US_WIN", 0));
+        assertEquals(new Locale("de", "", "POSIX"), Locales.parseLanguage("de__POSIX", 0));
+        assertEquals(new Locale("fr", "", "MAC"),   Locales.parseLanguage("fr__MAC", 0));
     }
 
     /**
      * Tests the {@link Locales#parseSuffix(String, String)} method.
      */
     @Test
-    @DependsOnMethod("testParse")
+    @Deprecated
+    @DependsOnMethod("testParseLanguage")
     public void testParseSuffix() {
         assertSame(null,           Locales.parseSuffix("remarks", "remark"));
         assertSame(Locale.ROOT,    Locales.parseSuffix("remarks", "remarks"));

Modified: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java?rev=1550973&r1=1550972&r2=1550973&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java [UTF-8] (original)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -24,7 +24,7 @@ import org.apache.sis.util.LenientCompar
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.ArraysExt;
 import org.apache.sis.test.TestCase;
-import org.junit.*;
+import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 

Added: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java?rev=1550973&view=auto
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java (added)
+++ sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java [UTF-8] Sat Dec 14 21:20:04 2013
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sis.xml;
+
+import java.util.Locale;
+import org.apache.sis.test.TestCase;
+import org.junit.Test;
+
+import static org.apache.sis.test.Assert.*;
+
+
+/**
+ * Tests {@link ValueConverter}.
+ *
+ * @author  Martin Desruisseaux (Geomatys)
+ * @since   0.4
+ * @version 0.4
+ * @module
+ */
+public final strictfp class ValueConverterTest extends TestCase {
+    /**
+     * Tests {@link ValueConverter#toLanguageCode(MarshalContext, Locale)}.
+     * The results should be ISO 639-2 codes (3 letters language codes).
+     */
+    @Test
+    public void testToLanguageCode() {
+        assertEquals("eng", ValueConverter.DEFAULT.toLanguageCode(null, Locale.US));
+        assertEquals("eng", ValueConverter.DEFAULT.toLanguageCode(null, Locale.UK));
+        assertEquals("eng", ValueConverter.DEFAULT.toLanguageCode(null, Locale.ENGLISH));
+        assertEquals("fra", ValueConverter.DEFAULT.toLanguageCode(null, Locale.FRANCE));
+        assertEquals("fra", ValueConverter.DEFAULT.toLanguageCode(null, Locale.FRENCH));
+        assertEquals("jpn", ValueConverter.DEFAULT.toLanguageCode(null, Locale.JAPAN));
+        assertEquals("jpn", ValueConverter.DEFAULT.toLanguageCode(null, Locale.JAPANESE));
+    }
+
+    /**
+     * Tests {@link ValueConverter#toCountryCode(MarshalContext, Locale)}.
+     * The results should be ISO 3166 codes (2 letters country codes).
+     *
+     * Note that we do not expect the 3 letters code, because the {@code schemas.opengis.net}
+     * practice seems to be to use 2 letter codes.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-153">SIS-153</a>
+     */
+    @Test
+    public void testToCountryCode() {
+        assertEquals("US", ValueConverter.DEFAULT.toCountryCode(null, Locale.US));
+        assertEquals("GB", ValueConverter.DEFAULT.toCountryCode(null, Locale.UK));
+        assertNull  (      ValueConverter.DEFAULT.toCountryCode(null, Locale.ENGLISH));
+        assertEquals("FR", ValueConverter.DEFAULT.toCountryCode(null, Locale.FRANCE));
+        assertNull  (      ValueConverter.DEFAULT.toCountryCode(null, Locale.FRENCH));
+        assertEquals("JP", ValueConverter.DEFAULT.toCountryCode(null, Locale.JAPAN));
+        assertNull  (      ValueConverter.DEFAULT.toCountryCode(null, Locale.JAPANESE));
+    }
+}

Propchange: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/xml/ValueConverterTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain;charset=UTF-8



Mime
View raw message