sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1789729 [8/9] - in /sis/branches/JDK9: ./ application/sis-console/ application/sis-console/src/main/java/org/apache/sis/console/ application/sis-console/src/test/java/org/apache/sis/console/ core/ core/sis-feature/src/main/java/org/apache/...
Date Fri, 31 Mar 2017 18:49:18 GMT
Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledMarshaller.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -36,6 +36,7 @@ import javax.xml.validation.Schema;
 import org.xml.sax.ContentHandler;
 import org.w3c.dom.Node;
 import org.apache.sis.internal.jaxb.Context;
+import org.apache.sis.internal.jaxb.TypeRegistration;
 
 
 /**
@@ -53,7 +54,7 @@ import org.apache.sis.internal.jaxb.Cont
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.8
  * @module
  */
 final class PooledMarshaller extends Pooled implements Marshaller {
@@ -90,7 +91,7 @@ final class PooledMarshaller extends Poo
         if (key instanceof String) {
             final String k = (String) key;
             if (value == null && (k.endsWith(".xmlHeaders") || k.equals(JAXB_SCHEMA_LOCATION))) {
-                value = ""; // Null value doesn't seem to be accepted for those properties.
+                value = "";      // Null value does not seem to be accepted for those properties.
             }
             marshaller.setProperty(k, value);
         } else if (key == AttachmentMarshaller.class) {
@@ -114,14 +115,30 @@ final class PooledMarshaller extends Poo
     }
 
     /**
+     * Converts the given arbitrary object to an implementation having JAXB annotations.
+     * If the given object is not recognized or is already an instance of the expected class,
+     * then it is returned unchanged.
+     */
+    private Object toImplementation(final Object value) throws JAXBException {
+        final TypeRegistration[] converters = getRootAdapters();
+        if (converters != null) {
+            for (final TypeRegistration t : converters) {
+                final Object c = t.toImplementation(value);
+                if (c != null) return c;
+            }
+        }
+        return value;
+    }
+
+    /**
      * Marshals to the given output with on-the-fly substitution of namespaces.
      * This method is invoked only when the user asked to marshal to a different GML version
      * than the one supported natively by SIS, i.e. when {@link #getFilterVersion()} returns
      * a non-null value.
      *
-     * @param object  the object to marshall.
-     * @param output  the writer created by SIS (<b>not</b> the writer given by the user).
-     * @param version Identify the namespace substitutions to perform.
+     * @param object   the object to marshall.
+     * @param output   the writer created by SIS (<b>not</b> the writer given by the user).
+     * @param version  identifies the namespace substitutions to perform.
      */
     private void marshal(final Object object, XMLStreamWriter output, final FilterVersion version)
             throws XMLStreamException, JAXBException
@@ -129,7 +146,7 @@ final class PooledMarshaller extends Poo
         output = new FilteredStreamWriter(output, version);
         final Context context = begin();
         try {
-            marshaller.marshal(object, output);
+            marshaller.marshal(toImplementation(object), output);
         } finally {
             context.finish();
         }
@@ -150,7 +167,7 @@ final class PooledMarshaller extends Poo
             // Marshalling to the default GML version.
             final Context context = begin();
             try {
-                marshaller.marshal(object, output);
+                marshaller.marshal(toImplementation(object), output);
             } finally {
                 context.finish();
             }
@@ -171,7 +188,7 @@ final class PooledMarshaller extends Poo
             // Marshalling to the default GML version.
             final Context context = begin();
             try {
-                marshaller.marshal(object, output);
+                marshaller.marshal(toImplementation(object), output);
             } finally {
                 context.finish();
             }
@@ -194,7 +211,7 @@ final class PooledMarshaller extends Poo
             // Marshalling to the default GML version.
             final Context context = begin();
             try {
-                marshaller.marshal(object, output);
+                marshaller.marshal(toImplementation(object), output);
             } finally {
                 context.finish();
             }
@@ -215,7 +232,7 @@ final class PooledMarshaller extends Poo
             // Marshalling to the default GML version.
             final Context context = begin();
             try {
-                marshaller.marshal(object, output);
+                marshaller.marshal(toImplementation(object), output);
             } finally {
                 context.finish();
             }
@@ -236,7 +253,7 @@ final class PooledMarshaller extends Poo
             // Marshalling to the default GML version.
             final Context context = begin();
             try {
-                marshaller.marshal(object, output);
+                marshaller.marshal(toImplementation(object), output);
             } finally {
                 context.finish();
             }
@@ -257,7 +274,7 @@ final class PooledMarshaller extends Poo
             // Marshalling to the default GML version.
             final Context context = begin();
             try {
-                marshaller.marshal(object, output);
+                marshaller.marshal(toImplementation(object), output);
             } finally {
                 context.finish();
             }
@@ -275,7 +292,7 @@ final class PooledMarshaller extends Poo
         }
         final Context context = begin();
         try {
-            marshaller.marshal(object, output);
+            marshaller.marshal(toImplementation(object), output);
         } finally {
             context.finish();
         }
@@ -295,7 +312,7 @@ final class PooledMarshaller extends Poo
             // Marshalling to the default GML version.
             final Context context = begin();
             try {
-                marshaller.marshal(object, output);
+                marshaller.marshal(toImplementation(object), output);
             } finally {
                 context.finish();
             }
@@ -314,7 +331,7 @@ final class PooledMarshaller extends Poo
         } else {
             final Context context = begin();
             try {
-                return marshaller.getNode(object);
+                return marshaller.getNode(toImplementation(object));
             } finally {
                 context.finish();
             }

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledTemplate.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledTemplate.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledTemplate.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/PooledTemplate.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -40,15 +40,18 @@ final class PooledTemplate extends Poole
      * Creates a new template.
      *
      * @param properties  the properties to be given to JAXB (un)marshallers, or {@code null} if none.
-     * @param internal {@code true} if the JAXB implementation is the one bundled in JDK 6,
-     *        or {@code false} if this is the external implementation provided as a JAR file
-     *        in the endorsed directory.
+     * @param internal    {@code true} if the JAXB implementation is the one bundled in JDK 6, or
+     *                    {@code false} if this is the external implementation provided as a JAR file
+     *                    in the endorsed directory.
      */
-    PooledTemplate(final Map<String,?> properties, final boolean internal) throws PropertyException {
-        super(internal);
+    PooledTemplate(final Map<String,?> properties, final Implementation implementation) throws PropertyException {
+        super(implementation == Implementation.INTERNAL);
         if (properties != null) {
             for (final Map.Entry<String,?> entry : properties.entrySet()) {
-                setProperty(entry.getKey(), entry.getValue());
+                final String key = entry.getKey();
+                if (implementation.filterProperty(key)) {
+                    setProperty(key, entry.getValue());
+                }
             }
         }
     }
@@ -83,7 +86,7 @@ final class PooledTemplate extends Poole
      * <p>Current implementation expects values of type {@code String}, but this may be generalized
      * in a future SIS version if there is a need for that.</p>
      *
-     * @param  name  the name of the property to remove.
+     * @param  name          the name of the property to remove.
      * @param  defaultValue  the default value to return if the given property is not defined in the map.
      * @return the old value of that property, or {@code defaultValue} if the given property was not defined.
      * @throws PropertyException if the given property is not of the expected type.

Modified: sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/main/java/org/apache/sis/xml/XML.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -37,7 +37,9 @@ import javax.xml.bind.JAXBException;
 import javax.xml.transform.Source;
 import javax.xml.transform.Result;
 import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stax.StAXResult;
 import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Version;
 import org.apache.sis.util.Workaround;
@@ -102,6 +104,7 @@ public final class XML extends Static {
      * {@link org.apache.sis.metadata.iso.DefaultMetadata#setLanguage(Locale) setLanguage(Locale)}
      * method will have precedence over this property. This behavior is compliant with INSPIRE rules.
      *
+     * @see org.apache.sis.setup.OptionKey#LOCALE
      * @see Marshaller#setProperty(String, Object)
      * @see org.apache.sis.metadata.iso.DefaultMetadata#setLanguage(Locale)
      */
@@ -115,6 +118,8 @@ public final class XML extends Static {
      * <div class="section">Default behavior</div>
      * If this property is never set, then (un)marshalling will use the
      * {@linkplain TimeZone#getDefault() default timezone}.
+     *
+     * @see org.apache.sis.setup.OptionKey#TIMEZONE
      */
     public static final String TIMEZONE = "org.apache.sis.xml.timezone";
 
@@ -308,8 +313,7 @@ public final class XML extends Static {
      * this field is initially null, then created by {@link #getPool()} when first needed.
      * Once created the field value usually doesn't change. However the field may be reset
      * to {@code null} in an OSGi context when modules are loaded or unloaded, because the
-     * set of classes returned by {@link TypeRegistration#defaultClassesToBeBound()} may
-     * have changed.
+     * set of classes returned by {@link TypeRegistration#load(boolean)} may have changed.
      *
      * @see #getPool()
      */
@@ -451,7 +455,21 @@ public final class XML extends Static {
                 marshaller.setProperty(entry.getKey(), entry.getValue());
             }
         }
-        marshaller.marshal(object, output);
+        /*
+         * STAX results are not handled by JAXB as of JDK 8. We have to handle those cases ourselves.
+         * This workaround should be removed if a future JDK version handles those cases.
+         */
+        if (output instanceof StAXResult) {
+            @Workaround(library = "JDK", version = "1.8")
+            final XMLStreamWriter writer = ((StAXResult) output).getXMLStreamWriter();
+            if (writer != null) {
+                marshaller.marshal(object, writer);
+            } else {
+                marshaller.marshal(object, ((StAXResult) output).getXMLEventWriter());
+            }
+        } else {
+            marshaller.marshal(object, output);
+        }
         pool.recycle(marshaller);
     }
 

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/XPathsTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/XPathsTest.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/XPathsTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/internal/util/XPathsTest.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -16,6 +16,7 @@
  */
 package org.apache.sis.internal.util;
 
+import org.apache.sis.util.Characters;
 import org.apache.sis.test.TestCase;
 import org.junit.Test;
 
@@ -42,6 +43,7 @@ public final strictfp class XPathsTest e
         assertEquals(97, XPaths.endOfURI("http://schemas.opengis.net/iso/19139/20070417/resources/uom/gmxUom.xml#xpointer(//*[@gml:id='m'])", 0));
         assertEquals(-1, XPaths.endOfURI("m/s", 0));
         assertEquals(-1, XPaths.endOfURI("m.s", 0));
+        assertEquals(11, XPaths.endOfURI("EPSG" + Characters.NO_BREAK_SPACE + ": 9001", 0));
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/math/PlaneTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/math/PlaneTest.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/math/PlaneTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/math/PlaneTest.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -31,12 +31,18 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (MPO, IRD)
  * @since   0.5
- * @version 0.5
+ * @version 0.8
  * @module
  */
 @DependsOn(org.apache.sis.internal.util.DoubleDoubleTest.class)
 public final strictfp class PlaneTest extends TestCase {
     /**
+     * The Pearson coefficient computed by the last call to
+     * {@link #assertFitEquals(double, double[], double[], double[])}.
+     */
+    private double pearson;
+
+    /**
      * Invokes {@link Plane#fit(DirectPosition[])} with the given arrays,
      * and compares the fitted values against the original values.
      *
@@ -44,9 +50,9 @@ public final strictfp class PlaneTest ex
      *
      * @param  tolerance  the maximal difference allowed between the fitted and the original values.
      */
-    private static Plane assertFitEquals(final double tolerance, final double[] x, final double[] y, final double[] z) {
+    private Plane assertFitEquals(final double tolerance, final double[] x, final double[] y, final double[] z) {
         final Plane plan = new Plane();
-        final double pearson = plan.fit(x, y, z);
+        pearson = plan.fit(x, y, z);
         assertEquals("Pearson correlation coefficient", 1, pearson, 0.01);
         for (int i = 0; i < z.length; i++) {
             assertEquals("z(x,y)", z[i], plan.z(x[i], y[i]), tolerance);
@@ -59,11 +65,11 @@ public final strictfp class PlaneTest ex
      *
      * @param  rd      the random number generator to use.
      * @param  length  the desired array length.
-     * @param  offset  the minimal value allowed in the returned array.
      * @param  scale   the difference between the minimal and maximal allowed values.
+     * @param  offset  the minimal value allowed in the returned array.
      * @return the array of random values.
      */
-    private static double[] random(final Random rd, final int length, final double offset, final double scale) {
+    private static double[] random(final Random rd, final int length, final double scale, final double offset) {
         final double[] x = new double[length];
         for (int i=0; i<length; i++) {
             x[i] = offset + scale * rd.nextDouble();
@@ -77,10 +83,9 @@ public final strictfp class PlaneTest ex
      */
     @Test
     public void testFit3Points() {
-        // We fix the random seed in order to avoid colinear points.
-        final Random rd = new Random(4762038814364076443L);
+        final Random rd = new Random(4762038814364076443L);     // Fix the random seed for avoiding colinear points.
         for (int n=0; n<10; n++) {
-            assertFitEquals(1E-9, // We expect close to exact matches.
+            assertFitEquals(1E-9,                               // We expect close to exact matches.
                     random(rd, 3, 100, -25),
                     random(rd, 3,  80, -20),
                     random(rd, 3, 150, -40));
@@ -96,16 +101,67 @@ public final strictfp class PlaneTest ex
         final Random  rd = new Random(7241997054993322309L);
         final double x[] = random(rd, 4000, 100, -25);
         final double y[] = random(rd, 4000,  80, -20);
-        final double z[] = random(rd, 4000, 150, -40);
-        final Plane plan = new Plane(2, 3, -4);
+        final double z[] = random(rd, 4000,  10,  -5);
+        final Plane reference = new Plane(2, 3, -4);
         for (int i=0; i<z.length; i++) {
-            // Compute points with random displacements above or below a known plane.
-            z[i] = plan.z(x[i], y[i]) + (10 * rd.nextDouble() - 5);
+            z[i] += reference.z(x[i], y[i]);    // Compute points with random displacements above or below a known plane.
         }
+        /*
+         * For a random seed fixed to 7241997054993322309, the coefficients are:
+         *
+         *   - reference:     z(x,y) = 2.0⋅x + 3.0⋅y + -4.0
+         *   - fitted:        z(x,y) = 2.001595888896693⋅x + 3.0021028196088055⋅y + -4.105960575835259
+         */
         final Plane fitted = assertFitEquals(6, x, y, z);
-        assertEquals("sx", plan.slopeX(), fitted.slopeX(), 0.01);
-        assertEquals("sy", plan.slopeY(), fitted.slopeY(), 0.01);
-        assertEquals("z₀", plan.z0(),     fitted.z0(),     1);
+        assertEquals("sx", reference.slopeX(), fitted.slopeX(), 0.002);
+        assertEquals("sy", reference.slopeY(), fitted.slopeY(), 0.003);
+        assertEquals("z₀", reference.z0(),     fitted.z0(),     0.2);
+    }
+
+    /**
+     * Verifies that {@link Plane#fit(int, int, Vector)} produces the same result than
+     * {@link Plane#fit(double[], double[], double[])}.
+     *
+     * @since 0.8
+     */
+    @Test
+    @DependsOnMethod("testFitManyPoints")
+    public void testFitGrid() {
+        final int nx = 20;
+        final int ny = 30;
+        final Random  rd = new Random(1224444984079270867L);
+        final double z[] = random(rd, nx*ny, 12, -6);
+        final double x[] = new double[z.length];
+        final double y[] = new double[z.length];
+        final Plane reference = new Plane(-46, 17, 35);
+        for (int i=0; i<z.length; i++) {
+            x[i] = i % nx;
+            y[i] = i / nx;
+            z[i] += reference.z(x[i], y[i]);
+        }
+        /*
+         * Opportunistically verify the result of fit(double[], double[], double[]), but it is
+         * not the purpose of this test (it should have been verified by testFitManyPoints()).
+         * For a random seed fixed to 7241997054993322309, the coefficients are:
+         *
+         *   - reference:     z(x,y) = -46.0⋅x + 17.0⋅y + 35.0
+         *   - fitted:        z(x,y) = -45.96034442769177⋅x + 16.981792790278828⋅y + 34.901440258861314
+         */
+        final Plane fitted = assertFitEquals(7, x, y, z);
+        assertEquals("sx", reference.slopeX(), fitted.slopeX(), 0.05);
+        assertEquals("sy", reference.slopeY(), fitted.slopeY(), 0.02);
+        assertEquals("z₀", reference.z0(),     fitted.z0(),     0.1);
+        final double ep = pearson;
+        /*
+         * Verify that the optimized code path for a grid produces the exact same result than the
+         * generic code path.
+         */
+        final Plane gf = new Plane();
+        gf.fit(nx, ny, Vector.create(z, false));
+        assertEquals("sx", fitted.slopeX(), gf.slopeX(), STRICT);
+        assertEquals("sy", fitted.slopeY(), gf.slopeY(), STRICT);
+        assertEquals("z₀", fitted.z0(),     gf.z0(),     STRICT);
+        assertEquals("Pearson", ep,         pearson,     STRICT);
     }
 
     /**

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/AngleFormatTest.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -17,6 +17,7 @@
 package org.apache.sis.measure;
 
 import java.util.Locale;
+import java.math.RoundingMode;
 import java.text.FieldPosition;
 import java.text.AttributedCharacterIterator;
 import java.text.ParseException;
@@ -34,7 +35,7 @@ import static org.apache.sis.test.TestUt
  *
  * @author  Martin Desruisseaux (MPO, IRD, Geomatys)
  * @since   0.3
- * @version 0.4
+ * @version 0.8
  * @module
  */
 @DependsOn({
@@ -223,6 +224,30 @@ public final strictfp class AngleFormatT
     }
 
     /**
+     * Tests formatting the same value with different rounding modes.
+     *
+     * @since 0.8
+     */
+    @Test
+    @DependsOnMethod("testDegreeMinutesSeconds")
+    public void testRoundingMode() {
+        final AngleFormat f = new AngleFormat("DD°MM′SS″", Locale.CANADA);
+        Angle angle = new Angle(12.515625);
+        f.setRoundingMode(RoundingMode.DOWN);      assertEquals("12°30′56″", f.format(angle));
+        f.setRoundingMode(RoundingMode.UP);        assertEquals("12°30′57″", f.format(angle));
+        f.setRoundingMode(RoundingMode.FLOOR);     assertEquals("12°30′56″", f.format(angle));
+        f.setRoundingMode(RoundingMode.CEILING);   assertEquals("12°30′57″", f.format(angle));
+        f.setRoundingMode(RoundingMode.HALF_EVEN); assertEquals("12°30′56″", f.format(angle));
+
+        angle = new Angle(-12.515625);
+        f.setRoundingMode(RoundingMode.DOWN);      assertEquals("-12°30′56″", f.format(angle));
+        f.setRoundingMode(RoundingMode.UP);        assertEquals("-12°30′57″", f.format(angle));
+        f.setRoundingMode(RoundingMode.FLOOR);     assertEquals("-12°30′57″", f.format(angle));
+        f.setRoundingMode(RoundingMode.CEILING);   assertEquals("-12°30′56″", f.format(angle));
+        f.setRoundingMode(RoundingMode.HALF_EVEN); assertEquals("-12°30′56″", f.format(angle));
+    }
+
+    /**
      * Tests with optional digits.
      */
     @Test

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/measure/UnitFormatTest.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -19,6 +19,7 @@ package org.apache.sis.measure;
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Locale;
+import java.text.ParsePosition;
 import java.lang.reflect.Field;
 import javax.measure.Unit;
 import javax.measure.format.ParserException;
@@ -281,6 +282,7 @@ public final strictfp class UnitFormatTe
             fail("Should not accept unknown unit.");
         } catch (ParserException e) {
             final String message = e.getMessage();
+            assertTrue(message, message.contains("degree"));
             assertTrue(message, message.contains("foo"));
         }
         // Tests with localisation.
@@ -289,7 +291,8 @@ public final strictfp class UnitFormatTe
             fail("Should not accept localized unit unless requested.");
         } catch (ParserException e) {
             final String message = e.getMessage();
-            assertTrue(message, message.contains("mètre cube"));
+            assertTrue(message, message.contains("mètre"));
+            assertTrue(message, message.contains("cube"));
         }
         f.setLocale(Locale.FRANCE);
         assertSame(Units.CUBIC_METRE, f.parse("mètre cube"));
@@ -395,6 +398,29 @@ public final strictfp class UnitFormatTe
     }
 
     /**
+     * Tests parsing a unit from another position than zero and verifies that {@code UnitFormat} detects
+     * correctly where the unit symbol ends.
+     */
+    @Test
+    @DependsOnMethod("testParseSymbol")
+    public void testParsePosition() {
+        final UnitFormat f = new UnitFormat(Locale.UK);
+        final ParsePosition pos = new ParsePosition(4);
+        assertSame(Units.CENTIMETRE, f.parse("ABC cm DEF", pos));
+        assertEquals("ParsePosition.getIndex()", 6, pos.getIndex());
+        assertEquals("ParsePosition.getErrorIndex()", -1, pos.getErrorIndex());
+        /*
+         * Adding "cm DEF" as a unit label should allow UnitFormat to recognize those characters.
+         * We associate a random unit to that label, just for testing purpose.
+         */
+        pos.setIndex(4);
+        f.label(Units.HECTARE, "cm DEF");
+        assertSame(Units.HECTARE, f.parse("ABC cm DEF", pos));
+        assertEquals("ParsePosition.getIndex()", 10, pos.getIndex());
+        assertEquals("ParsePosition.getErrorIndex()", -1, pos.getErrorIndex());
+    }
+
+    /**
      * Tests {@link UnitFormat#clone()}.
      */
     @Test

Modified: sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8] (original)
+++ sis/branches/JDK9/core/sis-utility/src/test/java/org/apache/sis/util/StringBuildersTest.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -80,6 +80,26 @@ public final strictfp class StringBuilde
     }
 
     /**
+     * Tests the {@link StringBuilders#repeat(StringBuilder, int, char, int)} method.
+     *
+     * @since 0.8
+     */
+    @Test
+    public void testRepeat() {
+        final StringBuilder buffer = new StringBuilder("AB12");
+        repeat(buffer, 2, 'C', 0);
+        assertEquals("AB12", buffer.toString());
+        repeat(buffer, 2, 'C', 1);
+        assertEquals("ABC12", buffer.toString());
+        repeat(buffer, 3, '0', 4);
+        assertEquals("ABC000012", buffer.toString());
+        repeat(buffer, 6, ' ', 2);
+        assertEquals("ABC000  012", buffer.toString());
+        repeat(buffer, 6, '.', 3);
+        assertEquals("ABC000...  012", buffer.toString());
+    }
+
+    /**
      * Tests the {@link StringBuilders#trimFractionalPart(StringBuilder)} method.
      */
     @Test

Modified: sis/branches/JDK9/ide-project/NetBeans/build.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/build.xml?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/build.xml (original)
+++ sis/branches/JDK9/ide-project/NetBeans/build.xml Fri Mar 31 18:49:16 2017
@@ -39,6 +39,9 @@
       <fileset dir="${project.root}/core/sis-referencing/target/generated-resources">
         <include name="**/*.utf"/>
       </fileset>
+      <fileset dir="${project.root}/core/sis-referencing-by-identifiers/target/generated-resources">
+        <include name="**/*.utf"/>
+      </fileset>
       <fileset dir="${project.root}/core/sis-feature/target/generated-resources">
         <include name="**/*.utf"/>
       </fileset>

Modified: sis/branches/JDK9/ide-project/NetBeans/nbproject/build-impl.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/nbproject/build-impl.xml?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/nbproject/build-impl.xml (original)
+++ sis/branches/JDK9/ide-project/NetBeans/nbproject/build-impl.xml Fri Mar 31 18:49:16 2017
@@ -132,6 +132,7 @@ is divided into following sections:
                 <available file="${test.storage.dir}"/>
                 <available file="${test.feature.dir}"/>
                 <available file="${test.referencing.dir}"/>
+                <available file="${test.ref-by-id.dir}"/>
                 <available file="${test.metadata.dir}"/>
                 <available file="${test.utility.dir}"/>
                 <available file="${test.fra-profile.dir}"/>
@@ -150,6 +151,7 @@ is divided into following sections:
                 <available file="${src.storage.dir}"/>
                 <available file="${src.feature.dir}"/>
                 <available file="${src.referencing.dir}"/>
+                <available file="${src.ref-by-id.dir}"/>
                 <available file="${src.metadata.dir}"/>
                 <available file="${src.utility.dir}"/>
                 <available file="${src.fra-profile.dir}"/>
@@ -266,6 +268,7 @@ is divided into following sections:
         <fail unless="src.storage.dir">Must set src.storage.dir</fail>
         <fail unless="src.feature.dir">Must set src.feature.dir</fail>
         <fail unless="src.referencing.dir">Must set src.referencing.dir</fail>
+        <fail unless="src.ref-by-id.dir">Must set src.ref-by-id.dir</fail>
         <fail unless="src.metadata.dir">Must set src.metadata.dir</fail>
         <fail unless="src.utility.dir">Must set src.utility.dir</fail>
         <fail unless="src.fra-profile.dir">Must set src.fra-profile.dir</fail>
@@ -279,6 +282,7 @@ is divided into following sections:
         <fail unless="test.storage.dir">Must set test.storage.dir</fail>
         <fail unless="test.feature.dir">Must set test.feature.dir</fail>
         <fail unless="test.referencing.dir">Must set test.referencing.dir</fail>
+        <fail unless="test.ref-by-id.dir">Must set test.ref-by-id.dir</fail>
         <fail unless="test.metadata.dir">Must set test.metadata.dir</fail>
         <fail unless="test.utility.dir">Must set test.utility.dir</fail>
         <fail unless="test.fra-profile.dir">Must set test.fra-profile.dir</fail>
@@ -302,7 +306,7 @@ is divided into following sections:
     </target>
     <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+            <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <attribute default="${javac.processorpath}" name="processorpath"/>
@@ -343,7 +347,7 @@ is divided into following sections:
     </target>
     <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
         <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+            <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <attribute default="${javac.processorpath}" name="processorpath"/>
@@ -376,7 +380,7 @@ is divided into following sections:
     </target>
     <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
         <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3">
-            <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
+            <attribute default="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}" name="srcdir"/>
             <attribute default="${build.classes.dir}" name="destdir"/>
             <attribute default="${javac.classpath}" name="classpath"/>
             <sequential>
@@ -493,6 +497,9 @@ is divided into following sections:
                         <fileset dir="${test.referencing.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                             <filename name="@{testincludes}"/>
                         </fileset>
+                        <fileset dir="${test.ref-by-id.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+                            <filename name="@{testincludes}"/>
+                        </fileset>
                         <fileset dir="${test.metadata.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                             <filename name="@{testincludes}"/>
                         </fileset>
@@ -561,6 +568,9 @@ is divided into following sections:
                     <fileset dir="${test.referencing.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
                         <filename name="@{testincludes}"/>
                     </fileset>
+                    <fileset dir="${test.ref-by-id.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
+                        <filename name="@{testincludes}"/>
+                    </fileset>
                     <fileset dir="${test.metadata.dir}" excludes="@{excludes},**/*.xml,${excludes}" includes="@{includes}">
                         <filename name="@{testincludes}"/>
                     </fileset>
@@ -709,6 +719,9 @@ is divided into following sections:
                         <fileset dir="${test.referencing.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                             <filename name="@{testincludes}"/>
                         </fileset>
+                        <fileset dir="${test.ref-by-id.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
+                            <filename name="@{testincludes}"/>
+                        </fileset>
                         <fileset dir="${test.metadata.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                             <filename name="@{testincludes}"/>
                         </fileset>
@@ -1090,7 +1103,7 @@ is divided into following sections:
                 <include name="*"/>
             </dirset>
         </pathconvert>
-        <j2seproject3:depend srcdir="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${build.generated.subdirs}"/>
+        <j2seproject3:depend srcdir="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}:${build.generated.subdirs}"/>
     </target>
     <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile">
         <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>
@@ -1106,6 +1119,7 @@ is divided into following sections:
             <fileset dir="${src.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+            <fileset dir="${src.ref-by-id.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.metadata.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.utility.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${src.fra-profile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1129,7 +1143,7 @@ is divided into following sections:
     <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
         <j2seproject3:force-recompile/>
-        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}"/>
+        <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.local-src.dir}:${src.webapp.dir}:${src.console.dir}:${src.earth-obs.dir}:${src.geotiff.dir}:${src.netcdf.dir}:${src.shapefile.dir}:${src.xmlstore.dir}:${src.storage.dir}:${src.feature.dir}:${src.referencing.dir}:${src.ref-by-id.dir}:${src.metadata.dir}:${src.utility.dir}:${src.fra-profile.dir}"/>
     </target>
     <target name="-post-compile-single">
         <!-- Empty placeholder for easier customization. -->
@@ -1428,6 +1442,9 @@ is divided into following sections:
             <fileset dir="${src.referencing.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
                 <filename name="**/*.java"/>
             </fileset>
+            <fileset dir="${src.ref-by-id.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
+                <filename name="**/*.java"/>
+            </fileset>
             <fileset dir="${src.metadata.dir}" excludes="${bug5101868workaround},${excludes}" includes="${includes}">
                 <filename name="**/*.java"/>
             </fileset>
@@ -1477,6 +1494,9 @@ is divided into following sections:
             <fileset dir="${src.referencing.dir}" excludes="${excludes}" includes="${includes}">
                 <filename name="**/doc-files/**"/>
             </fileset>
+            <fileset dir="${src.ref-by-id.dir}" excludes="${excludes}" includes="${includes}">
+                <filename name="**/doc-files/**"/>
+            </fileset>
             <fileset dir="${src.metadata.dir}" excludes="${excludes}" includes="${includes}">
                 <filename name="**/doc-files/**"/>
             </fileset>
@@ -1508,10 +1528,10 @@ is divided into following sections:
         <!-- You can override this target in the ../build.xml file. -->
     </target>
     <target if="do.depend.true" name="-compile-test-depend">
-        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+        <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
     </target>
     <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test">
-        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
         <copy todir="${build.test.classes.dir}">
             <fileset dir="${test.webapp.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.console.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1523,6 +1543,7 @@ is divided into following sections:
             <fileset dir="${test.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+            <fileset dir="${test.ref-by-id.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.metadata.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.utility.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.fra-profile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1540,7 +1561,7 @@ is divided into following sections:
     <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
         <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
         <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/>
-        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
+        <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}" srcdir="${test.webapp.dir}:${test.console.dir}:${test.earth-obs.dir}:${test.geotiff.dir}:${test.netcdf.dir}:${test.shapefile.dir}:${test.xmlstore.dir}:${test.storage.dir}:${test.feature.dir}:${test.referencing.dir}:${test.ref-by-id.dir}:${test.metadata.dir}:${test.utility.dir}:${test.fra-profile.dir}"/>
         <copy todir="${build.test.classes.dir}">
             <fileset dir="${test.webapp.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.console.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
@@ -1552,6 +1573,7 @@ is divided into following sections:
             <fileset dir="${test.storage.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.feature.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.referencing.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
+            <fileset dir="${test.ref-by-id.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.metadata.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.utility.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
             <fileset dir="${test.fra-profile.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>

Modified: sis/branches/JDK9/ide-project/NetBeans/nbproject/genfiles.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/nbproject/genfiles.properties?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/ide-project/NetBeans/nbproject/genfiles.properties [ISO-8859-1] Fri Mar 31 18:49:16 2017
@@ -3,6 +3,6 @@
 build.xml.data.CRC32=58e6b21c
 build.xml.script.CRC32=462eaba0
 build.xml.stylesheet.CRC32=28e38971@1.53.1.46
-nbproject/build-impl.xml.data.CRC32=e05ef219
-nbproject/build-impl.xml.script.CRC32=95bc5c9a
+nbproject/build-impl.xml.data.CRC32=2b076fc2
+nbproject/build-impl.xml.script.CRC32=254cb1ce
 nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48

Modified: sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/ide-project/NetBeans/nbproject/project.properties [ISO-8859-1] Fri Mar 31 18:49:16 2017
@@ -66,6 +66,8 @@ src.feature.dir      = ${project.root}/c
 test.feature.dir     = ${project.root}/core/sis-feature/src/test/java
 src.referencing.dir  = ${project.root}/core/sis-referencing/src/main/java
 test.referencing.dir = ${project.root}/core/sis-referencing/src/test/java
+src.ref-by-id.dir    = ${project.root}/core/sis-referencing-by-identifiers/src/main/java
+test.ref-by-id.dir   = ${project.root}/core/sis-referencing-by-identifiers/src/test/java
 src.metadata.dir     = ${project.root}/core/sis-metadata/src/main/java
 test.metadata.dir    = ${project.root}/core/sis-metadata/src/test/java
 src.utility.dir      = ${project.root}/core/sis-utility/src/main/java
@@ -94,15 +96,17 @@ jdom1.version        = 1.0
 jdom2.version        = 2.0.4
 jee.version          = 7.0
 osgi.version         = 6.0.0
-netcdf.version       = 4.6.6
-joda-time.version    = 2.2
-httpclient.version   = 4.3.6
+netcdf.version       = 4.6.8
+joda-time.version    = 2.8.1
+httpclient.version   = 4.5.1
+httpcore.version     = 4.4.4
+cm-logging.version   = 1.2
 slf4j.version        = 1.7.7
 junit.version        = 4.12
 hamcrest.version     = 1.3
 jaxb-ns-mapper       = 2.2.4
 hsqldb.version       = 2.3.4
-postgresql.version   = 9.4.1212.jre7
+postgresql.version   = 42.0.0
 
 #
 # Classpaths for compilation, execution and tests.
@@ -147,6 +151,8 @@ run.test.classpath=\
     ${maven.repository}/edu/ucar/udunits/${netcdf.version}/udunits-${netcdf.version}.jar:\
     ${maven.repository}/edu/ucar/httpservices/${netcdf.version}/httpservices-${netcdf.version}.jar:\
     ${maven.repository}/joda-time/joda-time/${joda-time.version}/joda-time-${joda-time.version}.jar:\
+    ${maven.repository}/commons-logging/commons-logging/${cm-logging.version}/commons-logging-${cm-logging.version}.jar:\
+    ${maven.repository}/org/apache/httpcomponents/httpcore/${httpcore.version}/httpcore-${httpcore.version}.jar:\
     ${maven.repository}/org/apache/httpcomponents/httpclient/${httpclient.version}/httpclient-${httpclient.version}.jar:\
     ${maven.repository}/org/slf4j/slf4j-api/${slf4j.version}/slf4j-api-${slf4j.version}.jar:\
     ${maven.repository}/org/slf4j/slf4j-jdk14/${slf4j.version}/slf4j-jdk14-${slf4j.version}.jar

Modified: sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml (original)
+++ sis/branches/JDK9/ide-project/NetBeans/nbproject/project.xml Fri Mar 31 18:49:16 2017
@@ -34,6 +34,7 @@
                 <root id="src.storage.dir" name="Storage"/>
                 <root id="src.feature.dir" name="Feature"/>
                 <root id="src.referencing.dir" name="Referencing"/>
+                <root id="src.ref-by-id.dir" name="Referencing by identifiers"/>
                 <root id="src.metadata.dir" name="Metadata"/>
                 <root id="src.utility.dir" name="Utility"/>
                 <root id="src.fra-profile.dir" name="French profile"/>
@@ -49,6 +50,7 @@
                 <root id="test.storage.dir" name="Test Storage"/>
                 <root id="test.feature.dir" name="Test Feature"/>
                 <root id="test.referencing.dir" name="Test Referencing"/>
+                <root id="test.ref-by-id.dir" name="Test Referencing by identifiers"/>
                 <root id="test.metadata.dir" name="Test Metadata"/>
                 <root id="test.utility.dir" name="Test Utility"/>
                 <root id="test.fra-profile.dir" name="Test French profile"/>

Modified: sis/branches/JDK9/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/pom.xml?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/pom.xml (original)
+++ sis/branches/JDK9/pom.xml Fri Mar 31 18:49:16 2017
@@ -429,7 +429,7 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.apache.commons</groupId>
         <artifactId>commons-compress</artifactId>
-        <version>1.12</version>
+        <version>1.13</version>
       </dependency>
 
       <!-- Databases -->
@@ -442,7 +442,7 @@ Apache SIS is a free software, Java lang
       <dependency>
         <groupId>org.postgresql</groupId>
         <artifactId>postgresql</artifactId>
-        <version>9.4.1212.jre7</version>
+        <version>42.0.0</version>
         <scope>test</scope>
       </dependency>
 
@@ -488,7 +488,7 @@ Apache SIS is a free software, Java lang
          The last properties in this list depend on the Apache SIS branch.
        =================================================================== -->
   <properties>
-    <netcdf.version>4.6.6</netcdf.version>
+    <netcdf.version>4.6.8</netcdf.version>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <website.encoding>UTF-8</website.encoding>
     <website.locale>en</website.locale>
@@ -630,7 +630,7 @@ Apache SIS is a free software, Java lang
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
-        <version>3.2.0</version>
+        <version>3.3.0</version>
         <extensions>true</extensions>
         <configuration>
           <excludeDependencies>true</excludeDependencies>
@@ -797,12 +797,12 @@ Apache SIS is a free software, Java lang
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>build-helper-maven-plugin</artifactId>
-          <version>1.12</version>
+          <version>3.0.0</version>
         </plugin>
         <plugin>
           <groupId>org.eclipse.jetty</groupId>
           <artifactId>jetty-maven-plugin</artifactId>
-          <version>9.4.0.v20161208</version>
+          <version>9.4.3.v20170317</version>
         </plugin>
       </plugins>
     </pluginManagement>

Modified: sis/branches/JDK9/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java [UTF-8] (original)
+++ sis/branches/JDK9/profiles/sis-french-profile/src/main/java/org/apache/sis/internal/profile/fra/ProfileTypes.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -26,7 +26,7 @@ import org.apache.sis.internal.jaxb.Type
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.8
  * @module
  */
 public final class ProfileTypes extends TypeRegistration {
@@ -34,7 +34,7 @@ public final class ProfileTypes extends
      * Adds to the given collection the metadata types that should be given to the initial JAXB context.
      */
     @Override
-    public void getTypes(final Collection<Class<?>> addTo) {
+    protected void getTypes(final Collection<Class<?>> addTo) {
         addTo.add(DataIdentification.class);
         addTo.add(DirectReferenceSystem.class);
         addTo.add(IndirectReferenceSystem.class);

Modified: sis/branches/JDK9/src/main/javadoc/stylesheet.css
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/src/main/javadoc/stylesheet.css?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/src/main/javadoc/stylesheet.css (original)
+++ sis/branches/JDK9/src/main/javadoc/stylesheet.css Fri Mar 31 18:49:16 2017
@@ -168,7 +168,7 @@ div.description div.section {
 
 /*
  * Bullet and ordered lists. Put some space before and after the list.
- * Listes of the "verbose" class also have some space betweem items.
+ * Lists of the "verbose" class also have some space betweem items.
  */
 div.block ul,
 div.block ol {

Modified: sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -904,7 +904,7 @@ final class LandsatReader {
          */
         if (datum != null) {
             if (utmZone > 0) {
-                metadata.add(datum.UTM(1, TransverseMercator.centralMeridian(utmZone)));
+                metadata.add(datum.universal(1, TransverseMercator.Zoner.UTM.centralMeridian(utmZone)));
             }
             if (projection != null) {
                 final double sp = projection.parameter(Constants.STANDARD_PARALLEL_1).doubleValue();

Modified: sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-earth-observation/src/test/java/org/apache/sis/storage/earthobservation/LandsatReaderTest.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -295,27 +295,27 @@ public class LandsatReaderTest extends T
                 + "  │   └─Code…………………………………………………………………………………………… LandsatTest\n"
                 + "  ├─Metadata standard (1 of 2)\n"
                 + "  │   ├─Title………………………………………………………………………………………… Geographic Information — Metadata Part 1: Fundamentals\n"
-                + "  │   ├─Cited responsible party\n"
-                + "  │   │   ├─Party\n"
-                + "  │   │   │   └─Name……………………………………………………………………… International Organization for Standardization\n"
-                + "  │   │   └─Role………………………………………………………………………………… Principal investigator\n"
                 + "  │   ├─Edition…………………………………………………………………………………… ISO 19115-1:2014(E)\n"
                 + "  │   ├─Identifier\n"
                 + "  │   │   ├─Code………………………………………………………………………………… 19115-1\n"
                 + "  │   │   ├─Code space………………………………………………………………… ISO\n"
                 + "  │   │   └─Version………………………………………………………………………… 2014(E)\n"
+                + "  │   ├─Cited responsible party\n"
+                + "  │   │   ├─Party\n"
+                + "  │   │   │   └─Name……………………………………………………………………… International Organization for Standardization\n"
+                + "  │   │   └─Role………………………………………………………………………………… Principal investigator\n"
                 + "  │   └─Presentation form………………………………………………………… Document digital\n"
                 + "  └─Metadata standard (2 of 2)\n"
                 + "      ├─Title………………………………………………………………………………………… Geographic Information — Metadata Part 2: Extensions for imagery and gridded data\n"
-                + "      ├─Cited responsible party\n"
-                + "      │   ├─Party\n"
-                + "      │   │   └─Name……………………………………………………………………… International Organization for Standardization\n"
-                + "      │   └─Role………………………………………………………………………………… Principal investigator\n"
                 + "      ├─Edition…………………………………………………………………………………… ISO 19115-2:2009(E)\n"
                 + "      ├─Identifier\n"
                 + "      │   ├─Code………………………………………………………………………………… 19115-2\n"
                 + "      │   ├─Code space………………………………………………………………… ISO\n"
                 + "      │   └─Version………………………………………………………………………… 2009(E)\n"
+                + "      ├─Cited responsible party\n"
+                + "      │   ├─Party\n"
+                + "      │   │   └─Name……………………………………………………………………… International Organization for Standardization\n"
+                + "      │   └─Role………………………………………………………………………………… Principal investigator\n"
                 + "      └─Presentation form………………………………………………………… Document digital\n", text);
     }
 }

Modified: sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/GeoTiffStore.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -43,6 +43,7 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Rémi Maréchal (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
+ * @author  Thi Phuong Hao Nguyen (VNSC)
  * @since   0.8
  * @version 0.8
  * @module

Modified: sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/ImageFileDirectory.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -43,6 +43,7 @@ import org.apache.sis.measure.Units;
  * @author  Rémi Marechal (Geomatys)
  * @author  Alexis Manin (Geomatys)
  * @author  Johann Sorel (Geomatys)
+ * @author  Thi Phuong Hao Nguyen (VNSC)
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.8
  * @version 0.8

Modified: sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -59,6 +59,11 @@ public final class Resources extends Ind
         }
 
         /**
+         * Can not use UCAR library for NetCDF format. Fallback on Apache SIS implementation.
+         */
+        public static final short CanNotUseUCAR = 4;
+
+        /**
          * Dimension “{2}” declared by attribute “{1}” is not found in the “{0}” file.
          */
         public static final short DimensionNotFound_3 = 1;

Modified: sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources.properties [ISO-8859-1] Fri Mar 31 18:49:16 2017
@@ -19,6 +19,7 @@
 # Resources in this file are for "sis-netcdf" usage only and should not be used by any other module.
 # For resources shared by all modules in the Apache SIS project, see "org.apache.sis.util.resources" package.
 #
+CanNotUseUCAR                     = Can not use UCAR library for NetCDF format. Fallback on Apache SIS implementation.
 DimensionNotFound_3               = Dimension \u201c{2}\u201d declared by attribute \u201c{1}\u201d is not found in the \u201c{0}\u201d file.
 UnexpectedDimensionForVariable_4  = Variable \u201c{1}\u201d in file \u201c{0}\u201d has a dimension \u201c{3}\u201d while we expected \u201c{2}\u201d.
 VariableNotFound_2                = Variable \u201c{1}\u201d is not found in the \u201c{0}\u201d file.

Modified: sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties [ISO-8859-1] (original)
+++ sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Resources_fr.properties [ISO-8859-1] Fri Mar 31 18:49:16 2017
@@ -24,6 +24,7 @@
 #   U+202F NARROW NO-BREAK SPACE  before  ; ! and ?
 #   U+00A0 NO-BREAK SPACE         before  :
 #
+CanNotUseUCAR                     = Ne peut pas utiliser la biblioth\u00e8que de l\u2019UCAR pour le format NetCDF. L\u2019impl\u00e9mentation de Apache SIS sera utilis\u00e9e \u00e0 la place.
 DimensionNotFound_3               = La dimension \u00ab\u202f{2}\u202f\u00bb d\u00e9clar\u00e9e par l\u2019attribut \u00ab\u202f{1}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9e dans le fichier \u00ab\u202f{0}\u202f\u00bb.
 UnexpectedDimensionForVariable_4  = La variable \u00ab\u202f{1}\u202f\u00bb dans le fichier \u00ab\u202f{0}\u202f\u00bb a une dimension \u00ab\u202f{3}\u202f\u00bb alors qu\u2019on attendait \u00ab\u202f{2}\u202f\u00bb.
 VariableNotFound_2                = La variable \u00ab\u202f{1}\u202f\u00bb n\u2019a pas \u00e9t\u00e9 trouv\u00e9e dans le fichier \u00ab\u202f{0}\u202f\u00bb.

Modified: sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-netcdf/src/main/java/org/apache/sis/storage/netcdf/NetcdfStoreProvider.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.storage.netcdf;
 
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.nio.ByteBuffer;
@@ -25,6 +27,7 @@ import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.UndeclaredThrowableException;
 import org.apache.sis.internal.netcdf.Decoder;
+import org.apache.sis.internal.netcdf.Resources;
 import org.apache.sis.internal.netcdf.impl.ChannelDecoder;
 import org.apache.sis.internal.netcdf.ucar.DecoderWrapper;
 import org.apache.sis.internal.storage.io.ChannelDataInput;
@@ -136,7 +139,7 @@ public class NetcdfStoreProvider extends
      * @throws DataStoreException if an I/O error occurred.
      */
     @Override
-    public ProbeResult probeContent(StorageConnector connector) throws DataStoreException {
+    public ProbeResult probeContent(final StorageConnector connector) throws DataStoreException {
         int     version     = 0;
         boolean hasVersion  = false;
         boolean isSupported = false;
@@ -164,7 +167,7 @@ public class NetcdfStoreProvider extends
         if (!isSupported) {
             final String path = connector.getStorageAs(String.class);
             if (path != null) {
-                ensureInitialized();
+                ensureInitialized(false);
                 final Method method = canOpenFromPath;
                 if (method != null) try {
                     isSupported = (Boolean) method.invoke(null, path);
@@ -275,7 +278,7 @@ public class NetcdfStoreProvider extends
     private static Decoder createByReflection(final WarningListeners<?> listeners, final Object input, final boolean isUCAR)
             throws IOException, DataStoreException
     {
-        ensureInitialized();
+        ensureInitialized(true);
         /*
          * Get the appropriate constructor for the isUCAR argument. This constructor will be null
          * if the above code failed to load the UCAR library. Otherwise, instantiate the wrapper.
@@ -300,17 +303,23 @@ public class NetcdfStoreProvider extends
             if (cause instanceof DataStoreException) throw (DataStoreException) cause;
             if (cause instanceof RuntimeException)   throw (RuntimeException)   cause;
             if (cause instanceof Error)              throw (Error)              cause;
-            throw new UndeclaredThrowableException(cause); // Should never happen actually.
+            throw new UndeclaredThrowableException(cause);  // Should never happen actually.
         } catch (ReflectiveOperationException e) {
-            throw new AssertionError(e); // Should never happen (shall be verified by the JUnit tests).
+            throw new AssertionError(e);                    // Should never happen (shall be verified by the JUnit tests).
         }
     }
 
     /**
      * Gets the {@link java.lang.Class} that represent the {@link ucar.nc2.NetcdfFile type}.
+     *
+     * @param  open  {@code true} if this method is invoked (indirectly) from the {@link #open(StorageConnector)}
+     *               method, or {@code false} if invoked from the {@link #probeContent(StorageConnector)} method.
+     *               This is used only for logging message.
      */
-    private static void ensureInitialized() {
+    private static void ensureInitialized(final boolean open) {
         if (netcdfFileClass == null) {
+            Level  severity = null;                             // Logging level to use in case of failure.
+            Throwable cause = null;                             // Cause of the failure (may stay null).
             synchronized (NetcdfStoreProvider.class) {
                 /*
                  * No double-check because it is not a big deal if the constructors are fetched twice.
@@ -318,29 +327,50 @@ public class NetcdfStoreProvider extends
                  */
                 try {
                     netcdfFileClass = Class.forName(UCAR_CLASSNAME);
+                    canOpenFromPath = netcdfFileClass.getMethod("canOpen", String.class);
+                    if (canOpenFromPath.getReturnType() == Boolean.TYPE) {
+                        /*
+                         * At this point we found the class and method from UCAR API. Now get the Apache SIS wrapper
+                         * using reflection for avoiding "hard" dependency from this provider to the UCAR library.
+                         */
+                        final Class<? extends Decoder> wrapper =
+                                Class.forName("org.apache.sis.internal.netcdf.ucar.DecoderWrapper").asSubclass(Decoder.class);
+                        final Class<?>[] parameterTypes = new Class<?>[] {WarningListeners.class, netcdfFileClass};
+                        createFromUCAR = wrapper.getConstructor(parameterTypes);
+                        parameterTypes[1] = String.class;
+                        createFromPath = wrapper.getConstructor(parameterTypes);
+                        return;                                                                         // Success
+                    }
                 } catch (ClassNotFoundException e) {
-                    netcdfFileClass = Void.TYPE;
-                    return;
-                }
-                try {
                     /*
-                     * UCAR API.
+                     * Happen if the UCAR library is not on the classpath. Log at the configuration level without
+                     * reporting the exception (for avoiding scaring logs) because this is a typical use case.
                      */
-                    canOpenFromPath = netcdfFileClass.getMethod("canOpen", String.class);
-                    assert canOpenFromPath.getReturnType() == Boolean.TYPE;
+                    severity = Level.CONFIG;
+                } catch (NoClassDefFoundError | ReflectiveOperationException e) {
                     /*
-                     * SIS Wrapper API.
+                     * NoClassDefFoundError may happen if the UCAR class has been found but one of its dependencies
+                     * is missing (for example SLF4J). Log at the warning level because the user probably wanted to
+                     * use the UCAR library.
+                     *
+                     * ReflectiveOperationException should never happen because API compatibility shall be verified
+                     * by the JUnit tests. If it happen anyway  (for example because the user puts on his classpath
+                     * a different version of the NetCDF library than the one we tested), report a warning.
                      */
-                    final Class<? extends Decoder> wrapper =
-                            Class.forName("org.apache.sis.internal.netcdf.ucar.DecoderWrapper").asSubclass(Decoder.class);
-                    final Class<?>[] parameterTypes = new Class<?>[] {WarningListeners.class, netcdfFileClass};
-                    createFromUCAR = wrapper.getConstructor(parameterTypes);
-                    parameterTypes[1] = String.class;
-                    createFromPath = wrapper.getConstructor(parameterTypes);
-                } catch (ReflectiveOperationException e) {
-                    throw new AssertionError(e);        // Should never happen (shall be verified by the JUnit tests).
+                    severity = Level.WARNING;
+                    cause = e;
                 }
+                /*
+                 * At this point we failed to use the UCAR library. Remember that failure while we are still in the
+                 * synchronized block, then log a message outside the synchronized block.
+                 */
+                reset();
+                netcdfFileClass = Void.TYPE;
             }
+            final LogRecord record = Resources.forLocale(null).getLogRecord(severity, Resources.Keys.CanNotUseUCAR);
+            record.setThrown(cause);
+            record.setLoggerName(Modules.NETCDF);
+            Logging.log(NetcdfStoreProvider.class, open ? "open" : "probeContent", record);
         }
     }
 

Modified: sis/branches/JDK9/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-netcdf/src/test/java/org/apache/sis/storage/netcdf/MetadataReaderTest.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -158,27 +158,27 @@ public final strictfp class MetadataRead
             "  │   └─Code…………………………………………………………………………………………… NCEP/SST/Global_5x2p5deg/SST_Global_5x2p5deg_20050922_0000.nc\n" +
             "  ├─Metadata standard (1 of 2)\n" +
             "  │   ├─Title………………………………………………………………………………………… Geographic Information — Metadata Part 1: Fundamentals\n" +
-            "  │   ├─Cited responsible party\n" +
-            "  │   │   ├─Party\n" +
-            "  │   │   │   └─Name……………………………………………………………………… International Organization for Standardization\n" +
-            "  │   │   └─Role………………………………………………………………………………… Principal investigator\n" +
             "  │   ├─Edition…………………………………………………………………………………… ISO 19115-1:2014(E)\n" +
             "  │   ├─Identifier\n" +
             "  │   │   ├─Code………………………………………………………………………………… 19115-1\n" +
             "  │   │   ├─Code space………………………………………………………………… ISO\n" +
             "  │   │   └─Version………………………………………………………………………… 2014(E)\n" +
+            "  │   ├─Cited responsible party\n" +
+            "  │   │   ├─Party\n" +
+            "  │   │   │   └─Name……………………………………………………………………… International Organization for Standardization\n" +
+            "  │   │   └─Role………………………………………………………………………………… Principal investigator\n" +
             "  │   └─Presentation form………………………………………………………… Document digital\n" +
             "  └─Metadata standard (2 of 2)\n" +
             "      ├─Title………………………………………………………………………………………… Geographic Information — Metadata Part 2: Extensions for imagery and gridded data\n" +
-            "      ├─Cited responsible party\n" +
-            "      │   ├─Party\n" +
-            "      │   │   └─Name……………………………………………………………………… International Organization for Standardization\n" +
-            "      │   └─Role………………………………………………………………………………… Principal investigator\n" +
             "      ├─Edition…………………………………………………………………………………… ISO 19115-2:2009(E)\n" +
             "      ├─Identifier\n" +
             "      │   ├─Code………………………………………………………………………………… 19115-2\n" +
             "      │   ├─Code space………………………………………………………………… ISO\n" +
             "      │   └─Version………………………………………………………………………… 2009(E)\n" +
+            "      ├─Cited responsible party\n" +
+            "      │   ├─Party\n" +
+            "      │   │   └─Name……………………………………………………………………… International Organization for Standardization\n" +
+            "      │   └─Role………………………………………………………………………………… Principal investigator\n" +
             "      └─Presentation form………………………………………………………… Document digital\n", text);
     }
 }

Modified: sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/index/GeoHashCoder.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -19,7 +19,9 @@ package org.apache.sis.index;
 import java.io.Serializable;
 import java.text.ParseException;
 import org.opengis.geometry.DirectPosition;
+import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.apache.sis.geometry.DirectPosition2D;
+import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.resources.Errors;
 
@@ -32,11 +34,15 @@ import org.apache.sis.util.resources.Err
  *
  * @author  Chris Mattmann (JPL)
  * @since   0.1
- * @version 0.3
+ * @version 0.8
  * @module
  *
  * @see <a href="http://en.wikipedia.org/wiki/Geohash">Wikipedia: Geohash</a>
+ *
+ * @deprecated Moved to {@link org.apache.sis.referencing.gazetteer.GeohashReferenceSystem}.
+ *             Note that axis order of {@code encode(double, double)} method differs.
  */
+@Deprecated
 public class GeoHashCoder implements Serializable {
     /**
      * For cross-version compatibility.
@@ -45,7 +51,10 @@ public class GeoHashCoder implements Ser
 
     /**
      * The encoding format used by {@link GeoHashCoder}.
+     *
+     * @deprecated Moved to {@link org.apache.sis.referencing.gazetteer.GeohashReferenceSystem.Format}.
      */
+    @Deprecated
     public static enum Format {
         /**
          * Format consisting of 32 symbols used at {@code http://geohash.org}. This encoding uses digits 0 to 9,
@@ -124,11 +133,18 @@ public class GeoHashCoder implements Ser
     private transient char[] buffer;
 
     /**
+     * The coordinate reference system to assign to the decoded direct positions,
+     * or {@code null} if none.
+     */
+    private final CoordinateReferenceSystem crs;
+
+    /**
      * Creates a new geohash coder/decoder initialized to the default precision for {@link Format#BASE32}.
      */
     public GeoHashCoder() {
         format = Format.BASE32;
         precision = 12;
+        crs = CommonCRS.defaultGeographic();
     }
 
     /**
@@ -164,7 +180,7 @@ public class GeoHashCoder implements Ser
     /**
      * Sets the length of geohashes strings to be encoded by the {@link #encode(DirectPosition)} method.
      *
-     * @param  precision  he new length of geohashes strings.
+     * @param  precision  the new length of geohashes strings.
      */
     public void setPrecision(final int precision) {
         ArgumentChecks.ensureBetween("precision", 1, 255, precision);
@@ -250,7 +266,7 @@ public class GeoHashCoder implements Ser
     /**
      * Decodes the given geohash into a longitude and a latitude.
      *
-     * @param geohash Geohash string to decode.
+     * @param  geohash  geohash string to decode.
      * @return a new position with the longitude at ordinate 0 and latitude at ordinate 1.
      * @throws ParseException if an error occurred while parsing the given string.
      */
@@ -307,7 +323,7 @@ public class GeoHashCoder implements Ser
                 isEven = !isEven;
             } while ((mask >>>= 1) != 0);
         }
-        return new DirectPosition2D((xmin + xmax) / 2,
-                                    (ymin + ymax) / 2);
+        return new DirectPosition2D(crs, (xmin + xmax) / 2,
+                                         (ymin + ymax) / 2);
     }
 }

Modified: sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java?rev=1789729&r1=1789728&r2=1789729&view=diff
==============================================================================
--- sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java [UTF-8] (original)
+++ sis/branches/JDK9/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/FeatureStore.java [UTF-8] Fri Mar 31 18:49:16 2017
@@ -84,6 +84,8 @@ public abstract class FeatureStore exten
      *
      * @return a stream over all features in the data store.
      * @throws DataStoreException if an error occurred while creating the feature stream.
+     *
+     * @todo a future version of this method will take some kind of {@code Query} or {@code Filter} argument.
      */
-    public abstract Stream<Feature> getFeatures() throws DataStoreException;
+    public abstract Stream<Feature> features() throws DataStoreException;
 }



Mime
View raw message