sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1551742 [3/3] - in /sis/branches/JDK6: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/src/main/java/org/apache/sis/util/resources/ core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/code/ c...
Date Tue, 17 Dec 2013 22:36:51 GMT
Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -27,7 +27,7 @@ import org.opengis.util.InternationalStr
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.2)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class Messages extends IndexedResourceBundle {
@@ -57,34 +57,34 @@ public final class Messages extends Inde
         /**
          * {0} “{1}” is already registered. The second instance will be ignored.
          */
-        public static final int AlreadyRegistered_2 = 5;
+        public static final short AlreadyRegistered_2 = 0;
 
         /**
          * Changed the container capacity from {0} to {1} elements.
          */
-        public static final int ChangedContainerCapacity_2 = 0;
+        public static final short ChangedContainerCapacity_2 = 1;
 
         /**
          * Property “{0}” has been discarded in favor of “{1}”, because those two
properties are
          * mutually exclusive.
          */
-        public static final int DiscardedExclusiveProperty_2 = 1;
+        public static final short DiscardedExclusiveProperty_2 = 2;
 
         /**
          * Text were discarded for some locales.
          */
-        public static final int LocalesDiscarded = 2;
+        public static final short LocalesDiscarded = 3;
 
         /**
          * Property “{0}” is hidden by “{1}”.
          */
-        public static final int PropertyHiddenBy_2 = 3;
+        public static final short PropertyHiddenBy_2 = 4;
 
         /**
          * Can not parse “{1}” as an instance of {0}. The value is stored as plain text
instead, but
          * will be ignored by some processing.
          */
-        public static final int UnparsableValueStoredAsText_2 = 4;
+        public static final short UnparsableValueStoredAsText_2 = 5;
     }
 
     /**
@@ -123,7 +123,7 @@ public final class Messages extends Inde
      * @return The string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int key) throws MissingResourceException {
+    public static String format(final short key) throws MissingResourceException {
         return getResources(null).getString(key);
     }
 
@@ -136,7 +136,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0) throws MissingResourceException
     {
         return getResources(null).getString(key, arg0);
@@ -152,7 +152,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1) throws MissingResourceException
     {
@@ -170,7 +170,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1,
                                 final Object arg2) throws MissingResourceException
@@ -190,7 +190,7 @@ public final class Messages extends Inde
      * @return The formatted string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int    key,
+    public static String format(final short  key,
                                 final Object arg0,
                                 final Object arg1,
                                 final Object arg2,
@@ -205,8 +205,8 @@ public final class Messages extends Inde
     private static final class International extends ResourceInternationalString {
         private static final long serialVersionUID = 4553487496835099424L;
 
-        International(int key)                   {super(key);}
-        International(int key, Object args)      {super(key, args);}
+        International(short key)                 {super(key);}
+        International(short key, Object args)    {super(key, args);}
         @Override KeyConstants getKeyConstants() {return Keys.INSTANCE;}
         @Override IndexedResourceBundle getBundle(final Locale locale) {
             return getResources(locale);
@@ -221,7 +221,7 @@ public final class Messages extends Inde
      * @param  key The key for the desired string.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key) {
+    public static InternationalString formatInternational(final short key) {
         return new International(key);
     }
 
@@ -238,7 +238,7 @@ public final class Messages extends Inde
      * @param  arg Values to substitute to "{0}".
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object arg)
{
+    public static InternationalString formatInternational(final short key, final Object arg)
{
         return new International(key, arg);
     }
 
@@ -251,7 +251,7 @@ public final class Messages extends Inde
      * @param  args Values to substitute to "{0}", "{1}", <i>etc</i>.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object...
args) {
+    public static InternationalString formatInternational(final short key, final Object...
args) {
         return new International(key, args);
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/ResourceInternationalString.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -25,7 +25,6 @@ import java.util.Locale;
 import java.util.MissingResourceException;
 import org.apache.sis.util.Immutable;
 import org.apache.sis.util.Utilities;
-import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.iso.AbstractInternationalString;
 
 // Related to JDK7
@@ -39,7 +38,7 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.4
  * @module
  */
 @Immutable
@@ -47,14 +46,19 @@ abstract class ResourceInternationalStri
     /**
      * Serial number for inter-operability with different versions.
      */
-    private static final long serialVersionUID = -3910920973710535738L;
+    private static final long serialVersionUID = -3910920973710535739L;
 
     /**
-     * The key for the resource to fetch. A negative value means that the resource takes
no
-     * argument, in which case the {@link #arguments} field shall be ignored. Negative key
-     * values are converted to positive values using the {@code ~} operator.
+     * The key for the resource to fetch.
      */
-    private transient int key;
+    private transient short key;
+
+    /**
+     * {@code true} if the key has arguments. If {@code false}, then the {@link #arguments}
+     * field shall be ignored. We can not rely on {@code null} arguments value because null
+     * may be a valid value.
+     */
+    private final boolean hasArguments;
 
     /**
      * The argument(s), or {@code null} if none. Note that the user may also really want
to
@@ -68,10 +72,10 @@ abstract class ResourceInternationalStri
      *
      * @param key The key for the resource to fetch.
      */
-    ResourceInternationalString(final int key) {
-        ArgumentChecks.ensurePositive("key", key);
-        this.key  = ~key;
-        arguments = null;
+    ResourceInternationalString(final short key) {
+        this.key     = key;
+        hasArguments = false;
+        arguments    = null;
     }
 
     /**
@@ -80,10 +84,10 @@ abstract class ResourceInternationalStri
      * @param key The key for the resource to fetch.
      * @param The argument(s).
      */
-    ResourceInternationalString(final int key, final Object arguments) {
-        ArgumentChecks.ensurePositive("key", key);
-        this.key = key;
-        this.arguments = arguments;
+    ResourceInternationalString(final short key, final Object arguments) {
+        this.key          = key;
+        this.hasArguments = true;
+        this.arguments    = arguments;
     }
 
     /**
@@ -111,10 +115,9 @@ abstract class ResourceInternationalStri
      * @throws MissingResourceException is the key given to the constructor is invalid.
      */
     @Override
-    public String toString(final Locale locale) throws MissingResourceException {
+    public final String toString(final Locale locale) throws MissingResourceException {
         final IndexedResourceBundle resources = getBundle(locale);
-        return (key < 0) ? resources.getString(~key)
-                         : resources.getString(key, arguments);
+        return hasArguments ? resources.getString(key, arguments) : resources.getString(key);
     }
 
     /**
@@ -124,12 +127,12 @@ abstract class ResourceInternationalStri
      * @return {@code true} if the given object is equal to this string.
      */
     @Override
-    public boolean equals(final Object object) {
-        if (object != null && object.getClass() == getClass()) {
-            final ResourceInternationalString that = (ResourceInternationalString) object;
-            return this.key == that.key && Objects.equals(this.arguments, that.arguments);
+    public final boolean equals(final Object object) {
+        if (object == null || object.getClass() != getClass()) {
+            return false;
         }
-        return false;
+        final ResourceInternationalString that = (ResourceInternationalString) object;
+        return (key == that.key) && (hasArguments == that.hasArguments) &&
Objects.equals(arguments, that.arguments);
     }
 
     /**
@@ -138,7 +141,7 @@ abstract class ResourceInternationalStri
      * @return A hash code value for this international text.
      */
     @Override
-    public int hashCode() {
+    public final int hashCode() {
         return getClass().hashCode() ^ (key + 31*Utilities.deepHashCode(arguments)) ^ (int)
serialVersionUID;
     }
 
@@ -147,8 +150,7 @@ abstract class ResourceInternationalStri
      */
     private void writeObject(final ObjectOutputStream out) throws IOException {
         out.defaultWriteObject();
-        out.writeUTF(getKeyConstants().getKeyName(key >= 0 ? key : ~key));
-        out.writeBoolean(key < 0);
+        out.writeUTF(getKeyConstants().getKeyName(key));
     }
 
     /**
@@ -163,8 +165,5 @@ abstract class ResourceInternationalStri
             e.initCause(cause);
             throw e;
         }
-        if (in.readBoolean()) {
-            key = ~key;
-        }
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -27,7 +27,7 @@ import org.opengis.util.InternationalStr
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.3 (derived from geotk-2.2)
- * @version 0.3
+ * @version 0.4
  * @module
  */
 public final class Vocabulary extends IndexedResourceBundle {
@@ -57,327 +57,327 @@ public final class Vocabulary extends In
         /**
          * Angle
          */
-        public static final int Angle = 9;
+        public static final short Angle = 0;
 
         /**
          * Degrees
          */
-        public static final int AngularDegrees = 10;
+        public static final short AngularDegrees = 1;
 
         /**
          * Minutes
          */
-        public static final int AngularMinutes = 11;
+        public static final short AngularMinutes = 2;
 
         /**
          * Seconds
          */
-        public static final int AngularSeconds = 12;
+        public static final short AngularSeconds = 3;
 
         /**
          * Attributes
          */
-        public static final int Attributes = 45;
+        public static final short Attributes = 4;
 
         /**
          * Barometric altitude
          */
-        public static final int BarometricAltitude = 60;
+        public static final short BarometricAltitude = 5;
 
         /**
          * Character encoding
          */
-        public static final int CharacterEncoding = 17;
+        public static final short CharacterEncoding = 6;
 
         /**
          * Classpath
          */
-        public static final int Classpath = 29;
+        public static final short Classpath = 7;
 
         /**
          * {0} code
          */
-        public static final int Code_1 = 21;
+        public static final short Code_1 = 8;
 
         /**
          * Commands
          */
-        public static final int Commands = 48;
+        public static final short Commands = 9;
 
         /**
          * Current date and time
          */
-        public static final int CurrentDateTime = 25;
+        public static final short CurrentDateTime = 10;
 
         /**
          * Current directory
          */
-        public static final int CurrentDirectory = 33;
+        public static final short CurrentDirectory = 11;
 
         /**
          * Cycle omitted
          */
-        public static final int CycleOmitted = 54;
+        public static final short CycleOmitted = 12;
 
         /**
          * Daylight time
          */
-        public static final int DaylightTime = 24;
+        public static final short DaylightTime = 13;
 
         /**
          * Destination
          */
-        public static final int Destination = 38;
+        public static final short Destination = 14;
 
         /**
          * Dimensions
          */
-        public static final int Dimensions = 46;
+        public static final short Dimensions = 15;
 
         /**
          * Directory
          */
-        public static final int Directory = 36;
+        public static final short Directory = 16;
 
         /**
          * Dublin Julian
          */
-        public static final int DublinJulian = 56;
+        public static final short DublinJulian = 17;
 
         /**
          * Ellipsoidal
          */
-        public static final int Ellipsoidal = 61;
+        public static final short Ellipsoidal = 18;
 
         /**
          * Geoidal
          */
-        public static final int Geoidal = 62;
+        public static final short Geoidal = 19;
 
         /**
          * Identifier
          */
-        public static final int Identifier = 42;
+        public static final short Identifier = 20;
 
         /**
          * Implementation
          */
-        public static final int Implementation = 52;
+        public static final short Implementation = 21;
 
         /**
          * Index
          */
-        public static final int Index = 44;
+        public static final short Index = 22;
 
         /**
          * Java extensions
          */
-        public static final int JavaExtensions = 26;
+        public static final short JavaExtensions = 23;
 
         /**
          * Java home directory
          */
-        public static final int JavaHome = 30;
+        public static final short JavaHome = 24;
 
         /**
          * Julian
          */
-        public static final int Julian = 57;
+        public static final short Julian = 25;
 
         /**
          * Latitude
          */
-        public static final int Latitude = 40;
+        public static final short Latitude = 26;
 
         /**
          * Libraries
          */
-        public static final int Libraries = 35;
+        public static final short Libraries = 27;
 
         /**
          * Local configuration
          */
-        public static final int LocalConfiguration = 14;
+        public static final short LocalConfiguration = 28;
 
         /**
          * Locale
          */
-        public static final int Locale = 18;
+        public static final short Locale = 29;
 
         /**
          * Localization
          */
-        public static final int Localization = 19;
+        public static final short Localization = 30;
 
         /**
          * Logging
          */
-        public static final int Logging = 51;
+        public static final short Logging = 31;
 
         /**
          * Longitude
          */
-        public static final int Longitude = 41;
+        public static final short Longitude = 32;
 
         /**
          * Maximum value
          */
-        public static final int MaximumValue = 5;
+        public static final short MaximumValue = 33;
 
         /**
          * Mean value
          */
-        public static final int MeanValue = 6;
+        public static final short MeanValue = 34;
 
         /**
          * Minimum value
          */
-        public static final int MinimumValue = 4;
+        public static final short MinimumValue = 35;
 
         /**
          * Modified Julian
          */
-        public static final int ModifiedJulian = 58;
+        public static final short ModifiedJulian = 36;
 
         /**
          * Name
          */
-        public static final int Name = 0;
+        public static final short Name = 37;
 
         /**
          * Number of ‘NaN’
          */
-        public static final int NumberOfNaN = 3;
+        public static final short NumberOfNaN = 38;
 
         /**
          * Number of values
          */
-        public static final int NumberOfValues = 2;
+        public static final short NumberOfValues = 39;
 
         /**
          * {0} ({1} of {2})
          */
-        public static final int Of_3 = 43;
+        public static final short Of_3 = 40;
 
         /**
          * Offset
          */
-        public static final int Offset = 22;
+        public static final short Offset = 41;
 
         /**
          * Operating system
          */
-        public static final int OperatingSystem = 16;
+        public static final short OperatingSystem = 42;
 
         /**
          * Options
          */
-        public static final int Options = 49;
+        public static final short Options = 43;
 
         /**
          * Other surface
          */
-        public static final int OtherSurface = 63;
+        public static final short OtherSurface = 44;
 
         /**
          * Others
          */
-        public static final int Others = 34;
+        public static final short Others = 45;
 
         /**
          * Paths
          */
-        public static final int Paths = 27;
+        public static final short Paths = 46;
 
         /**
          * Root
          */
-        public static final int Root = 28;
+        public static final short Root = 47;
 
         /**
          * Root Mean Square
          */
-        public static final int RootMeanSquare = 7;
+        public static final short RootMeanSquare = 48;
 
         /**
          * Scale
          */
-        public static final int Scale = 23;
+        public static final short Scale = 49;
 
         /**
          * Source
          */
-        public static final int Source = 39;
+        public static final short Source = 50;
 
         /**
          * Standard deviation
          */
-        public static final int StandardDeviation = 8;
+        public static final short StandardDeviation = 51;
 
         /**
          * Temporary files
          */
-        public static final int TemporaryFiles = 31;
+        public static final short TemporaryFiles = 52;
 
         /**
          * {0} time
          */
-        public static final int Time_1 = 64;
+        public static final short Time_1 = 53;
 
         /**
          * Timezone
          */
-        public static final int Timezone = 20;
+        public static final short Timezone = 54;
 
         /**
          * Truncated Julian
          */
-        public static final int TruncatedJulian = 59;
+        public static final short TruncatedJulian = 55;
 
         /**
          * Type
          */
-        public static final int Type = 1;
+        public static final short Type = 56;
 
         /**
          * Unavailable content.
          */
-        public static final int UnavailableContent = 53;
+        public static final short UnavailableContent = 57;
 
         /**
          * Untitled
          */
-        public static final int Untitled = 37;
+        public static final short Untitled = 58;
 
         /**
          * User home directory
          */
-        public static final int UserHome = 32;
+        public static final short UserHome = 59;
 
         /**
          * Value
          */
-        public static final int Value = 13;
+        public static final short Value = 60;
 
         /**
          * Variables
          */
-        public static final int Variables = 47;
+        public static final short Variables = 61;
 
         /**
          * {0} version {1}
          */
-        public static final int Version_2 = 50;
+        public static final short Version_2 = 62;
 
         /**
          * Versions
          */
-        public static final int Versions = 15;
+        public static final short Versions = 63;
 
         /**
          * World
          */
-        public static final int World = 55;
+        public static final short World = 64;
     }
 
     /**
@@ -416,7 +416,7 @@ public final class Vocabulary extends In
      * @return The string for the given key.
      * @throws MissingResourceException If no object for the given key can be found.
      */
-    public static String format(final int key) throws MissingResourceException {
+    public static String format(final short key) throws MissingResourceException {
         return getResources(null).getString(key);
     }
 
@@ -426,8 +426,8 @@ public final class Vocabulary extends In
     private static final class International extends ResourceInternationalString {
         private static final long serialVersionUID = -5423999784169092823L;
 
-        International(int key)                   {super(key);}
-        International(int key, Object args)      {super(key, args);}
+        International(short key)                 {super(key);}
+        International(short key, Object args)    {super(key, args);}
         @Override KeyConstants getKeyConstants() {return Keys.INSTANCE;}
         @Override IndexedResourceBundle getBundle(final Locale locale) {
             return getResources(locale);
@@ -442,7 +442,7 @@ public final class Vocabulary extends In
      * @param  key The key for the desired string.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key) {
+    public static InternationalString formatInternational(final short key) {
         return new International(key);
     }
 
@@ -459,7 +459,7 @@ public final class Vocabulary extends In
      * @param  arg Values to substitute to "{0}".
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object arg)
{
+    public static InternationalString formatInternational(final short key, final Object arg)
{
         return new International(key, arg);
     }
 
@@ -472,7 +472,7 @@ public final class Vocabulary extends In
      * @param  args Values to substitute to "{0}", "{1}", <i>etc</i>.
      * @return An international string for the given key.
      */
-    public static InternationalString formatInternational(final int key, final Object...
args) {
+    public static InternationalString formatInternational(final short key, final Object...
args) {
         return new International(key, args);
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/package-info.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -86,7 +86,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3 (derived from geotk-1.2)
- * @version 0.3
+ * @version 0.4
  * @module
  *
  * @see java.util.ResourceBundle

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/ValueConverter.java
[UTF-8] Tue Dec 17 22:36:49 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,6 +189,8 @@ 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#parse(String)
      */
     public Locale toLocale(final MarshalContext context, String value) throws IllegalArgumentException
{
         value = trimWhitespaces(value);

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Tue
Dec 17 22:36:49 2013
@@ -245,19 +245,18 @@ public final class XML extends Static {
      * </ul>
      *
      * {@section Example}
-     * INSPIRE compliant language code shall be formatted like below (formatting may vary):
+     * INSPIRE compliant language code shall be formatted like below (details may vary):
      *
      * {@preformat xml
      *   <gmd:language>
      *     <gmd:LanguageCode
-     *         codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/ML_gmxCodelists.xml#LanguageCode"
+     *         codeList="http://schemas.opengis.net/iso/19139/20070417/resources/Codelist/gmxCodelists.xml#LanguageCode"
      *         codeListValue="fra">French</gmd:LanguageCode>
      *   </gmd:language>
      * }
      *
-     * However if this property contains the "{@code language}" value, then the marshaller
will
-     * format the language code like below (which is legal according OGC schemas, but is
not
-     * INSPIRE compliant):
+     * However if this property contains the "{@code language}" value, then the marshaller
will format
+     * the language code like below (which is legal according OGC schemas, but is not INSPIRE
compliant):
      *
      * {@preformat xml
      *   <gmd:language>

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/MeasureTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/MeasureTest.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/MeasureTest.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gco/MeasureTest.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -19,6 +19,7 @@ package org.apache.sis.internal.jaxb.gco
 import java.net.URISyntaxException;
 import javax.measure.unit.SI;
 import javax.measure.unit.NonSI;
+import org.apache.sis.internal.jaxb.Schemas;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -46,7 +47,7 @@ public final strictfp class MeasureTest 
         assertEquals(SI.METRE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9001", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='m'])",
measure.getUOM());
 
         measure.unit = null;
         measure.asXPointer = false;
@@ -54,12 +55,12 @@ public final strictfp class MeasureTest 
         assertEquals(NonSI.DEGREE_ANGLE, measure.unit);
         assertEquals("urn:ogc:def:uom:EPSG::9102", measure.getUOM());
         measure.asXPointer = true;
-        assertEquals("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='deg'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='deg'])",
measure.getUOM());
 
         measure.unit = null;
         measure.asXPointer = true;
         measure.setUOM("gmxUom.xml#kg"); // Not really an existing unit in 'gmxUom'.
         assertEquals(SI.KILOGRAM, measure.unit);
-        assertEquals("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='kg'])",
measure.getUOM());
+        assertEquals(Schemas.METADATA_ROOT + Schemas.UOM_PATH + "#xpointer(//*[@gml:id='kg'])",
measure.getUOM());
     }
 }

Copied: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
(from r1551738, sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java?p2=sis/branches/JDK6/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/LanguageCodeTest.java&r1=1551738&r2=1551742&rev=1551742&view=diff
==============================================================================
--- sis/branches/JDK7/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/internal/jaxb/gmd/LanguageCodeTest.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -79,7 +79,7 @@ public final strictfp class LanguageCode
      */
     @BeforeClass
     public static void createMarshallerPool() throws JAXBException {
-        final Map<String,Object> properties = new HashMap<>(4);
+        final Map<String,Object> properties = new HashMap<String,Object>(4);
         assertNull(properties.put(XML.LOCALE, Locale.UK));
         assertNull(properties.put(XML.TIMEZONE, "UTC"));
         pool = new MarshallerPool(JAXBContext.newInstance(MetadataMock.class), properties);

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8]
(original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestCase.java [UTF-8]
Tue Dec 17 22:36:49 2013
@@ -181,7 +181,6 @@ public abstract strictfp class TestCase 
      * @param success {@code true} if this method is invoked on build success,
      */
     static void flushOutput() {
-        randomSeed = 0;
         System.out.flush();
         System.err.flush();
         synchronized (buffer) { // This is the lock used by the 'out' PrintWriter.

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8]
(original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/TestRunner.java [UTF-8]
Tue Dec 17 22:36:49 2013
@@ -68,6 +68,11 @@ public final class TestRunner extends Bl
 
     /**
      * The dependency methods that failed. This set will be created only when first needed.
+     * Values are method names.
+     *
+     * {@note There is no need to prefix the method names by classnames because a new instance
of
+     *        <code>TestRunner</code> will be created for each test class, even
if the the test
+     *        classes are aggregated in a <code>TestSuite</code>.}
      *
      * @see #addDependencyFailure(String)
      */
@@ -103,14 +108,16 @@ public final class TestRunner extends Bl
         }
 
         /**
-         * Prints output only in verbose mode.
-         * Otherwise silently discard the output.
+         * Prints output only in verbose mode. Otherwise silently discard the output.
+         * This method is invoked on failure as well as on success. In case of test
+         * failure, this method is invoked after {@link #testFailure(Failure)}.
          */
         @Override
         public void testFinished(final Description description) {
             if (TestCase.verbose) {
                 TestCase.flushOutput();
             }
+            TestCase.randomSeed = 0;
         }
 
         /**
@@ -118,17 +125,21 @@ public final class TestRunner extends Bl
          */
         @Override
         public void testFailure(final Failure failure) {
-            final String methodName = failure.getDescription().getMethodName();
+            final Description description = failure.getDescription();
+            final String methodName = description.getMethodName();
             addDependencyFailure(methodName);
             final long seed = TestCase.randomSeed;
             if (seed != 0) {
+                final String className = description.getClassName();
                 final PrintWriter out = TestCase.out;
-                out.print("Random number generator for “");
+                out.print("Random number generator for ");
+                out.print(className.substring(className.lastIndexOf('.') + 1));
+                out.print('.');
                 out.print(methodName);
-                out.print("” was created with seed ");
+                out.print("() was created with seed ");
                 out.print(seed);
                 out.println('.');
-                // Seed we be cleared by TestCase.flushOutput()
+                // Seed we be cleared by testFinished(…).
             }
             if (!TestCase.verbose) {
                 TestCase.flushOutput();

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/XMLTestCase.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -58,6 +58,8 @@ public abstract strictfp class XMLTestCa
      * an error of one or two hours if a code fails to take timezone offset in account.
      *
      * <p>This field is initially {@code null} and created when first needed.</p>
+     *
+     * @see #getMarshallerPool()
      */
     private static MarshallerPool defaultPool;
 

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
[UTF-8] Tue Dec 17 22:36:49 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/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
[UTF-8] Tue Dec 17 22:36:49 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)
@@ -89,9 +89,23 @@ public final strictfp class LocalesTest 
     }
 
     /**
+     * Tests that {@link Locales#parse(String)} throw an exception if given an invalid argument.
+     */
+    @Test
+    public void testParseInvalid() {
+        try {
+            Locales.parse("orange_APPLE");
+            fail("Shall not parse invalid locale.");
+        } catch (IllegalArgumentException e) {
+            assertTrue(e.getMessage().contains("orange_APPLE"));
+        }
+    }
+
+    /**
      * Tests the {@link Locales#parseSuffix(String, String)} method.
      */
     @Test
+    @Deprecated
     @DependsOnMethod("testParse")
     public void testParseSuffix() {
         assertSame(null,           Locales.parseSuffix("remarks", "remark"));

Modified: sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
[UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/xml/NilReasonTest.java
[UTF-8] Tue Dec 17 22:36:49 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.*;
 

Modified: sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java?rev=1551742&r1=1551741&r2=1551742&view=diff
==============================================================================
--- sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
[UTF-8] (original)
+++ sis/branches/JDK6/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/impl/ChannelDecoder.java
[UTF-8] Tue Dec 17 22:36:49 2013
@@ -252,7 +252,7 @@ public final class ChannelDecoder extend
      *         one of the expected constants.
      */
     private static String tagName(final int tag) {
-        final int key;
+        final short key;
         switch (tag) {
             case DIMENSION: key = Vocabulary.Keys.Dimensions; break;
             case VARIABLE:  key = Vocabulary.Keys.Variables;  break;



Mime
View raw message