sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1803070 [13/20] - in /sis/branches/JDK9: ./ application/sis-console/src/main/java/org/apache/sis/console/ core/sis-build-helper/ core/sis-build-helper/src/main/java/org/apache/sis/internal/book/ core/sis-build-helper/src/main/java/org/apac...
Date Wed, 26 Jul 2017 16:14:14 GMT
Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -33,6 +33,11 @@ import org.apache.sis.internal.util.Cons
 
 import static java.lang.Math.PI;
 import static java.lang.Math.abs;
+import static org.apache.sis.measure.UnitRegistry.SI;
+import static org.apache.sis.measure.UnitRegistry.ACCEPTED;
+import static org.apache.sis.measure.UnitRegistry.IMPERIAL;
+import static org.apache.sis.measure.UnitRegistry.OTHER;
+import static org.apache.sis.measure.UnitRegistry.PREFIXABLE;
 import static org.apache.sis.measure.SexagesimalConverter.EPS;
 
 
@@ -324,6 +329,14 @@ public final class Units extends Static
     public static final Unit<Volume> CUBIC_METRE;
 
     /**
+     * The unit for litre volume (L, l or ℓ).
+     * The unlocalized name is “litre”.
+     *
+     * @since 0.8
+     */
+    public static final Unit<Volume> LITRE;
+
+    /**
      * The SI unit for solid angles (sr).
      * The unlocalized name is “steradian”.
      *
@@ -584,7 +597,7 @@ public final class Units extends Static
     public static final Unit<Speed> METRES_PER_SECOND;
 
     /**
-     * Unit of measurement defined as 60/1000 metres per second (1 km/h).
+     * Unit of measurement defined as 1/3.6 metres per second (1 km/h).
      * The {@linkplain ConventionalUnit#getSystemUnit() system unit} is {@link #METRES_PER_SECOND}
      * and the unlocalized name is “kilometres per hour”.
      *
@@ -942,6 +955,14 @@ public final class Units extends Static
     public static final Unit<Illuminance> LUX;
 
     /**
+     * A SI conventional unit for mass (g).
+     * The unlocalized name is “gram”.
+     *
+     * @since 0.8
+     */
+    public static final Unit<Mass> GRAM;
+
+    /**
      * The SI base unit for mass (kg).
      * The unlocalized name is “kilogram”.
      *
@@ -1061,14 +1082,16 @@ public final class Units extends Static
         /*
          * Base, derived or alternate units that we need to reuse more than once in this static initializer.
          */
-        final SystemUnit<Length>        m   = add(Length.class,        Scalar.Length::new,        length,        "m",   UnitRegistry.SI, Constants.EPSG_METRE);
-        final SystemUnit<Area>          m2  = add(Area.class,          Scalar.Area::new,          area,          "m²",  UnitRegistry.SI, (short) 0);
-        final SystemUnit<Time>          s   = add(Time.class,          Scalar.Time::new,          time,          "s",   UnitRegistry.SI, (short) 1040);
-        final SystemUnit<Temperature>   K   = add(Temperature.class,   Scalar.Temperature::new,   temperature,   "K",   UnitRegistry.SI, (short) 0);
-        final SystemUnit<Speed>         mps = add(Speed.class,         Scalar.Speed::new,         speed,         "m∕s", UnitRegistry.SI, (short) 1026);
-        final SystemUnit<Pressure>      Pa  = add(Pressure.class,      Scalar.Pressure::new,      pressure,      "Pa",  UnitRegistry.SI, (short) 0);
-        final SystemUnit<Angle>         rad = add(Angle.class,         Scalar.Angle::new,         dimensionless, "rad", UnitRegistry.SI, (short) 9101);
-        final SystemUnit<Dimensionless> one = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "",    UnitRegistry.SI, (short) 9201);
+        final SystemUnit<Length>        m   = add(Length.class,        Scalar.Length::new,        length,        "m",   (byte) (SI | PREFIXABLE), Constants.EPSG_METRE);
+        final SystemUnit<Area>          m2  = add(Area.class,          Scalar.Area::new,          area,          "m²",  (byte) (SI | PREFIXABLE), (short) 0);
+        final SystemUnit<Volume>        m3  = add(Volume.class,        Scalar.Volume::new,        length.pow(3), "m³",  (byte) (SI | PREFIXABLE), (short) 0);
+        final SystemUnit<Time>          s   = add(Time.class,          Scalar.Time::new,          time,          "s",   (byte) (SI | PREFIXABLE), (short) 1040);
+        final SystemUnit<Temperature>   K   = add(Temperature.class,   Scalar.Temperature::new,   temperature,   "K",   (byte) (SI | PREFIXABLE), (short) 0);
+        final SystemUnit<Speed>         mps = add(Speed.class,         Scalar.Speed::new,         speed,         "m∕s", (byte) (SI | PREFIXABLE), (short) 1026);
+        final SystemUnit<Pressure>      Pa  = add(Pressure.class,      Scalar.Pressure::new,      pressure,      "Pa",  (byte) (SI | PREFIXABLE), (short) 0);
+        final SystemUnit<Angle>         rad = add(Angle.class,         Scalar.Angle::new,         dimensionless, "rad", (byte) (SI | PREFIXABLE), (short) 9101);
+        final SystemUnit<Dimensionless> one = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "",            SI,               (short) 9201);
+        final SystemUnit<Mass>          kg  = add(Mass.class,          Scalar.Mass::new,          mass,          "kg",          SI,               (short) 0);
         /*
          * All SI prefix to be used below, with additional converters to be used more than once.
          */
@@ -1087,96 +1110,100 @@ public final class Units extends Static
          */
         rad.related(4);
         RADIAN      = rad;
-        GRAD        = add(rad, LinearConverter.scale(Math.PI / 20, 200       / 20), "grad", UnitRegistry.OTHER,    (short) 9105);
-        DEGREE      = add(rad, LinearConverter.scale(Math.PI / 20, 180       / 20), "°",    UnitRegistry.ACCEPTED, Constants.EPSG_PARAM_DEGREES);
-        ARC_MINUTE  = add(rad, LinearConverter.scale(Math.PI / 20, 180*60    / 20), "′",    UnitRegistry.ACCEPTED, (short) 9103);
-        ARC_SECOND  = add(rad, LinearConverter.scale(Math.PI / 20, 180*60*60 / 20), "″",    UnitRegistry.ACCEPTED, (short) 9104);
-        MICRORADIAN = add(rad, micro,                                               "µrad", UnitRegistry.SI,       (short) 9109);
+        GRAD        = add(rad, LinearConverter.scale(Math.PI / 20, 200       / 20), "grad", OTHER,    (short) 9105);
+        DEGREE      = add(rad, LinearConverter.scale(Math.PI / 20, 180       / 20), "°",    ACCEPTED, Constants.EPSG_PARAM_DEGREES);
+        ARC_MINUTE  = add(rad, LinearConverter.scale(Math.PI / 20, 180*60    / 20), "′",    ACCEPTED, (short) 9103);
+        ARC_SECOND  = add(rad, LinearConverter.scale(Math.PI / 20, 180*60*60 / 20), "″",    ACCEPTED, (short) 9104);
+        MICRORADIAN = add(rad, micro,                                               "µrad", SI,       (short) 9109);
         /*
          * All Unit<Length>.
          */
         m.related(7);
         METRE          = m;
-        NANOMETRE      = add(m, nano,                                     "nm",    UnitRegistry.SI,       (short) 0);
-        MILLIMETRE     = add(m, milli,                                    "mm",    UnitRegistry.SI,       (short) 1025);
-        CENTIMETRE     = add(m, centi,                                    "cm",    UnitRegistry.SI,       (short) 1033);
-        KILOMETRE      = add(m, kilo,                                     "km",    UnitRegistry.SI,       (short) 9036);
-        NAUTICAL_MILE  = add(m, LinearConverter.scale(   1852,        1), "M",     UnitRegistry.OTHER,    (short) 9030);
-        STATUTE_MILE   = add(m, LinearConverter.scale(1609344,      100), "mi",    UnitRegistry.IMPERIAL, (short) 9093);
-        US_SURVEY_FOOT = add(m, LinearConverter.scale(   1200,     3937), "ftUS",  UnitRegistry.OTHER,    (short) 9003);
-        CLARKE_FOOT    = add(m, LinearConverter.scale(3047972654d, 1E10), "ftCla", UnitRegistry.OTHER,    (short) 9005);
-        FOOT           = add(m, LinearConverter.scale(   3048,    10000), "ft",    UnitRegistry.IMPERIAL, (short) 9002);
-        INCH           = add(m, LinearConverter.scale(    254,    10000), "in",    UnitRegistry.IMPERIAL, (short) 0);
-        POINT          = add(m, LinearConverter.scale( 996264, 72000000), "pt",    UnitRegistry.OTHER,    (short) 0);
+        NANOMETRE      = add(m, nano,                                     "nm",    SI,       (short) 0);
+        MILLIMETRE     = add(m, milli,                                    "mm",    SI,       (short) 1025);
+        CENTIMETRE     = add(m, centi,                                    "cm",    SI,       (short) 1033);
+        KILOMETRE      = add(m, kilo,                                     "km",    SI,       (short) 9036);
+        NAUTICAL_MILE  = add(m, LinearConverter.scale(   1852,        1), "M",     OTHER,    (short) 9030);
+        STATUTE_MILE   = add(m, LinearConverter.scale(1609344,      100), "mi",    IMPERIAL, (short) 9093);
+        US_SURVEY_FOOT = add(m, LinearConverter.scale(   1200,     3937), "ftUS",  OTHER,    (short) 9003);
+        CLARKE_FOOT    = add(m, LinearConverter.scale(3047972654d, 1E10), "ftCla", OTHER,    (short) 9005);
+        FOOT           = add(m, LinearConverter.scale(   3048,    10000), "ft",    IMPERIAL, (short) 9002);
+        INCH           = add(m, LinearConverter.scale(    254,    10000), "in",    IMPERIAL, (short) 0);
+        POINT          = add(m, LinearConverter.scale( 996264, 72000000), "pt",    OTHER,    (short) 0);
         /*
          * All Unit<Time>.
          */
         s.related(5);
         SECOND         = s;
-        MILLISECOND    = add(s, milli, "ms", UnitRegistry.SI, (short) 0);
-        MINUTE         = add(s, LinearConverter.scale(         60,      1), "min", UnitRegistry.ACCEPTED, (short) 0);
-        HOUR           = add(s, LinearConverter.scale(      60*60,      1), "h",   UnitRegistry.ACCEPTED, (short) 0);
-        DAY            = add(s, LinearConverter.scale(   24*60*60,      1), "d",   UnitRegistry.ACCEPTED, (short) 0);
-        WEEK           = add(s, LinearConverter.scale( 7*24*60*60,      1), "wk",  UnitRegistry.OTHER,    (short) 0);
-        TROPICAL_YEAR  = add(s, LinearConverter.scale(31556925445.0, 1000), "a",   UnitRegistry.OTHER,    (short) 1029);
+        MILLISECOND    = add(s, milli,                                      "ms",  SI,       (short) 0);
+        MINUTE         = add(s, LinearConverter.scale(         60,      1), "min", ACCEPTED, (short) 0);
+        HOUR           = add(s, LinearConverter.scale(      60*60,      1), "h",   ACCEPTED, (short) 0);
+        DAY            = add(s, LinearConverter.scale(   24*60*60,      1), "d",   ACCEPTED, (short) 0);
+        WEEK           = add(s, LinearConverter.scale( 7*24*60*60,      1), "wk",  OTHER,    (short) 0);
+        TROPICAL_YEAR  = add(s, LinearConverter.scale(31556925445.0, 1000), "a",   OTHER,    (short) 1029);
         /*
          * All Unit<Speed>.
          */
         mps.related(1);
         METRES_PER_SECOND   = mps;
-        KILOMETRES_PER_HOUR = add(mps, LinearConverter.scale(6, 100), "km∕h", UnitRegistry.ACCEPTED, (short) 0);
+        KILOMETRES_PER_HOUR = add(mps, LinearConverter.scale(10, 36), "km∕h", ACCEPTED, (short) 0);
         /*
          * All Unit<Pressure>.
          */
         Pa.related(3);
         PASCAL      = Pa;
-        HECTOPASCAL = add(Pa,  hecto,                            "hPa",  UnitRegistry.SI,    (short) 0);
-        DECIBAR     = add(Pa,  ten4,                             "dbar", UnitRegistry.OTHER, (short) 0);
-        BAR         = add(Pa,  LinearConverter.scale(100000, 1), "bar",  UnitRegistry.OTHER, (short) 0);
-        ATMOSPHERE  = add(Pa,  LinearConverter.scale(101325, 1), "atm",  UnitRegistry.OTHER, (short) 0);
+        HECTOPASCAL = add(Pa,  hecto,                            "hPa",  SI,    (short) 0);
+        DECIBAR     = add(Pa,  ten4,                             "dbar", OTHER, (short) 0);
+        BAR         = add(Pa,  LinearConverter.scale(100000, 1), "bar",  OTHER, (short) 0);
+        ATMOSPHERE  = add(Pa,  LinearConverter.scale(101325, 1), "atm",  OTHER, (short) 0);
         /*
          * All Unit<Temperature>.
          */
         K.related(1);
-        KELVIN     = K;
-        CELSIUS    = add(K, LinearConverter.offset(  27315, 100), "°C", UnitRegistry.SI,    (short) 0);
-        FAHRENHEIT = add(K, new LinearConverter(100, 45967, 180), "°F", UnitRegistry.OTHER, (short) 0);
+        KELVIN       = K;
+        CELSIUS      = add(K, LinearConverter.offset(  27315, 100), "°C", SI,    (short) 0);
+        FAHRENHEIT   = add(K, new LinearConverter(100, 45967, 180), "°F", OTHER, (short) 0);
         /*
-         * Electricity and magnetism.
+         * Unit<Volume> and Unit<Mass>. Those units need to be handled in a special way because:
+         * 1) The base unit of mass is "kg", not "g". This is handled by a hard-coded case in SystemUnit.
+         * 2) The liter unit is not a SI units, but despite that is commonly used with SI prefixes.
          */
-        AMPERE  = add(ElectricCurrent.class,     null, current,                      "A",  UnitRegistry.SI, (short) 0);
-        COULOMB = add(ElectricCharge.class,      null, charge,                       "C",  UnitRegistry.SI, (short) 0);
-        VOLT    = add(ElectricPotential.class,   null, potential,                    "V",  UnitRegistry.SI, (short) 0);
-        FARAD   = add(ElectricCapacitance.class, null, charge.divide(potential),     "F",  UnitRegistry.SI, (short) 0);
-        SIEMENS = add(ElectricConductance.class, null, current.divide(potential),    "S",  UnitRegistry.SI, (short) 0);
-        OHM     = add(ElectricResistance.class,  null, potential.divide(current),    "Ω",  UnitRegistry.SI, (short) 0);
-        WEBER   = add(MagneticFlux.class,        null, magneticFlux,                 "Wb", UnitRegistry.SI, (short) 0);
-        TESLA   = add(MagneticFluxDensity.class, null, magneticFlux.divide(area),    "T",  UnitRegistry.SI, (short) 0);
-        HENRY   = add(ElectricInductance.class,  null, magneticFlux.divide(current), "H",  UnitRegistry.SI, (short) 0);
+        SQUARE_METRE = m2;
+        CUBIC_METRE  = m3;
+        KILOGRAM     = kg;
+        HECTARE      = add(m2, ten4,  "ha",        ACCEPTED,               (short) 0);
+        LITRE        = add(m3, milli, "L", (byte) (ACCEPTED | PREFIXABLE), (short) 0);
+        GRAM         = add(kg, milli, "g", (byte) (ACCEPTED | PREFIXABLE), (short) 0);
         /*
-         * Other units.
+         * Force, energy, electricity, magnetism and other units.
          */
-        SQUARE_METRE = m2;
-        HECTARE      = add(m2,  ten4,                                                             "ha",  UnitRegistry.ACCEPTED, (short) 0);
-        CUBIC_METRE  = add(Volume.class,            Scalar.Volume::new,    length.pow(3),         "m³",  UnitRegistry.SI,       (short) 0);
-        HERTZ        = add(Frequency.class,         Scalar.Frequency::new, time.pow(-1),          "Hz",  UnitRegistry.SI,       (short) 0);
-        KILOGRAM     = add(Mass.class,              Scalar.Mass::new,      mass,                  "kg",  UnitRegistry.SI,       (short) 0);
-        NEWTON       = add(Force.class,             Scalar.Force::new,     force,                 "N",   UnitRegistry.SI,       (short) 0);
-        JOULE        = add(Energy.class,            Scalar.Energy::new,    energy,                "J",   UnitRegistry.SI,       (short) 0);
-        WATT         = add(Power.class,             Scalar.Power::new,     power,                 "W",   UnitRegistry.SI,       (short) 0);
-        LUX          = add(Illuminance.class,       null,                  luminous.divide(area), "lx",  UnitRegistry.SI,       (short) 0);
-        LUMEN        = add(LuminousFlux.class,      null,                  luminous,              "lm",  UnitRegistry.SI,       (short) 0);
-        CANDELA      = add(LuminousIntensity.class, null,                  luminous,              "cd",  UnitRegistry.SI,       (short) 0);    // Must be after Lumen.
-        MOLE         = add(AmountOfSubstance.class, null,                  amount,                "mol", UnitRegistry.SI,       (short) 0);
-        STERADIAN    = add(SolidAngle.class,        null,                  dimensionless,         "sr",  UnitRegistry.SI,       (short) 0);
+        HERTZ      = add(Frequency.class,           Scalar.Frequency::new, time.pow(-1),                 "Hz",  (byte) (SI | PREFIXABLE), (short) 0);
+        NEWTON     = add(Force.class,               Scalar.Force::new,     force,                        "N",   (byte) (SI | PREFIXABLE), (short) 0);
+        JOULE      = add(Energy.class,              Scalar.Energy::new,    energy,                       "J",   (byte) (SI | PREFIXABLE), (short) 0);
+        WATT       = add(Power.class,               Scalar.Power::new,     power,                        "W",   (byte) (SI | PREFIXABLE), (short) 0);
+        AMPERE     = add(ElectricCurrent.class,     null,                  current,                      "A",   (byte) (SI | PREFIXABLE), (short) 0);
+        COULOMB    = add(ElectricCharge.class,      null,                  charge,                       "C",   (byte) (SI | PREFIXABLE), (short) 0);
+        VOLT       = add(ElectricPotential.class,   null,                  potential,                    "V",   (byte) (SI | PREFIXABLE), (short) 0);
+        FARAD      = add(ElectricCapacitance.class, null,                  charge.divide(potential),     "F",   (byte) (SI | PREFIXABLE), (short) 0);
+        SIEMENS    = add(ElectricConductance.class, null,                  current.divide(potential),    "S",   (byte) (SI | PREFIXABLE), (short) 0);
+        OHM        = add(ElectricResistance.class,  null,                  potential.divide(current),    "Ω",   (byte) (SI | PREFIXABLE), (short) 0);
+        WEBER      = add(MagneticFlux.class,        null,                  magneticFlux,                 "Wb",  (byte) (SI | PREFIXABLE), (short) 0);
+        TESLA      = add(MagneticFluxDensity.class, null,                  magneticFlux.divide(area),    "T",   (byte) (SI | PREFIXABLE), (short) 0);
+        HENRY      = add(ElectricInductance.class,  null,                  magneticFlux.divide(current), "H",   (byte) (SI | PREFIXABLE), (short) 0);
+        LUX        = add(Illuminance.class,         null,                  luminous.divide(area),        "lx",  (byte) (SI | PREFIXABLE), (short) 0);
+        LUMEN      = add(LuminousFlux.class,        null,                  luminous,                     "lm",  (byte) (SI | PREFIXABLE), (short) 0);
+        CANDELA    = add(LuminousIntensity.class,   null,                  luminous,                     "cd",  (byte) (SI | PREFIXABLE), (short) 0);    // Must be after Lumen.
+        MOLE       = add(AmountOfSubstance.class,   null,                  amount,                       "mol", (byte) (SI | PREFIXABLE), (short) 0);
+        STERADIAN  = add(SolidAngle.class,          null,                  dimensionless,                "sr",  (byte) (SI | PREFIXABLE), (short) 0);
         /*
          * All Unit<Dimensionless>.
          */
-        PERCENT = add(one, centi,                                                    "%",     UnitRegistry.OTHER, (short) 0);
-        PPM     = add(one, micro,                                                    "ppm",   UnitRegistry.OTHER, (short) 9202);
-        PSU     = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "psu",   UnitRegistry.OTHER, (short) 0);
-        SIGMA   = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "sigma", UnitRegistry.OTHER, (short) 0);
-        PIXEL   = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "px",    UnitRegistry.OTHER, (short) 0);
+        PERCENT = add(one, centi,                                                    "%",     OTHER, (short) 0);
+        PPM     = add(one, micro,                                                    "ppm",   OTHER, (short) 9202);
+        PSU     = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "psu",   OTHER, (short) 0);
+        SIGMA   = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "sigma", OTHER, (short) 0);
+        PIXEL   = add(Dimensionless.class, Scalar.Dimensionless::new, dimensionless, "px",    OTHER, (short) 0);
         UNITY   = UnitRegistry.init(one);  // Must be last in order to take precedence over all other units associated to UnitDimension.NONE.
 
         UnitRegistry.alias(UNITY,       Short.valueOf((short) 9203));
@@ -1189,6 +1216,8 @@ public final class Units extends Static
         UnitRegistry.alias(FAHRENHEIT,  "℉");
         UnitRegistry.alias(GRAD,      "gon");
         UnitRegistry.alias(HECTARE,   "hm²");
+        UnitRegistry.alias(LITRE,       "l");
+        UnitRegistry.alias(LITRE,       "ℓ");
         UnitRegistry.alias(UNITY,       "1");
 
         initialized = true;

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/About.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/About.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -43,6 +43,7 @@ import java.security.AccessController;
 import java.security.PrivilegedAction;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.CharSequences;
+import org.apache.sis.util.Exceptions;
 import org.apache.sis.util.Version;
 import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.logging.LoggerFactory;
@@ -331,7 +332,7 @@ fill:   for (int i=0; ; i++) {
                     } catch (ClassNotFoundException e) {
                         recoverableException(Modules.STORAGE, e);       // sis-storage module not in the classpath.
                     } catch (ReflectiveOperationException e) {
-                        value = e.toString();
+                        value = Exceptions.unwrap(e).toString();
                     }
                     nameKey = Vocabulary.Keys.DataFormats;
                     break;

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -75,6 +75,16 @@ public class OptionKey<T> implements Ser
     private static final long serialVersionUID = -7580514229639750246L;
 
     /**
+     * The library to use for creating geometric objects at reading time.
+     * Some libraries are the Java Topology Suite (JTS), ESRI geometry API and Java2D.
+     * If this option is not specified, then a library will be selected automatically
+     * among the libraries available in the runtime environment.
+     *
+     * @since 0.8
+     */
+    public static final OptionKey<GeometryLibrary> GEOMETRY_LIBRARY = new OptionKey<>("GEOMETRY_LIBRARY", GeometryLibrary.class);
+
+    /**
      * The locale to use for locale-sensitive data. This option determines the language to use for writing
      * {@link org.apache.sis.util.iso.AbstractInternationalString international strings} when the target
      * storage support only one language. It may also control number and date patterns in some file formats

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/CharSequences.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -651,7 +651,7 @@ search:     for (; fromIndex <= toIndex;
         }
         if (separator == '\n' || separator == '\r') {
             final CharSequence[] splitted = splitOnEOL(text);
-            for (int i=0; i<splitted.length; i++) {
+            for (int i=0; i < splitted.length; i++) {
                 // For consistency with the rest of this method.
                 splitted[i] = trimWhitespaces(splitted[i]);
             }
@@ -1006,7 +1006,7 @@ search:     for (; fromIndex <= toIndex;
         if (text != null) {
             lower = skipLeadingWhitespaces (text, lower, upper);
             upper = skipTrailingWhitespaces(text, lower, upper);
-            if (lower != 0 || upper != length) { // Safety in case subSequence doesn't make the check.
+            if (lower != 0 || upper != length) {                  // Safety in case subSequence doesn't make the check.
                 text = text.subSequence(lower, upper);
             }
         }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Exceptions.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -20,8 +20,13 @@ import java.util.List;
 import java.util.ArrayList;
 import java.util.Locale;
 import java.sql.SQLException;
+import java.lang.reflect.InvocationTargetException;
 import org.opengis.util.InternationalString;
 import org.apache.sis.util.resources.Vocabulary;
+import org.apache.sis.util.collection.BackingStoreException;
+
+// Branch-dependent imports
+import java.io.UncheckedIOException;
 
 
 /**
@@ -197,4 +202,41 @@ public final class Exceptions extends St
         }
         return false;
     }
+
+    /**
+     * If the given exception is a wrapper for another exception, returns the unwrapped exception.
+     * Otherwise returns the given argument unchanged. An exception is considered a wrapper if:
+     *
+     * <ul>
+     *   <li>It is an instance of {@link InvocationTargetException} (could be wrapping anything).</li>
+     *   <li>It is an instance of {@link BackingStoreException} (typically wrapping a checked exception).</li>
+     *   <li>It is an instance of {@link UncheckedIOException} (wrapping a {@link java.io.IOException}).</li>
+     *   <li>It is a parent type of the cause. For example some JDBC drivers wrap {@link SQLException}
+     *       in other {@code SQLException} without additional information.</li>
+     * </ul>
+     *
+     * This method uses only the exception class as criterion;
+     * it does not verify if the exception messages are the same.
+     *
+     * @param  exception  the exception to unwrap (may be {@code null}.
+     * @return the unwrapped exception (may be the given argument itself).
+     *
+     * @since 0.8
+     */
+    public static Exception unwrap(Exception exception) {
+        if (exception != null) {
+            while (exception instanceof InvocationTargetException ||
+                   exception instanceof BackingStoreException ||
+                   exception instanceof UncheckedIOException)
+            {
+                final Throwable cause = exception.getCause();
+                if (!(cause instanceof Exception)) break;
+                exception = (Exception) cause;
+            }
+            for (Throwable cause; exception.getClass().isInstance(cause = exception.getCause());) {
+                exception = (Exception) cause;      // Should never fail because of isInstance(…) check.
+            }
+        }
+        return exception;
+    }
 }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.Queue;
 import java.util.Set;
 import java.util.SortedSet;
+import java.util.NavigableSet;
 import java.util.Collections;
 import java.lang.reflect.Array;
 import java.math.BigDecimal;
@@ -37,7 +38,7 @@ import static java.lang.Double.doubleToL
  * Static methods working with {@link Number} objects, and a few primitive types by extension.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
+ * @version 0.8
  *
  * @see org.apache.sis.math.MathFunctions
  *
@@ -559,7 +560,7 @@ public final class Numbers extends Stati
     }
 
     /**
-     * Wraps the given value in a {@code Number} of the specified class.
+     * Wraps the given floating-point value in a {@code Number} of the specified class.
      * The given type shall be one of {@link Byte}, {@link Short}, {@link Integer}, {@link Long},
      * {@link Float}, {@link Double}, {@link BigInteger} and {@link BigDecimal} classes.
      * Furthermore, the given value shall be convertible to the given class without precision lost,
@@ -595,6 +596,44 @@ public final class Numbers extends Stati
     }
 
     /**
+     * Wraps the given integer value in a {@code Number} of the specified class.
+     * The given type shall be one of {@link Byte}, {@link Short}, {@link Integer}, {@link Long},
+     * {@link Float}, {@link Double}, {@link BigInteger} and {@link BigDecimal} classes.
+     * Furthermore, the given value shall be convertible to the given class without precision lost,
+     * otherwise an {@link IllegalArgumentException} will be thrown.
+     *
+     * @param  <N>    the wrapper class.
+     * @param  value  the value to wrap.
+     * @param  type   the desired wrapper class.
+     * @return the value wrapped in an object of the given class.
+     * @throws IllegalArgumentException if the given type is not one of the primitive wrappers for numeric types,
+     *         or if the given value can not be wrapped in an instance of the given class without precision lost.
+     *
+     * @since 0.8
+     */
+    @SuppressWarnings("unchecked")
+    public static <N extends Number> N wrap(final long value, final Class<N> type)
+            throws IllegalArgumentException
+    {
+        final N number;
+        switch (getEnumConstant(type)) {
+            case BYTE:        number = (N) Byte      .valueOf((byte)   value); break;
+            case SHORT:       number = (N) Short     .valueOf((short)  value); break;
+            case INTEGER:     number = (N) Integer   .valueOf((int)    value); break;
+            case LONG:        return   (N) Long      .valueOf(value);  // No need to verify.
+            case FLOAT:       number = (N) Float     .valueOf((float)  value); break;
+            case DOUBLE:      number = (N) Numerics  .valueOf((double) value); break;
+            case BIG_INTEGER: return   (N) BigInteger.valueOf(value);  // No need to verify.
+            case BIG_DECIMAL: return   (N) BigDecimal.valueOf(value);  // No need to verify.
+            default: throw unknownType(type);
+        }
+        if (number.longValue() != value) {
+            throw new IllegalArgumentException(Errors.format(Errors.Keys.CanNotConvertValue_2, value, type));
+        }
+        return number;
+    }
+
+    /**
      * Converts the specified string into a value object.
      * The value object can be an instance of {@link BigDecimal}, {@link BigInteger},
      * {@link Double}, {@link Float}, {@link Long}, {@link Integer}, {@link Short}, {@link Byte},
@@ -692,10 +731,11 @@ public final class Numbers extends Stati
                 return (T) mapping.nullValue;
             }
         } else if (type != null && type != Object.class) {
-            if (type == Map      .class) return (T) Collections.EMPTY_MAP;
-            if (type == List     .class) return (T) Collections.EMPTY_LIST;
-            if (type == Queue    .class) return (T) CollectionsExt.emptyQueue();
-            if (type == SortedSet.class) return (T) Collections.emptySortedSet();
+            if (type == Map         .class) return (T) Collections.EMPTY_MAP;
+            if (type == List        .class) return (T) Collections.EMPTY_LIST;
+            if (type == Queue       .class) return (T) CollectionsExt.emptyQueue();
+            if (type == SortedSet   .class) return (T) Collections.emptySortedSet();
+            if (type == NavigableSet.class) return (T) Collections.emptyNavigableSet();
             if (type.isAssignableFrom(Set.class)) {
                 return (T) Collections.EMPTY_SET;
             }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/AbstractName.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -316,9 +316,11 @@ public abstract class AbstractName imple
             }
             asString = buffer.toString();
         }
-        // Note: there is no need to invoke InternationalString.toString(Locale.ROOT) for
-        // the unlocalized version, because our International inner class is implemented in
-        // such a way that InternationalString.toString() returns AbstractName.toString().
+        /*
+         * Note: there is no need to invoke InternationalString.toString(Locale.ROOT) for
+         * the unlocalized version, because our International inner class is implemented in
+         * such a way that InternationalString.toString() returns AbstractName.toString().
+         */
         return asString.toString();
     }
 
@@ -341,7 +343,7 @@ public abstract class AbstractName imple
 
     /**
      * An international string built from a snapshot of {@link GenericName}.
-     * This class is immutable is the list given to the constructor is immutable.
+     * This class is immutable if the list given to the constructor is immutable.
      *
      * @author  Martin Desruisseaux (IRD, Geomatys)
      * @version 0.3

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultLocalName.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -113,7 +113,7 @@ public class DefaultLocalName extends Ab
     protected DefaultLocalName(NameSpace scope, final CharSequence name) {
         ArgumentChecks.ensureNonNull("name", name);
         if (scope == GlobalNameSpace.GLOBAL) {
-            scope = null; // Handled specially by scope().
+            scope = null;                                       // Handled specially by scope().
         }
         this.scope = scope;
         if (name instanceof InternationalString) {
@@ -323,7 +323,7 @@ public class DefaultLocalName extends Ab
      */
     private Object readResolve() throws ObjectStreamException {
         final DefaultNameSpace ns;
-        if (scope == null) { // Not a bug: readResolve() is intentionally private.
+        if (scope == null) {                    // Not a bug: readResolve() is intentionally private.
             ns = GlobalNameSpace.GLOBAL;
         } else if (scope instanceof DefaultNameSpace) {
             ns = (DefaultNameSpace) scope;

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameFactory.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -313,8 +313,10 @@ public class DefaultNameFactory extends
             }
         }
         if (names.size() == 1) {
-            // Preserves the InternationalString (current implementation of
-            // the parsing code above has lost the internationalization).
+            /*
+             * Preserves the InternationalString (current implementation of
+             * the parsing code above has lost the internationalization).
+             */
             return createLocalName(scope, name);
         }
         return createGenericName(scope, names.toArray(new String[names.size()]));

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/DefaultNameSpace.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -155,23 +155,34 @@ public class DefaultNameSpace implements
      *          the separator to insert between the {@linkplain AbstractName#getParsedNames()
      *          parsed names} of any name in that namespace.
      */
-    protected DefaultNameSpace(final DefaultNameSpace parent, CharSequence name,
+    protected DefaultNameSpace(final DefaultNameSpace parent, final CharSequence name,
                                final String headSeparator, final String separator)
     {
         this.parent = (parent != GlobalNameSpace.GLOBAL) ? parent : null;
         ensureNonNull("name",          name);
         ensureNonNull("headSeparator", headSeparator);
         ensureNonNull("separator",     separator);
-        if (!(name instanceof InternationalString)) {
-            name = name.toString();
-        }
-        this.name          = name;
+        this.name          = simplify(name);
         this.headSeparator = headSeparator;
         this.separator     = separator;
         init();
     }
 
     /**
+     * Converts the given name to its {@link String} representation if that name is not an {@link InternationalString}
+     * instance from which this {@code DefaultNameSpace} implementation can extract useful information. For example if
+     * the given name is a {@link SimpleInternationalString}, that international string does not give more information
+     * than the {@code String} that it wraps. Using the {@code String} as the canonical value increase the chances that
+     * {@link #equals(Object)} detect that two {@code GenericName} instances are equal.
+     */
+    private static CharSequence simplify(CharSequence name) {
+        if (!(name instanceof InternationalString) || name.getClass() == SimpleInternationalString.class) {
+            name = name.toString();
+        }
+        return name;
+    }
+
+    /**
      * Initializes the transient fields.
      */
     private void init() {
@@ -386,6 +397,8 @@ public class DefaultNameSpace implements
         ensureNonNull("key", key);
         if (name == null) {
             name = key;
+        } else {
+            name = simplify(name);
         }
         final WeakValueHashMap<String,Object> childs = this.childs;     // Paranoiac protection against accidental changes.
         DefaultNameSpace child;
@@ -433,7 +446,7 @@ public class DefaultNameSpace implements
             final Object existing = childs.get(key);
             if (existing instanceof DefaultLocalName) {
                 child = (DefaultLocalName) existing;
-                if (name.equals(child.name)) {
+                if (simplify(name).equals(child.name)) {
                     assert (child.scope != null ? child.scope : GlobalNameSpace.GLOBAL) == this;
                     return child;
                 }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Names.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -208,7 +208,7 @@ public final class Names extends Static
      *
      * @param  namespace  the namespace, or {@code null} for the global namespace.
      * @param  separator  the separator between the namespace and the local part, or {@code null}
-     *                    for the {@linkplain DefaultNameSpace#DEFAULT_SEPARATOR default separator}..
+     *                    for the {@linkplain DefaultNameSpace#DEFAULT_SEPARATOR default separator}.
      * @param  localPart  the name which is locale in the given namespace.
      * @return a type name in the given namespace.
      *
@@ -230,7 +230,7 @@ public final class Names extends Static
      *
      * @param  namespace  the namespace, or {@code null} for the global namespace.
      * @param  separator  the separator between the namespace and the local part, or {@code null}
-     *                    for the {@linkplain DefaultNameSpace#DEFAULT_SEPARATOR default separator}..
+     *                    for the {@linkplain DefaultNameSpace#DEFAULT_SEPARATOR default separator}.
      * @param  localPart  the name which is locale in the given namespace.
      * @param  valueClass the type of values, used for inferring a {@link TypeName} instance.
      * @return a member name in the given namespace for values of the given type.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/ResourceInternationalString.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -138,10 +138,12 @@ public class ResourceInternationalString
      *
      * @param  locale  the locale for which to get the resource bundle.
      * @return the resource bundle for the given locale.
+     * @throws MissingResourceException if no resource bundle can be found for the base name specified
+     *         at {@linkplain #ResourceInternationalString(String, String) construction time}.
      *
      * @see ResourceBundle#getBundle(String, Locale, ClassLoader)
      */
-    protected ResourceBundle getBundle(final Locale locale) {
+    protected ResourceBundle getBundle(final Locale locale) throws MissingResourceException {
         return ResourceBundle.getBundle(resources, locale);
     }
 
@@ -157,7 +159,8 @@ public class ResourceInternationalString
      *
      * @param  locale  the desired locale for the string to be returned.
      * @return the string in the specified locale, or in a fallback locale.
-     * @throws MissingResourceException if the key given to the constructor is invalid.
+     * @throws MissingResourceException if no resource can be found for the base name or for the key
+     *         specified at {@linkplain #ResourceInternationalString(String, String) construction time}.
      */
     @Override
     public String toString(Locale locale) throws MissingResourceException {

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/iso/Types.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -504,9 +504,9 @@ public final class Types extends Static
     }
 
     /**
-     * Returns the GeoAPI interface for the given ISO name, or {@code null} if none.
-     * The identifier argument shall be the value documented in the {@link UML#identifier()}
-     * annotation associated with the GeoAPI interface.
+     * Returns the Java type (usually a GeoAPI interface) for the given ISO name, or {@code null} if none.
+     * The identifier argument shall be the value documented in the {@link UML#identifier()} annotation on
+     * the Java type.
      *
      * <div class="note"><b>Examples:</b>
      * <ul>
@@ -515,8 +515,16 @@ public final class Types extends Static
      * </ul>
      * </div>
      *
-     * Only identifiers for the stable part of GeoAPI are recognized. This method does not handle
-     * the identifiers for the {@code geoapi-pending} module.
+     * Only identifiers for the stable part of GeoAPI or for some Apache SIS classes are recognized.
+     * This method does not handle the identifiers for interfaces in the {@code geoapi-pending} module.
+     *
+     * <div class="note"><b>Future evolution:</b>
+     * when a new ISO type does not yet have a corresponding GeoAPI interface,
+     * this method may temporarily return an Apache SIS class instead until a future version can use the interface.
+     * For example {@code forStandardName("CI_Individual")} returns
+     * <code>{@linkplain org.apache.sis.metadata.iso.citation.DefaultIndividual}.class</code> in Apache SIS versions
+     * that depend on GeoAPI 3.0, but the return type may be changed to {@code Individual.class} when Apache SIS will
+     * be upgraded to GeoAPI 3.1.</div>
      *
      * @param  identifier  the ISO {@linkplain UML} identifier, or {@code null}.
      * @return the GeoAPI interface, or {@code null} if the given identifier is {@code null} or unknown.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListener.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -24,15 +24,16 @@ import java.util.logging.LogRecord;
 /**
  * Intercepts non-fatal error messages logged by {@link org.apache.sis.storage.DataStore} or other SIS objects.
  * Warnings are encapsulated in {@link LogRecord} objects and logged at {@link Level#WARNING} if the emitter does not
- * have any registered any {@code WarningListener}. This listener allows applications to intercept warning records for:
+ * have registered any {@code WarningListener}. This listener allows applications to intercept warning records for
+ * displaying them in a dialog (or any other action that the application may choose) instead than logging them.
  *
- * <ul>
- *   <li>displaying the warning in a dialog or performing any other action that the application may choose,</li>
- *   <li>reducing the amount of records to be logged.</li>
- * </ul>
- *
- * The difference between using this listener or configuring the logging {@link java.util.logging.Handler} is
- * that listeners allow to handle the warnings on a per-{@code DataStore} (or any other emitter) instance.
+ * <div class="note"><b>Comparison with alternative approaches:</b>
+ * it is also possible to listen to login events by registering a custom {@link java.util.logging.Handler} to the logger.
+ * But {@code Handler} instances are registered on a per-logger basis and receive all messages sent to that logger
+ * regardless their emitter. By contrast, {@code WarningListener} instances are registered on a per-{@code DataStore}
+ * basis (or any other emitter) and receive all messages sent by that emitter regardless the destination logger.
+ * The emitter is part of the information given to the {@link #warningOccured(Object, LogRecord)} method,
+ * in addition to the log record.</div>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @version 0.3

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/logging/WarningListeners.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -32,15 +32,22 @@ import org.apache.sis.internal.util.Unmo
 
 /**
  * Holds a list of {@link WarningListener} instances and provides convenience methods for emitting warnings.
- * The convenience {@code warning(…)} methods can build {@code LogRecord} from an exception or from a string.
- *
- * <p>In the default implementation, all {@code warning(…)} methods delegate to {@link #warning(LogRecord)},
- * thus providing a single point that subclasses can override for intercepting all warnings.
- * The default behavior is:</p>
+ * This is a helper class for {@link org.apache.sis.storage.DataStore} implementations or for other services
+ * susceptible to emit warnings.
+ * Observers can {@linkplain #addWarningListener can add listeners} for being notified about warnings, and
+ * processes can invoke one of the {@code warning(…)} methods for emitting warnings. All warnings are given
+ * to the listeners as {@link LogRecord} instances (this allows localizable messages and additional information
+ * like {@linkplain LogRecord#getMillis() timestamp} and {@linkplain LogRecord#getThrown() stack trace}).
+ * This {@code WarningListeners} class provides convenience methods like {@link #warning(String, Exception)},
+ * which builds {@code LogRecord} from an exception or from a string, but all those {@code warning(…)} methods
+ * ultimately delegate to {@link #warning(LogRecord)}, thus providing a single point that subclasses can override.
+ * When a warning is emitted, the default behavior is:
  *
  * <ul>
  *   <li>If at least one {@link WarningListener} is registered,
  *       then all listeners are notified and the warning is <strong>not</strong> logged.
+ *   <li>Otherwise if the value returned by {@link LogRecord#getLoggerName()} is non-null,
+ *       then the warning will be logged to that named logger.</li>
  *   <li>Otherwise the warning is logged to the logger returned by {@link #getLogger()}.</li>
  * </ul>
  *
@@ -83,7 +90,8 @@ public class WarningListeners<S> impleme
 
     /**
      * Creates a new instance with initially no listener.
-     * Warnings will be logger to the logger, unless at least one listener is registered.
+     * Warnings will be logger to the destination given by {@link #getLogger()},
+     * unless at least one listener is {@linkplain #addWarningListener registered}.
      *
      * @param source  the declared source of warnings. This is not necessarily the real source,
      *                but this is the source that the implementor wants to declare as public API.
@@ -95,6 +103,8 @@ public class WarningListeners<S> impleme
 
     /**
      * Creates a new instance initialized with the same listeners than the given instance.
+     * This constructor is useful when a {@code DataStore} or other data producer needs to
+     * be duplicated for concurrency reasons.
      *
      * @param source  the declared source of warnings. This is not necessarily the real source,
      *                but this is the source that the implementor wants to declare as public API.
@@ -120,19 +130,35 @@ public class WarningListeners<S> impleme
     }
 
     /**
-     * Returns the logger where to send the warnings. The default implementation returns a logger for
-     * the package name of the {@code source} object. Subclasses should override this method if they
-     * can provide a fixed logger instance (typically a static final constant).
+     * Returns the logger where to send the warnings when no other destination is specified.
+     * This logger is used when:
+     *
+     * <ul>
+     *   <li>no listener has been {@linkplain #addWarningListener registered}, and</li>
+     *   <li>the {@code LogRecord} does not {@linkplain LogRecord#getLoggerName() specify a logger}.</li>
+     * </ul>
+     *
+     * The default implementation infers a logger name from the package name of the {@code source} object.
+     * Subclasses should override this method if they can provide a more determinist logger instance,
+     * typically from a static final constant.
      *
-     * @return  the logger where to send the warnings when there is no registered listeners.
+     * @return the logger where to send the warnings when there is no other destination.
      */
     public Logger getLogger() {
         return Logging.getLogger(source.getClass());
     }
 
     /**
-     * Reports a warning represented by the given log record. The default implementation notifies the listeners
-     * if any, or logs the message to the logger returned by {@link #getLogger()} otherwise.
+     * Reports a warning represented by the given log record. The default implementation forwards
+     * the given record to <strong>one</strong> of the following destinations, in preference order:
+     *
+     * <ol>
+     *   <li><code>{@linkplain WarningListener#warningOccured WarningListener.warningOccured}(source, record)</code>
+     *       on all {@linkplain #addWarningListener registered listeners} it at least one such listener exists.</li>
+     *   <li><code>{@linkplain Logging#getLogger(String) Logging.getLogger}(record.{@linkplain LogRecord#getLoggerName
+     *       getLoggerName()}).{@linkplain Logger#log(LogRecord) log}(record)</code> if the logger name is non-null.</li>
+     *   <li><code>{@linkplain #getLogger()}.{@linkplain Logger#log(LogRecord) log}(record)</code> otherwise.</li>
+     * </ol>
      *
      * @param record  the warning as a log record.
      */
@@ -146,8 +172,14 @@ public class WarningListeners<S> impleme
                 listener.warningOccured(source, record);
             }
         } else {
-            final Logger logger = getLogger();
-            record.setLoggerName(logger.getName());
+            final String name = record.getLoggerName();
+            final Logger logger;
+            if (name != null) {
+                logger = Logging.getLogger(name);
+            } else {
+                logger = getLogger();
+                record.setLoggerName(logger.getName());
+            }
             if (record instanceof QuietLogRecord) {
                 ((QuietLogRecord) record).clearThrown();
             }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -126,6 +126,11 @@ public final class Errors extends Indexe
         public static final short CanNotParseFile_2 = 10;
 
         /**
+         * Can not parse “{0}”.
+         */
+        public static final short CanNotParse_1 = 180;
+
+        /**
          * Can not read property “{1}” in file “{0}”.
          */
         public static final short CanNotReadPropertyInFile_2 = 11;
@@ -151,6 +156,11 @@ public final class Errors extends Indexe
         public static final short CanNotSetPropertyValue_1 = 15;
 
         /**
+         * Can not store the {0} value in this vector.
+         */
+        public static final short CanNotStoreInVector_1 = 175;
+
+        /**
          * Can not transform envelope.
          */
         public static final short CanNotTransformEnvelope = 16;
@@ -186,6 +196,11 @@ public final class Errors extends Indexe
         public static final short DatabaseError_2 = 21;
 
         /**
+         * Failed to {0,choice,0#insert|1#update} record “{2}” in database table “{1}”.
+         */
+        public static final short DatabaseUpdateFailure_3 = 174;
+
+        /**
          * Thread “{0}” is dead.
          */
         public static final short DeadThread_1 = 22;
@@ -454,6 +469,11 @@ public final class Errors extends Indexe
         public static final short InsufficientArgumentSize_3 = 74;
 
         /**
+         * “{0}” is an invalid version identifier.
+         */
+        public static final short InvalidVersionIdentifier_1 = 179;
+
+        /**
          * A different value is already associated to the “{0}” key.
          */
         public static final short KeyCollision_1 = 75;
@@ -535,11 +555,22 @@ public final class Errors extends Indexe
         public static final short MissingValueInColumn_1 = 90;
 
         /**
+         * Can not return a single value for “{0}” because there is at least two occurrences, at
+         * indices {1} and {2}.
+         */
+        public static final short MultiOccurenceValueAtIndices_3 = 173;
+
+        /**
          * Options “{0}” and “{1}” are mutually exclusive.
          */
         public static final short MutuallyExclusiveOptions_2 = 91;
 
         /**
+         * Native interfaces “{1}” not available for the {0} platform.
+         */
+        public static final short NativeInterfacesNotFound_2 = 176;
+
+        /**
          * Argument ‘{0}’ shall not be negative. The given value was {1}.
          */
         public static final short NegativeArgument_2 = 92;
@@ -885,6 +916,16 @@ public final class Errors extends Indexe
         public static final short UnsupportedArgumentValue_1 = 170;
 
         /**
+         * Axes with “{0}” direction are not supported by this operation.
+         */
+        public static final short UnsupportedAxisDirection_1 = 177;
+
+        /**
+         * The “{0}” coordinate system is not supported by this operation.
+         */
+        public static final short UnsupportedCoordinateSystem_1 = 178;
+
+        /**
          * The “{0}” datum is not supported by this operation.
          */
         public static final short UnsupportedDatum_1 = 168;

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -35,12 +35,14 @@ CanNotConvertValue_2              = Can
 CanNotCompute_1                   = Can not compute \u201c{0}\u201d.
 CanNotCopy_1                      = Can not copy \u201c{0}\u201d.
 CanNotOpen_1                      = Can not open \u201c{0}\u201d.
+CanNotParse_1                     = Can not parse \u201c{0}\u201d.
 CanNotParseFile_2                 = Can not parse \u201c{1}\u201d as a file in the {0} format.
 CanNotRead_1                      = Can not read \u201c{0}\u201d.
 CanNotReadPropertyInFile_2        = Can not read property \u201c{1}\u201d in file \u201c{0}\u201d.
 CanNotRepresentInFormat_2         = Can not represent \u201c{1}\u201d in a strictly standard-compliant {0} format.
 CanNotSetParameterValue_1         = Can not set a value for parameter \u201c{0}\u201d.
 CanNotSetPropertyValue_1          = Can not set a value for property \u201c{0}\u201d.
+CanNotStoreInVector_1             = Can not store the {0} value in this vector.
 CanNotTransformEnvelope           = Can not transform envelope.
 CanNotWriteFile_2                 = Can not write \u201c{1}\u201d as a file in the {0} format.
 CircularReference                 = Circular reference.
@@ -48,6 +50,7 @@ ClassNotFinal_1                   = Clas
 CloneNotSupported_1               = Can not clone an object of type \u2018{0}\u2019.
 CrossReferencesNotSupported       = Cross references are not supported.
 DatabaseError_2                   = Database error while creating a \u2018{0}\u2019 object for the \u201c{1}\u201d identifier.
+DatabaseUpdateFailure_3           = Failed to {0,choice,0#insert|1#update} record \u201c{2}\u201d in database table \u201c{1}\u201d.
 DeadThread_1                      = Thread \u201c{0}\u201d is dead.
 DisposedInstanceOf_1              = This instance of \u2018{0}\u2019 has been disposed.
 DuplicatedElement_1               = Element \u201c{0}\u201d is duplicated.
@@ -101,6 +104,7 @@ IndexOutOfBounds_1                = Inde
 IndicesOutOfBounds_2              = Indices ({0}, {1}) are out of bounds.
 InfiniteArgumentValue_1           = Argument \u2018{0}\u2019 can not take an infinite value.
 InsufficientArgumentSize_3        = Argument \u2018{0}\u2019 shall contain at least {1} elements. A number of {2} is insufficient.
+InvalidVersionIdentifier_1        = \u201c{0}\u201d is an invalid version identifier.
 KeyCollision_1                    = A different value is already associated to the \u201c{0}\u201d key.
 MandatoryAttribute_2              = Attribute \u201c{0}\u201d is mandatory for an object of type \u2018{1}\u2019.
 MismatchedArrayLengths            = Mismatched array lengths.
@@ -117,7 +121,9 @@ MissingRequiredModule_1           = This
 MissingValueForOption_1           = Missing value for \u201c{0}\u201d option.
 MissingValueForProperty_1         = Missing value for \u201c{0}\u201d property.
 MissingValueInColumn_1            = Missing value in the \u201c{0}\u201d column.
+MultiOccurenceValueAtIndices_3    = Can not return a single value for \u201c{0}\u201d because there is at least two occurrences, at indices {1} and {2}.
 MutuallyExclusiveOptions_2        = Options \u201c{0}\u201d and \u201c{1}\u201d are mutually exclusive.
+NativeInterfacesNotFound_2        = Native interfaces \u201c{1}\u201d not available for the {0} platform.
 NegativeArgument_2                = Argument \u2018{0}\u2019 shall not be negative. The given value was {1}.
 NegativeArrayLength_1             = Can not create a \u201c{0}\u201d array of negative length.
 NestedElementNotAllowed_1         = Nested \u201c{0}\u201d elements are not allowed.
@@ -192,6 +198,8 @@ UnsupportedImplementation_1       = Can
 UnsupportedInterpolation_1        = The \u201c{0}\u201d interpolation is unsupported.
 UnsupportedOperation_1            = The \u2018{0}\u2019 operation is unsupported.
 UnsupportedArgumentValue_1        = The \u201c{0}\u201d argument value is unsupported.
+UnsupportedAxisDirection_1        = Axes with \u201c{0}\u201d direction are not supported by this operation.
+UnsupportedCoordinateSystem_1     = The \u201c{0}\u201d coordinate system is not supported by this operation.
 UnsupportedDatum_1                = The \u201c{0}\u201d datum is not supported by this operation.
 UnsupportedType_1                 = The \u2018{0}\u2019 type is not supported in this context.
 ValueAlreadyDefined_1             = A value is already defined for \u201c{0}\u201d.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Errors_fr.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -32,12 +32,14 @@ CanNotConvertValue_2              = La v
 CanNotCompute_1                   = Ne peut pas calculer \u00ab\u202f{0}\u202f\u00bb.
 CanNotCopy_1                      = Ne peut pas copier \u00ab\u202f{0}\u202f\u00bb.
 CanNotOpen_1                      = Ne peut pas ouvrir \u00ab\u202f{0}\u202f\u00bb.
+CanNotParse_1                     = Ne peut pas interpr\u00e9ter \u00ab\u202f{0}\u202f\u00bb.
 CanNotParseFile_2                 = Ne peut pas lire \u00ab\u202f{1}\u202f\u00bb comme un fichier au format {0}.
 CanNotRead_1                      = Ne peut pas lire \u00ab\u202f{0}\u202f\u00bb.
 CanNotReadPropertyInFile_2        = Ne peut pas lire la propri\u00e9t\u00e9 \u00ab\u202f{1}\u202f\u00bb dans le fichier \u00ab\u202f{0}\u202f\u00bb.
 CanNotRepresentInFormat_2         = Ne peut pas repr\u00e9senter \u00ab\u202f{1}\u202f\u00bb dans un format {0} strictement conforme.
 CanNotSetParameterValue_1         = Ne peut pas d\u00e9finir une valeur pour le param\u00e8tre \u00ab\u202f{0}\u202f\u00bb.
 CanNotSetPropertyValue_1          = Ne peut pas d\u00e9finir une valeur pour la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb.
+CanNotStoreInVector_1             = Ne peut pas stocker la valeur {0} dans ce vecteur.
 CanNotTransformEnvelope           = Ne peut pas transformer l\u2019enveloppe.
 CanNotWriteFile_2                 = Ne peut pas \u00e9crire \u00ab\u202f{1}\u202f\u00bb comme un fichier au format {0}.
 CircularReference                 = R\u00e9f\u00e9rence circulaire.
@@ -45,6 +47,7 @@ ClassNotFinal_1                   = La c
 CloneNotSupported_1               = Un objet de type \u2018{0}\u2019 ne peut pas \u00eatre clon\u00e9.
 CrossReferencesNotSupported       = Les r\u00e9f\u00e9rences crois\u00e9es ne sont pas support\u00e9es.
 DatabaseError_2                   = Erreur de base de donn\u00e9es lors de la cr\u00e9ation d\u2019un objet \u2018{0}\u2019 pour l\u2019identifiant \u00ab\u202f{1}\u202f\u00bb.
+DatabaseUpdateFailure_3           = \u00c9chec lors de {0,choice,0#l\u2019insertion|1#la mise \u00e0 jour} de l\u2019enregistrement \u00ab\u202f{2}\u202f\u00bb dans la table \u00ab\u202f{1}\u202f\u00bb de la base de donn\u00e9es.
 DeadThread_1                      = La t\u00e2che \u00ab\u202f{0}\u202f\u00bb est morte.
 DisposedInstanceOf_1              = Cette instance de \u2018{0}\u2019 a \u00e9t\u00e9 dispos\u00e9e.
 DuplicatedElement_1               = L\u2019\u00e9lement \u00ab\u202f{0}\u202f\u00bb est dupliqu\u00e9.
@@ -98,6 +101,7 @@ IndexOutOfBounds_1                = L\u2
 IndicesOutOfBounds_2              = Les index ({0}, {1}) sont en dehors des limites permises.
 InfiniteArgumentValue_1           = L\u2019argument \u2018{0}\u2019 ne peut pas prendre une valeur infinie.
 InsufficientArgumentSize_3        = L\u2019argument \u2018{0}\u2019 doit contenir au moins {1} \u00e9l\u00e9ments. Un nombre de {2} est insuffisant.
+InvalidVersionIdentifier_1        = \u00ab\u202f{0}\u202f\u00bb n\u2019est pas un identifiant de version valide.
 KeyCollision_1                    = Une valeur diff\u00e9rente est d\u00e9j\u00e0 associ\u00e9e \u00e0 la cl\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 MandatoryAttribute_2              = L\u2019attribut \u00ab\u202f{0}\u202f\u00bb est obligatoire pour un objet de type \u2018{1}\u2019.
 MismatchedArrayLengths            = Les dimensions des tableaux ne correspondent pas.
@@ -114,7 +118,9 @@ MissingRequiredModule_1           = Cett
 MissingValueForOption_1           = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour l\u2019option \u00ab\u202f{0}\u202f\u00bb.
 MissingValueForProperty_1         = Aucune valeur n\u2019a \u00e9t\u00e9 d\u00e9finie pour la propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb.
 MissingValueInColumn_1            = Il manque une valeur dans la colonne \u00ab\u202f{0}\u202f\u00bb.
+MultiOccurenceValueAtIndices_3    = Ne peut pas retourner une valeur unique pour \u00ab\u202f{0}\u202f\u00bb parce qu\u2019il y a au moins deux occurrences, aux index {1} et {2}.
 MutuallyExclusiveOptions_2        = Les options \u00ab\u202f{0}\u202f\u00bb et \u00ab\u202f{1}\u202f\u00bb sont mutuellement exclusives.
+NativeInterfacesNotFound_2        = Les interfaces natives \u00ab\u202f{1}\u202f\u00bb ne sont pas disponibles pour la plateforme {0}.
 NegativeArgument_2                = L\u2019argument \u2018{0}\u2019 ne doit pas \u00eatre n\u00e9gatif. La valeur donn\u00e9e \u00e9tait {1}.
 NegativeArrayLength_1             = Ne peut pas cr\u00e9er un tableau \u00ab\u202f{0}\u202f\u00bb de longueur n\u00e9gative.
 NestedElementNotAllowed_1         = L\u2019imbrication d\u2019\u00e9l\u00e9ments \u00ab\u202f{0}\u202f\u00bb n\u2019est pas autoris\u00e9e.
@@ -188,6 +194,8 @@ UnsupportedImplementation_1       = Cett
 UnsupportedInterpolation_1        = L\u2019interpolation \u201c{0}\u201d n\u2019est pas support\u00e9e.
 UnsupportedOperation_1            = L\u2019op\u00e9ration \u2018{0}\u2019 n\u2019est pas support\u00e9e.
 UnsupportedArgumentValue_1        = La valeur d\u2019argument \u00ab\u202f{0}\u202f\u00bb n\u2019est pas support\u00e9e.
+UnsupportedAxisDirection_1        = Les axes de direction \u00ab\u202f{0}\u202f\u00bb ne sont pas support\u00e9s par cette op\u00e9ration.
+UnsupportedCoordinateSystem_1     = Le syst\u00e8me de coordonn\u00e9es \u00ab\u202f{0}\u202f\u00bb n\u2019est pas support\u00e9 par cette op\u00e9ration.
 UnsupportedDatum_1                = Le r\u00e9f\u00e9rentiel \u00ab\u202f{0}\u202f\u00bb n\u2019est pas support\u00e9 par cette op\u00e9ration.
 UnsupportedType_1                 = Le type \u2018{0}\u2019 n\u2019est pas support\u00e9 dans ce contexte.
 ValueAlreadyDefined_1             = Une valeur est d\u00e9j\u00e0 d\u00e9finie pour \u00ab\u202f{0}\u202f\u00bb.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -154,6 +154,11 @@ public final class Messages extends Inde
         public static final short DiscardedExclusiveProperty_2 = 19;
 
         /**
+         * Dropped the “{0}” foreigner key constraint.
+         */
+        public static final short DroppedForeignerKey_1 = 32;
+
+        /**
          * Ignored properties after the first occurrence of ‘{0}’.
          */
         public static final short IgnoredPropertiesAfterFirst_1 = 20;

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -34,6 +34,7 @@ DataDirectoryNotReadable_2       = The \
 DataDirectoryNotSpecified_1      = The \u201c{0}\u201d environment variable is not set.
 DataDirectoryNotWritable_2       = Apache SIS can not write in the \u201c{1}\u201d directory given by the {0} environment variable.
 DiscardedExclusiveProperty_2     = Property \u201c{0}\u201d has been discarded in favor of \u201c{1}\u201d, because those two properties are mutually exclusive.
+DroppedForeignerKey_1            = Dropped the \u201c{0}\u201d foreigner key constraint.
 IgnoredPropertiesAfterFirst_1    = Ignored properties after the first occurrence of \u2018{0}\u2019.
 IgnoredPropertyAssociatedTo_1    = Ignored property associated to \u2018{0}\u2019.
 IncompleteParsing_1              = Parsing of \u201c{0}\u201d done, but some elements were ignored.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Messages_fr.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -41,6 +41,7 @@ DataDirectoryNotReadable_2       = Le r\
 DataDirectoryNotSpecified_1      = La variable environnementale \u00ab\u202f{0}\u202f\u00bb n\u2019est pas d\u00e9finie.
 DataDirectoryNotWritable_2       = Apache SIS ne peut pas \u00e9crire dans le r\u00e9pertoire \u00ab\u202f{1}\u202f\u00bb sp\u00e9cifi\u00e9e par la variable environnementale {0}.
 DiscardedExclusiveProperty_2     = La propri\u00e9t\u00e9 \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9 \u00e9cart\u00e9e en faveur de \u00ab\u202f{1}\u202f\u00bb, parce que ces deux propri\u00e9t\u00e9s sont mutuellement exclusives.
+DroppedForeignerKey_1            = Suppression de la contrainte de cl\u00e9 \u00e9trang\u00e8re \u00ab\u202f{0}\u202f\u00bb.
 IgnoredPropertiesAfterFirst_1    = Des propri\u00e9t\u00e9s ont \u00e9t\u00e9 ignor\u00e9es apr\u00e8s la premi\u00e8re occurrence de \u2018{0}\u2019.
 IgnoredPropertyAssociatedTo_1    = Une propri\u00e9t\u00e9 associ\u00e9e \u00e0 \u2018{0}\u2019 a \u00e9t\u00e9 ignor\u00e9e.
 IncompleteParsing_1              = La lecture de \u00ab\u202f{0}\u202f\u00bb a \u00e9t\u00e9 faite, mais en ignorant certains \u00e9l\u00e9ments.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -242,6 +242,11 @@ public final class Vocabulary extends In
         public static final short Description = 31;
 
         /**
+         * Designation
+         */
+        public static final short Designation = 142;
+
+        /**
          * Destination
          */
         public static final short Destination = 32;

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -51,6 +51,7 @@ DefaultValue            = Default value
 Deprecated              = Deprecated
 DerivedFrom_1           = Derived from {0}
 Description             = Description
+Designation             = Designation
 Destination             = Destination
 Details                 = Details
 Dimensions              = Dimensions

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/util/resources/Vocabulary_fr.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -58,6 +58,7 @@ DefaultValue            = Valeur par d\u
 Deprecated              = Obsol\u00e8te
 DerivedFrom_1           = D\u00e9riv\u00e9 de {0}
 Description             = Description
+Designation             = D\u00e9signation
 Destination             = Destination
 Details                 = D\u00e9tails
 Dimensions              = Dimensions

Modified: sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitAliases.properties [UTF-8] Wed Jul 26 16:14:09 2017
@@ -12,12 +12,16 @@ degree\ north=�
 degree\ south=�
 degree\ west=�
 feet=ft
+kilograms=kg
 grade=grad
 grades=grad
 gradian=grad
 gradians=grad
 grads=grad
+grams=g
 hours=h
+liters=L
+litres=L
 mbar=hPa
 millibar=hPa
 millibars=hPa

Modified: sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -11,6 +11,7 @@ F=farad
 ft=foot
 ftCla=Clarke\u2019s foot
 ftUS=US survey foot
+g=gram
 grad=grad
 h=hour
 ha=hectare
@@ -23,12 +24,13 @@ J=joule
 kg=kilogram
 km=kilometre
 km\u2215h=kilometres per hour
+L=litre
 lm=lumen
 lx=lux
 M=nautical mile
 m=metre
-m\u00b2=square metre
-m\u00b3=cubic metre
+m²=square metre
+m³=cubic metre
 m\u2215s=metres per second
 mi=statute mile
 min=minute
@@ -52,11 +54,11 @@ V=volt
 W=watt
 Wb=weber
 wk=week
-\u00b5rad=microradian
+µrad=microradian
 \u03a9=ohm
 %=percentage
-\u00b0=degree
+°=degree
 \u2032=arc-minute
 \u2033=arc-second
-\u00b0C=Celsius
-\u00b0F=Fahrenheit
+°C=Celsius
+°F=Fahrenheit

Modified: sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_en_US.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_en_US.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_en_US.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_en_US.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -1,6 +1,7 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
 cm=centimeter
 km=kilometer
+L=liter
 m=meter
 m²=square meter
 m³=cubic meter

Modified: sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/resources/org/apache/sis/measure/UnitNames_fr.properties [ISO-8859-1] Wed Jul 26 16:14:09 2017
@@ -1,33 +1,34 @@
 # Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
-A=amp\u00e8re
-a=ann\u00e9e
-atm=atmosph\u00e8re
-cm=centim\u00e8tre
+A=ampère
+a=année
+atm=atmosphère
+cm=centimètre
 d=jour
 ft=pied
 ftCla=pied de Clarke
-ftUS=pied am\u00e9ricain
+ftUS=pied américain
+g=gramme
 grad=grade
 h=heure
 in=pouce
 kg=kilogramme
-km=kilom\u00e8tre
-km\u2215h=kilom\u00e8tres par heure
+km=kilomètre
+km\u2215h=kilomètres par heure
 M=mille marin international
-m=m\u00e8tre
-m\u00b2=m\u00e8tre carr\u00e9
-m\u00b3=m\u00e8tre cube
-m\u2215s=m\u00e8tres par seconde
+m=mètre
+m²=mètre carré
+m³=mètre cube
+m\u2215s=mètres par seconde
 mi=mille terrestre international
-mm=millim\u00e8tre
+mm=millimètre
 ms=milliseconde
-nm=nanom\u00e8tre
+nm=nanomètre
 ppm=parties par million
 s=seconde
-sr=st\u00e9radian
-unity=unit\u00e9
+sr=stéradian
+unity=unité
 wk=semaine
 %=pourcentage
-\u00b0=degr\u00e9e
+°=degrée
 \u2032=arc-minute
 \u2033=arc-seconde

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/CollectionsExtTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -36,6 +36,9 @@ import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
 
+// Branch-dependent imports
+import java.util.function.Predicate;
+
 
 /**
  * Tests the {@link CollectionsExt} class.
@@ -151,6 +154,21 @@ public final strictfp class CollectionsE
     }
 
     /**
+     * Tests {@link CollectionsExt#filter(Iterator, Predicate)}.
+     */
+    @Test
+    public void testFilter() {
+        final Iterator<Integer> it = CollectionsExt.filter(Arrays.asList(2, 5, 7, 4, 8).iterator(), (Integer n) -> (n & 1) == 0);
+        assertTrue  (   it.hasNext());
+        assertEquals(2, it.next().intValue());
+        assertEquals(4, it.next().intValue());
+        assertTrue  (   it.hasNext());
+        assertTrue  (   it.hasNext());
+        assertEquals(8, it.next().intValue());
+        assertFalse (   it.hasNext());
+    }
+
+    /**
      * Tests {@link CollectionsExt#identityEquals(Iterator, Iterator)}.
      */
     @Test

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java?rev=1803070&r1=1803069&r2=1803070&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] Wed Jul 26 16:14:09 2017
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.internal.util;
 
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
 import java.text.ParseException;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
@@ -39,6 +41,17 @@ import java.time.LocalDateTime;
  */
 public final strictfp class StandardDateFormatTest extends TestCase {
     /**
+     * Verifies the {@link StandardDateFormat#MILLISECONDS_PER_DAY}, {@link StandardDateFormat#NANOS_PER_MILLISECOND}
+     * and {@link StandardDateFormat#NANOS_PER_SECOND} constant values.
+     */
+    @Test
+    public void verifyConstantValues() {
+        assertEquals("MILLISECONDS_PER_DAY",  TimeUnit.DAYS.toMillis(1),        StandardDateFormat.MILLISECONDS_PER_DAY);
+        assertEquals("NANOS_PER_MILLISECOND", TimeUnit.MILLISECONDS.toNanos(1), StandardDateFormat.NANOS_PER_MILLISECOND);
+        assertEquals("NANOS_PER_SECOND",      TimeUnit.SECONDS.toNanos(1),      StandardDateFormat.NANOS_PER_SECOND);
+    }
+
+    /**
      * Tests parsing a date.
      * Since the implementation is completely different in JDK8 branch than in previous branch,
      * a key purpose of this test is to ensure that the parsing is consistent between the branches.
@@ -79,4 +92,21 @@ public final strictfp class StandardDate
         assertEquals(LocalDateTime.of(2016, 6, 27, 16, 48),                        StandardDateFormat.parseBest("2016-06-27T16:48"));
         assertEquals(LocalDate.of(2016, 6, 27),                                    StandardDateFormat.parseBest("2016-06-27"));
     }
+
+    /**
+     * Tests formatting and parsing a negative year.
+     * This test uses the Julian epoch (January 1st, 4713 BC at 12:00 UTC in proleptic Julian calendar;
+     * equivalent to November 24, 4714 BC when expressed in the proleptic Gregorian calendar instead).
+     * We use astronomical year numbering: 4714 BC is numbered -4713.
+     *
+     * @throws ParseException if an error occurred while parsing the date.
+     */
+    @Test
+    public void testNegativeYear() throws ParseException {
+        final Date julian = new Date(-210866760000000L);            // Same epoch than CommonCRS.Temporal.JULIAN.
+        final String expected = "-4713-11-24T12:00:00.000";         // Proleptic Gregorian calendar, astronomical year.
+        final StandardDateFormat f = new StandardDateFormat();
+        assertEquals(expected, f.format(julian));
+        assertEquals(julian, f.parse(expected));
+    }
 }



Mime
View raw message