sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1731686 [4/5] - in /sis/branches/JDK6: ./ core/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ core/sis-metadata/src/main/java/org/apache/sis/io/wkt/ ...
Date Mon, 22 Feb 2016 16:56:42 GMT
Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -63,6 +63,7 @@ import org.apache.sis.referencing.factor
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.Ignore;
+import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.apache.sis.test.TestCase;
@@ -117,7 +118,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Force releases of JDBC connections after the tests in this class.
+     * Forces release of JDBC connections after the tests in this class.
      *
      * @throws FactoryException if an error occurred while closing the connections.
      */
@@ -130,29 +131,19 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Words that we expect to find in each log messages to be emitted.
+     * A JUnit {@link Rule} for listening to log events. This field is public because JUnit requires us to
+     * do so, but should be considered as an implementation details (it should have been a private field).
      */
-    private String[][] expectedLogWords;
+    @Rule
+    public final LoggingWatcher loggings = new LoggingWatcher(Loggers.CRS_FACTORY);
 
     /**
-     * A JUnit {@linkplain Rule rule} for listening to log events. This field is public
-     * because JUnit requires us to do so, but should be considered as an implementation
-     * details (it should have been a private field).
+     * Verifies that no unexpected warning has been emitted in any test defined in this class.
      */
-    @Rule
-    public final LoggingWatcher listener = new LoggingWatcher(Logging.getLogger(Loggers.CRS_FACTORY)) {
-        /**
-         * Ensures that the logging message contains some expected words.
-         */
-        @Override
-        protected void verifyMessage(final String message) {
-            if (expectedLogWords != null) {
-                for (final String word : expectedLogWords[expectedLogWords.length - (maximumLogCount + 1)]) {
-                    assertTrue(message, message.contains(word));
-                }
-            }
-        }
-    };
+    @After
+    public void assertNoUnexpectedLog() {
+        loggings.assertNoUnexpectedLog();
+    }
 
     /**
      * Tests {@link EPSGDataAccess#tableMatches(String, String)}.
@@ -164,7 +155,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests the "WGS 84" geographic CRS (EPSG::4326).
+     * Tests the "WGS 84" geographic CRS (EPSG:4326).
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
@@ -174,16 +165,17 @@ public final strictfp class EPSGFactoryT
         final GeographicCRS crs = factory.createGeographicCRS("EPSG:4326");
         assertEpsgNameAndIdentifierEqual("WGS 84", 4326, crs);
         assertEpsgNameAndIdentifierEqual("World Geodetic System 1984", 6326, crs.getDatum());
-        assertAxisDirectionsEqual("EPSG::6422", crs.getCoordinateSystem(), AxisDirection.NORTH, AxisDirection.EAST);
+        assertAxisDirectionsEqual("EPSG:6422", crs.getCoordinateSystem(), AxisDirection.NORTH, AxisDirection.EAST);
 
         final BursaWolfParameters[] bwp = ((DefaultGeodeticDatum) crs.getDatum()).getBursaWolfParameters();
         assertEquals("Expected no Bursa-Wolf parameters.", 0, bwp.length);
 
         assertSame("CRS shall be cached", crs, factory.createCoordinateReferenceSystem("4326"));
+        assertSame("Shall accept \"::\"", crs, factory.createGeographicCRS("EPSG::4326"));
     }
 
     /**
-     * Tests the "Datum 73" geographic CRS (EPSG::4274), which has a datum different than the WGS84 one.
+     * Tests the "Datum 73" geographic CRS (EPSG:4274), which has a datum different than the WGS84 one.
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
@@ -203,7 +195,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests the "Lao 1997" geographic CRS (EPSG::4993) with an ellipsoidal height.
+     * Tests the "Lao 1997" geographic CRS (EPSG:4993) with an ellipsoidal height.
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
@@ -221,7 +213,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests the "ITRF93" geocentric CRS (EPSG::4915).
+     * Tests the "ITRF93" geocentric CRS (EPSG:4915).
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
@@ -238,7 +230,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests the "NAD27(76) / UTM zone 15N" projected CRS (EPSG::2027).
+     * Tests the "NAD27(76) / UTM zone 15N" projected CRS (EPSG:2027).
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
@@ -274,7 +266,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests the "Beijing 1954 / 3-degree Gauss-Kruger CM 135E" projected CRS (EPSG::2442).
+     * Tests the "Beijing 1954 / 3-degree Gauss-Kruger CM 135E" projected CRS (EPSG:2442).
      * This projected CRS has (North, East) axis orientations instead of (East, North).
      *
      * @throws FactoryException if an error occurred while querying the factory.
@@ -410,7 +402,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests the "Barcelona Grid B1" engineering CRS (EPSG::5801).
+     * Tests the "Barcelona Grid B1" engineering CRS (EPSG:5801).
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
@@ -455,43 +447,80 @@ public final strictfp class EPSGFactoryT
         final List<CoordinateReferenceSystem> components = crs.getComponents();
         assertEquals("components.size()", 2, components.size());
         assertEpsgNameAndIdentifierEqual("NTF (Paris)",      4807, components.get(0));
-        assertEpsgNameAndIdentifierEqual("NGF IGN69 height", 5720, components.get(1));
+        assertEpsgNameAndIdentifierEqual("NGF-IGN69 height", 5720, components.get(1));
 
         assertAxisDirectionsEqual("(no EPSG code)", crs.getCoordinateSystem(),
                 AxisDirection.NORTH, AxisDirection.EAST, AxisDirection.UP);
 
         final GeographicBoundingBox bbox = CRS.getGeographicBoundingBox(crs);
         assertNotNull("No bounding box. Maybe an older EPSG database is used?", bbox);
-        assertEquals("southBoundLatitude", 42.25, bbox.getSouthBoundLatitude(), STRICT);
-        assertEquals("northBoundLatitude", 51.10, bbox.getNorthBoundLatitude(), STRICT);
-        assertEquals("westBoundLongitude", -5.20, bbox.getWestBoundLongitude(), STRICT);
+        assertEquals("southBoundLatitude", 42.33, bbox.getSouthBoundLatitude(), STRICT);
+        assertEquals("northBoundLatitude", 51.14, bbox.getNorthBoundLatitude(), STRICT);
+        assertEquals("westBoundLongitude", -4.87, bbox.getWestBoundLongitude(), STRICT);
         assertEquals("eastBoundLongitude",  8.23, bbox.getEastBoundLongitude(), STRICT);
 
         assertSame("CRS shall be cached", crs, factory.createCoordinateReferenceSystem("7400"));
     }
 
     /**
+     * Tests creation of deprecated coordinate systems.
+     *
+     * @throws FactoryException if an error occurred while querying the factory.
+     */
+    @Test
+    public void testDeprecatedCoordinateSystems() throws FactoryException {
+        assumeNotNull(factory);
+        for (final Map.Entry<Integer,Integer> entry : EPSGDataAccess.deprecatedCS().entrySet()) {
+            final CoordinateSystem expected = factory.createEllipsoidalCS(entry.getValue().toString());
+            loggings.assertNoUnexpectedLog();
+            final String code = entry.getKey().toString();
+            final CoordinateSystem deprecated;
+            try {
+                deprecated = factory.createEllipsoidalCS(code);
+            } catch (FactoryException e) {
+                final String m = e.getMessage();
+                if (m.contains("9115") || m.contains("9116") || m.contains("9117") ||
+                    m.contains("9118") || m.contains("9119") || m.contains("9120"))
+                {
+                    // Unit "9116" to "9120" are known to be unsupported.
+                    continue;
+                }
+                throw e;
+            }
+            loggings.assertNextLogContains(code);
+            final int dimension = expected.getDimension();
+            assertEquals("dimension", dimension, deprecated.getDimension());
+            for (int i=0; i<dimension; i++) {
+                final CoordinateSystemAxis ref  = expected.getAxis(i);
+                final CoordinateSystemAxis axis = deprecated.getAxis(i);
+                assertEquals("name",         ref.getName(),         axis.getName());
+                assertEquals("alias",        ref.getAlias(),        axis.getAlias());
+                assertEquals("direction",    ref.getDirection(),    axis.getDirection());
+                assertEquals("rangeMeaning", ref.getRangeMeaning(), axis.getRangeMeaning());
+                assertEquals("unit",         ref.getUnit().toSI(),  axis.getUnit().toSI());
+            }
+        }
+    }
+
+    /**
      * Tests a legacy geographic CRS (no longer supported by EPSG).
      * This test verifies that the expected warnings are logged.
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
     @Test
-    @DependsOnMethod("testGeographic2D")
+    @DependsOnMethod({"testGeographic2D", "testDeprecatedCoordinateSystems"})
     public void testDeprecatedGeographic() throws FactoryException {
         assumeNotNull(factory);
 
-        listener.maximumLogCount = 2;
-        expectedLogWords = new String[][] {
-            {"EPSG:6405"},                      // Coordinate System 6405 is no longer supported by EPSG
-            {"EPSG:63266405", "4326"}           // EPSG no longer support codes in the 60000000 series.
-        };
-
         final GeographicCRS crs = factory.createGeographicCRS("63266405");
         assertEpsgNameAndIdentifierEqual("WGS 84 (deg)", 63266405, crs);
         assertAxisDirectionsEqual(null, crs.getCoordinateSystem(), AxisDirection.NORTH, AxisDirection.EAST);
-
         assertSame("CRS shall be cached", crs, factory.createCoordinateReferenceSystem("63266405"));
+
+        loggings.skipNextLogIfContains("EPSG:6405");                 // Coordinate System 6405 is no longer supported by EPSG
+        loggings.assertNextLogContains("EPSG:63266405", "4326");     // EPSG no longer support codes in the 60000000 series.
+        loggings.assertNoUnexpectedLog();
     }
 
     /**
@@ -501,22 +530,19 @@ public final strictfp class EPSGFactoryT
      * @throws FactoryException if an error occurred while querying the factory.
      */
     @Test
-    @DependsOnMethod("testDeprecatedGeographic")
+    @DependsOnMethod({"testDeprecatedGeographic", "testDeprecatedCoordinateSystems"})
     public void testDeprecatedProjected() throws FactoryException {
         assumeNotNull(factory);
 
-        listener.maximumLogCount = 3;
-        expectedLogWords = new String[][] {
-            {"EPSG:9823",  "1029"},              // Operation method 9823 has been replaced by 1029
-            {"EPSG:19968", "4086"},              // Coordinate Operation 19968 has been replaced by 4086
-            {"EPSG:3786",  "4088"}               // Coordinate Reference System 3786 has been replaced by 4088
-        };
-
         final ProjectedCRS crs = factory.createProjectedCRS("3786");
         assertEpsgNameAndIdentifierEqual("World Equidistant Cylindrical (Sphere)", 3786, crs);
         assertEpsgNameAndIdentifierEqual("Equidistant Cylindrical (Spherical)", 9823, crs.getConversionFromBase().getMethod());
         assertAxisDirectionsEqual("EPSG::4499", crs.getCoordinateSystem(), AxisDirection.EAST, AxisDirection.NORTH);
-        assertEquals("All warnings should have been logged at this point.", 0, listener.maximumLogCount);
+
+        loggings.assertNextLogContains("EPSG:9823",  "1029");    // Operation method 9823 has been replaced by 1029
+        loggings.assertNextLogContains("EPSG:19968", "4086");    // Coordinate Operation 19968 has been replaced by 4086
+        loggings.assertNextLogContains("EPSG:3786",  "4088");    // Coordinate Reference System 3786 has been replaced by 4088
+        loggings.assertNoUnexpectedLog();
 
         final ProjectedCRS replacement = factory.createProjectedCRS("4088");
         assertEpsgNameAndIdentifierEqual("World Equidistant Cylindrical (Sphere)", 4088, replacement);
@@ -590,7 +616,7 @@ public final strictfp class EPSGFactoryT
 
         final Set<String> ellipsoids = factory.getAuthorityCodes(Ellipsoid.class);
         assertFalse("Ellipsoid not found.",       ellipsoids.isEmpty());
-        assertTrue ("Check size() consistency.",  ellipsoids.size() >= 49);
+        assertTrue ("Check size() consistency.",  ellipsoids.size() >= 48);
         assertTrue ("Shall contain WGS84.",       ellipsoids.contains("7030"));
         assertTrue ("Shall contain GRS 1980.",    ellipsoids.contains("7019"));
 
@@ -744,7 +770,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests the "UTM zone 10N" conversion (EPSG::16010).
+     * Tests the "UTM zone 10N" conversion (EPSG:16010).
      *
      * @throws FactoryException if an error occurred while querying the factory.
      */
@@ -790,7 +816,7 @@ public final strictfp class EPSGFactoryT
         } catch (AssertionError error) {
             out.println("The following contains more information about a JUnit test failure.");
             out.println("See the JUnit report for the stack trace. Below is a cache dump.");
-            out.println("See the operation method EPSG::9807 and compare with:");
+            out.println("See the operation method EPSG:9807 and compare with:");
             out.print  ("  - Method obtained directly:   "); out.println(System.identityHashCode(copMethod));
             out.print  ("  - Method obtained indirectly: "); out.println(System.identityHashCode(crsMethod));
             out.println("Content of EPSGFactory cache:");
@@ -800,7 +826,7 @@ public final strictfp class EPSGFactoryT
     }
 
     /**
-     * Tests longitude rotation (EPSG::1764). This is a very simple case for checking
+     * Tests longitude rotation (EPSG:1764). This is a very simple case for checking
      * that this part is okay before to try more complex transformations.
      *
      * @throws FactoryException if an error occurred while querying the factory.
@@ -810,13 +836,13 @@ public final strictfp class EPSGFactoryT
         assumeNotNull(factory);
         final CoordinateOperation operation = factory.createCoordinateOperation("1764");
         assertEpsgNameAndIdentifierEqual("NTF (Paris) to NTF (2)", 1764, operation);
-        assertInstanceOf("EPSG::1764", Transformation.class, operation);
+        assertInstanceOf("EPSG:1764", Transformation.class, operation);
         assertSame("Operation shall be cached", operation, factory.createCoordinateOperation("1764"));
     }
 
     /**
-     * Tests "BD72 to WGS 84 (1)" (EPSG::1609) transformation. This one has an unusual unit for the
-     * "Scale difference" parameter (EPSG::8611). The value is 0.999999 and the unit is "unity" (EPSG::9201)
+     * Tests "BD72 to WGS 84 (1)" (EPSG:1609) transformation. This one has an unusual unit for the
+     * "Scale difference" parameter (EPSG:8611). The value is 0.999999 and the unit is "unity" (EPSG:9201)
      * instead of the usual "parts per million" (EPSG:9202).
      *
      * @throws FactoryException if an error occurred while querying the factory.
@@ -893,7 +919,6 @@ public final strictfp class EPSGFactoryT
         assertTrue("contains(“EPSG::1989”)", all.contains(operation3));
 
         int count = 0;
-        listener.maximumLogCount = all.size();              // Ignore log message for unsupported operation methods.
         for (final CoordinateOperation tr : all) {
             assertSame("sourceCRS", sourceCRS, tr.getSourceCRS());
             assertSame("targetCRS", targetCRS, tr.getTargetCRS());
@@ -903,6 +928,7 @@ public final strictfp class EPSGFactoryT
             count++;
         }
         assertEquals(count, all.size());        // Size may have been modified after above loop.
+        loggings.clear();                       // Too installation-dependent for testing them.
     }
 
     /**
@@ -925,7 +951,7 @@ public final strictfp class EPSGFactoryT
                 "  AXIS[“Geodetic longitude”, EAST]]");
         /*
          * First, search for a CRS with axis order that does not match the ones in the EPSG database.
-         * IdentifiedObjectFinder should not accept EPSG::4326 as a match for the given CRS.
+         * IdentifiedObjectFinder should not accept EPSG:4326 as a match for the given CRS.
          */
         assertEquals("Full scan should be enabled by default.",
                 IdentifiedObjectFinder.Domain.VALID_DATASET, finder.getSearchDomain());

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -17,25 +17,35 @@
 package org.apache.sis.referencing.factory.sql;
 
 import java.util.Map;
+import java.util.Set;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.regex.Pattern;
+import javax.sql.DataSource;
 import java.sql.Connection;
+import java.sql.Statement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
-import javax.sql.DataSource;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.crs.GeographicCRS;
+import org.opengis.referencing.crs.ProjectedCRS;
 import org.apache.sis.referencing.CommonCRS;
-import org.apache.sis.internal.metadata.sql.TestDatabase;
+import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.util.Utilities;
+
+// Test dependencies
+import org.apache.sis.internal.metadata.sql.TestDatabase;
+import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.DependsOn;
 import org.apache.sis.test.TestCase;
+import org.junit.After;
+import org.junit.Ignore;
+import org.junit.Rule;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
-
-// Branch-dependent imports
-import org.apache.sis.internal.jdk7.Path;
+import static org.junit.Assume.*;
 
 
 /**
@@ -54,35 +64,151 @@ import org.apache.sis.internal.jdk7.Path
 @DependsOn(EPSGFactoryTest.class)
 public final strictfp class EPSGInstallerTest extends TestCase {
     /**
+     * A JUnit rule for listening to log events emitted during execution of tests.
+     * This rule is used by tests that verifies the log message content.
+     *
+     * <p>This field is public because JUnit requires us to do so, but should be considered
+     * as an implementation details (it should have been a private field).</p>
+     */
+    @Rule
+    public final LoggingWatcher loggings = new LoggingWatcher(Loggers.CRS_FACTORY);
+
+    /**
+     * Verifies that no unexpected warning has been emitted in any test defined in this class.
+     */
+    @After
+    public void assertNoUnexpectedLog() {
+        loggings.assertNoUnexpectedLog();
+    }
+
+    /**
+     * Tests the {@link EPSGInstaller#REPLACE_STATEMENT} pattern.
+     */
+    @Test
+    public void testReplacePattern() {
+        // Statement as in the EPSG scripts since EPSG version 7.06.
+        assertTrue(Pattern.matches(EPSGInstaller.REPLACE_STATEMENT,
+                "UPDATE epsg_datum\n" +
+                "SET datum_name = replace(datum_name, CHR(182), CHR(10))"));
+
+        // Statement as in the EPSG scripts prior to EPSG version 7.06.
+        assertTrue(Pattern.matches(EPSGInstaller.REPLACE_STATEMENT,
+                "UPDATE epsg_datum\n" +
+                "SET datum_name = replace(datum_name, CHAR(182), CHAR(10))"));
+
+        // Modified statement with MS-Access table name in a schema.
+        assertTrue(Pattern.matches(EPSGInstaller.REPLACE_STATEMENT,
+                "UPDATE epsg.\"Alias\"\n" +
+                "SET object_table_name = replace(object_table_name, CHR(182), CHR(10))"));
+
+        // Like above, but the table name contains a space.
+        assertTrue(Pattern.matches(EPSGInstaller.REPLACE_STATEMENT,
+                "UPDATE epsg.\"Coordinate Axis\"\n" +
+                "SET coord_axis_orientation = replace(coord_axis_orientation, CHR(182), CHR(10))"));
+    }
+
+    /**
+     * Returns the SQL scripts needed for testing the database creation,
+     * or skip the JUnit test if those scripts are not found.
+     */
+    private static InstallationScriptProvider getScripts() {
+        final InstallationScriptProvider scripts = new InstallationScriptProvider.Default();
+        assumeTrue("EPSG scripts not found in Databases/ExternalSources directory.",
+                scripts.getAuthority().equals("EPSG"));
+        return scripts;
+    }
+
+    /**
      * Tests the creation of an EPSG database on Derby.
-     * This test is skipped if no Derby or JavaDB driver has been found.
+     * This test is skipped if Derby/JavaDB is not found, or if the SQL scripts are not found.
      *
      * @throws Exception if an error occurred while creating the database.
      */
     @Test
     public void testCreationOnDerby() throws Exception {
-        final Path scripts = TestDatabase.directory("ExternalSources");
+        final InstallationScriptProvider scripts = getScripts();            // Needs to be invoked first.
         final DataSource ds = TestDatabase.create("test");
         try {
             createAndTest(ds, scripts);
         } finally {
             TestDatabase.drop(ds);
         }
+        loggings.assertNextLogContains("EPSG", "jdbc:derby:memory:test");
+        loggings.assertNoUnexpectedLog();
+    }
+
+    /**
+     * Tests the creation of an EPSG database on HSQLDB.
+     * This test is skipped if the SQL scripts are not found.
+     *
+     * <p>This test is skipped by default because HSQLDB changes the {@code java.util.logging} configuration,
+     * which causes failures in all Apache SIS tests that verify the logging messages after execution of this
+     * test. This impact this {@code EPSGInstallerTest} class, but also other test classes.</p>
+     *
+     * @throws Exception if an error occurred while creating the database.
+     */
+    @Test
+    @Ignore("Skipped for protecting java.util.logging configuration against changes.")
+    public void testCreationOnHSQLDB() throws Exception {
+        final InstallationScriptProvider scripts = getScripts();            // Needs to be invoked first.
+        final DataSource ds = (DataSource) Class.forName("org.hsqldb.jdbc.JDBCDataSource").newInstance();
+        ds.getClass().getMethod("setURL", String.class).invoke(ds, "jdbc:hsqldb:mem:test");
+        try {
+            createAndTest(ds, scripts);
+        } finally {
+            final Connection c = ds.getConnection(); Statement s = c.createStatement();
+            try {
+                s.execute("SHUTDOWN");
+            } finally {
+                c.close();
+            }
+        }
+        loggings.assertNextLogContains("EPSG", "jdbc:hsqldb:mem:test");
+        loggings.assertNoUnexpectedLog();
     }
 
     /**
-     * Requests the WGS84 coordinate reference system from the EPSG database at the given source.
-     * It should trig the creation of the EPSG database.
+     * Requests the "WGS84" and the "WGS72 / UTM zone 15N" coordinate reference systems from the EPSG database
+     * at the given {@code DataSource}. Those requests should trig the creation of the EPSG database.
      */
-    private static void createAndTest(final DataSource ds, final Path scripts) throws SQLException, FactoryException {
+    private void createAndTest(final DataSource ds, final InstallationScriptProvider scriptProvider)
+            throws SQLException, FactoryException
+    {
         final Map<String,Object> properties = new HashMap<String,Object>();
         assertNull(properties.put("dataSource", ds));
-        assertNull(properties.put("scriptDirectory", scripts));
+        assertNull(properties.put("scriptProvider", scriptProvider));
         assertEquals("Should not contain EPSG tables before we created them.", 0, countCRSTables(ds));
+        loggings.assertNoUnexpectedLog();       // Should not yet have logged anything at this point.
+
         final EPSGFactory factory = new EPSGFactory(properties);
         try {
+            /*
+             * Fetch the "WGS 84" coordinate reference system.
+             */
             final GeographicCRS crs = factory.createGeographicCRS("4326");
             assertTrue(Utilities.deepEquals(CommonCRS.WGS84.geographic(), crs, ComparisonMode.DEBUG));
+            /*
+             * Fetch the "WGS 72 / UTM zone 15" coordinate system.
+             * This implies the creation of a coordinate operation.
+             */
+            final ProjectedCRS p = factory.createProjectedCRS("EPSG:32215");
+            assertTrue(Utilities.deepEquals(CommonCRS.WGS72.UTM(1, -93), p, ComparisonMode.DEBUG));
+            /*
+             * Get the authority codes. We choose a type that implies an SQL statement
+             * with both "DEPRECATED" and "SHOW_CRS" conditions in their "WHERE" clause.
+             */
+            Set<String> codes = factory.getAuthorityCodes(GeographicCRS.class);
+            assertTrue("4979", codes.contains("4979"));     // A non-deprecated code.
+            assertTrue("4329", codes.contains("4329"));     // A deprecated code.
+            /*
+             * Following forces the authority factory to iterate over all codes.
+             * Since the iterator returns only non-deprecated codes, EPSG:4329
+             * should not be included. The intend is to verify that the fields
+             * of type BOOLEAN have been properly handled.
+             */
+            codes = new HashSet<String>(codes);
+            assertTrue ("4979", codes.contains("4979"));
+            assertFalse("4329", codes.contains("4329"));
         } finally {
             factory.close();
         }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -25,7 +25,6 @@ import java.util.Collections;
 import java.io.IOException;
 import org.opengis.util.FactoryException;
 import org.opengis.util.GenericName;
-import org.opengis.metadata.Identifier;
 import org.opengis.metadata.extent.GeographicBoundingBox;
 import org.opengis.parameter.*;
 import org.opengis.referencing.operation.*;
@@ -51,6 +50,7 @@ import org.apache.sis.util.Numbers;
 
 // Branch-dependent imports
 import org.apache.sis.internal.jdk8.JDK8;
+import org.opengis.metadata.Identifier;
 
 
 /**

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -16,8 +16,11 @@
  */
 package org.apache.sis.referencing.report;
 
+import java.util.Arrays;
 import java.util.Locale;
+import java.util.Set;
 import java.util.Map;
+import java.util.HashSet;
 import java.util.HashMap;
 import java.util.TreeMap;
 import java.io.File;
@@ -43,6 +46,7 @@ import org.opengis.referencing.datum.Ver
 import org.opengis.referencing.operation.OperationMethod;
 import org.opengis.test.report.AuthorityCodesReport;
 import org.apache.sis.metadata.iso.citation.Citations;
+import org.apache.sis.internal.referencing.DeprecatedCode;
 import org.apache.sis.referencing.CRS;
 import org.apache.sis.referencing.CommonCRS;
 import org.apache.sis.referencing.IdentifiedObjects;
@@ -95,16 +99,19 @@ public final strictfp class CoordinateRe
      */
     private static final Map<String,String> SECTION_TITLES = new HashMap<String,String>();
     static {
+        rd("American Samoa 1962",                                         "American Samoa");
+        rd("American Samoa Vertical Datum of 2002",                       "American Samoa");
         rd("Arc 1950",                                                    "Arc");
         rd("Arc 1960",                                                    "Arc");
         rd("Ancienne Triangulation Francaise (Paris)",                    "Ancienne Triangulation Française");
         rd("Australian Geodetic Datum 1966",                              "Australian Geodetic Datum");
         rd("Australian Geodetic Datum 1984",                              "Australian Geodetic Datum");
         rd("Australian Height Datum (Tasmania)",                          "Australian Height Datum");
-        rd("Azores Central Islands 1948",                                 "Azores Central Islands");
-        rd("Azores Central Islands 1995",                                 "Azores Central Islands");
-        rd("Azores Oriental Islands 1940",                                "Azores Oriental Islands");
-        rd("Azores Oriental Islands 1995",                                "Azores Oriental Islands");
+        rd("Azores Central Islands 1948",                                 "Azores Islands");
+        rd("Azores Central Islands 1995",                                 "Azores Islands");
+        rd("Azores Occidental Islands 1939",                              "Azores Islands");
+        rd("Azores Oriental Islands 1940",                                "Azores Islands");
+        rd("Azores Oriental Islands 1995",                                "Azores Islands");
         rd("Baltic 1980",                                                 "Baltic");
         rd("Baltic 1982",                                                 "Baltic");
         rd("Baltic Sea",                                                  "Baltic");
@@ -114,15 +121,29 @@ public final strictfp class CoordinateRe
         rd("Bogota 1975 (Bogota)",                                        "Bogota 1975");
         rd("Carthage (Paris)",                                            "Carthage");
         rd("Bern 1938",                                                   "Bern / CH1903");
+        rd("Cais da Figueirinha - Angra do Heroísmo",                     "Cais");
+        rd("Cais da Madalena",                                            "Cais");
+        rd("Cais da Pontinha - Funchal",                                  "Cais");
+        rd("Cais da Vila - Porto Santo",                                  "Cais");
+        rd("Cais da Vila do Porto",                                       "Cais");
+        rd("Cais das Velas",                                              "Cais");
+        rd("Cayman Brac Vertical Datum 1961",                             "Cayman Islands");
+        rd("Cayman Islands Geodetic Datum 2011",                          "Cayman Islands");
         rd("CH1903",                                                      "Bern / CH1903");
         rd("CH1903+",                                                     "Bern / CH1903");
         rd("CH1903 (Bern)",                                               "Bern / CH1903");
+        rd("Canadian Geodetic Vertical Datum of 1928",                    "Canadian Geodetic Vertical Datum");
+        rd("Canadian Geodetic Vertical Datum of 2013",                    "Canadian Geodetic Vertical Datum");
         rd("Chatham Islands Datum 1971",                                  "Chatham Islands Datum");
         rd("Chatham Islands Datum 1979",                                  "Chatham Islands Datum");
         rd("Corrego Alegre 1961",                                         "Corrego Alegre");
         rd("Corrego Alegre 1970-72",                                      "Corrego Alegre");
+        rd("Danger 1950",                                                 "Saint Pierre et Miquelon 1950");
+        rd("Dansk Normal Nul",                                            "Dansk");
+        rd("Dansk Vertikal Reference 1990",                               "Dansk");
         rd("Dealul Piscului 1930",                                        "Dealul Piscului");
         rd("Dealul Piscului 1970",                                        "Dealul Piscului");
+        rd("Deutsches Haupthoehennetz 1912",                              "Deutsches Haupthoehennetz");
         rd("Deutsches Haupthoehennetz 1985",                              "Deutsches Haupthoehennetz");
         rd("Deutsches Haupthoehennetz 1992",                              "Deutsches Haupthoehennetz");
         rd("Douala 1948",                                                 "Douala");
@@ -145,18 +166,25 @@ public final strictfp class CoordinateRe
         rd("European Vertical Reference Frame 2007",                      "European Vertical Reference Frame");
         rd("Fahud Height Datum",                                          "Fahud");
         rd("Fao 1979",                                                    "Fao");
+        rd("Fehmarnbelt Datum 2010",                                      "Fehmarnbelt");
+        rd("Fehmarnbelt Vertical Reference 2010",                         "Fehmarnbelt");
         rd("Faroe Datum 1954",                                            "Faroe Islands");
         rd("Faroe Islands Vertical Reference 2009",                       "Faroe Islands");
         rd("fk89",                                                        "Faroe Islands");
         rd("Fiji 1956",                                                   "Fiji");
         rd("Fiji Geodetic Datum 1986",                                    "Fiji");
+        rd("Gan 1970",                                                    "Gandajika");
+        rd("Grand Cayman Geodetic Datum 1959",                            "Grand Cayman");
+        rd("Grand Cayman Vertical Datum 1954",                            "Grand Cayman");
         rd("Greek (Athens)",                                              "Greek");
         rd("Greek Geodetic Reference System 1987",                        "Greek");
         rd("Guadeloupe 1948",                                             "Guadeloupe");
         rd("Guadeloupe 1951",                                             "Guadeloupe");
         rd("Guadeloupe 1988",                                             "Guadeloupe");
+        rd("Guam 1963",                                                   "Guam");
+        rd("Guam Vertical Datum of 1963",                                 "Guam");
+        rd("Guam Vertical Datum of 2004",                                 "Guam");
         rd("Gunung Segara (Jakarta)",                                     "Gunung Segara");
-        rd("Guyane Francaise",                                            "Centre Spatial Guyanais 1967");   // For a deprecated CRS.
         rd("Hong Kong 1963",                                              "Hong Kong");
         rd("Hong Kong 1963(67)",                                          "Hong Kong");
         rd("Hong Kong 1980",                                              "Hong Kong");
@@ -177,10 +205,10 @@ public final strictfp class CoordinateRe
         rd("IGN63 Hiva Oa",                                               "IGN");
         rd("IGN72 Grande Terre",                                          "IGN");
         rd("IGN72 Nuku Hiva",                                             "IGN");
-        rd("IGN78 Corsica",                                               "IGN");
         rd("Indian 1954",                                                 "Indian");
         rd("Indian 1960",                                                 "Indian");
         rd("Indian 1975",                                                 "Indian");
+        rd("Indian Spring Low Water",                                     "Indian");
         rd("International Great Lakes Datum 1955",                        "International Great Lakes Datum");
         rd("International Great Lakes Datum 1985",                        "International Great Lakes Datum");
         rd("International Terrestrial Reference Frame 1988",              "International Terrestrial Reference Frame");
@@ -200,12 +228,17 @@ public final strictfp class CoordinateRe
         rd("Jamaica 1875",                                                "Jamaica");
         rd("Jamaica 1969",                                                "Jamaica");
         rd("Jamaica 2001",                                                "Jamaica");
+        rd("Japanese Geodetic Datum 2011 (vertical)",                     "Japanese Geodetic Datum 2011");
+        rd("Japanese Standard Levelling Datum 1969",                      "Japanese Standard Levelling Datum");
+        rd("Japanese Standard Levelling Datum 1972",                      "Japanese Standard Levelling Datum");
         rd("Kalianpur 1880",                                              "Kalianpur");
         rd("Kalianpur 1937",                                              "Kalianpur");
         rd("Kalianpur 1962",                                              "Kalianpur");
         rd("Kalianpur 1975",                                              "Kalianpur");
         rd("Kertau (RSO)",                                                "Kertau");
         rd("Kertau 1968",                                                 "Kertau");
+        rd("KOC Construction Datum",                                      "KOC Construction Datum / Well Datum");
+        rd("KOC Well Datum",                                              "KOC Construction Datum / Well Datum");
         rd("Korean Datum 1985",                                           "Korean Datum");
         rd("Korean Datum 1995",                                           "Korean Datum");
         rd("Kuwait Oil Company",                                          "Kuwait Oil Company / Kuwait Utility");
@@ -213,12 +246,14 @@ public final strictfp class CoordinateRe
         rd("Kuwait Utility",                                              "Kuwait Oil Company / Kuwait Utility");
         rd("Lao 1993",                                                    "Lao");
         rd("Lao National Datum 1997",                                     "Lao");
+        rd("Latvia 1992",                                                 "Latvia");
+        rd("Latvian Height System 2000",                                  "Latvia");
         rd("Lisbon 1890",                                                 "Lisbon");
         rd("Lisbon 1890 (Lisbon)",                                        "Lisbon");
         rd("Lisbon 1937",                                                 "Lisbon");
         rd("Lisbon 1937 (Lisbon)",                                        "Lisbon");
-        rd("Cote d'Ivoire",                                               "Locodjo 1965");   // For a deprecated CRS.
-        rd("Madeira 1936",                                                "Porto Santo");    // For a deprecated CRS.
+        rd("Lower Low Water Large Tide",                                  "Low Water");
+        rd("Lowest Astronomic Tide",                                      "Low Water");
         rd("Makassar (Jakarta)",                                          "Makassar");
         rd("Manoca 1962",                                                 "Manoca");
         rd("Martinique 1938",                                             "Martinique");
@@ -226,8 +261,14 @@ public final strictfp class CoordinateRe
         rd("Martinique 1987",                                             "Martinique");
         rd("Maupiti 83",                                                  "Maupiti");
         rd("Maupiti SAU 2001",                                            "Maupiti");
+        rd("Mean High Water",                                             "Mean Sea Level");
+        rd("Mean High Water Spring Tides",                                "Mean Sea Level");
+        rd("Mean Higher High Water",                                      "Mean Sea Level");
+        rd("Mean Low Water",                                              "Mean Sea Level");
+        rd("Mean Low Water Spring Tides",                                 "Mean Sea Level");
+        rd("Mean Lower Low Water",                                        "Mean Sea Level");
+        rd("Mean Lower Low Water Spring Tides",                           "Mean Sea Level");
         rd("Missao Hidrografico Angola y Sao Tome 1951",                  "Missao Hidrografico Angola y Sao Tome");
-        rd("Mhast",                                                       "Missao Hidrografico Angola y Sao Tome");
         rd("Mhast (offshore)",                                            "Missao Hidrografico Angola y Sao Tome");
         rd("Mhast (onshore)",                                             "Missao Hidrografico Angola y Sao Tome");
         rd("Militar-Geographische Institut (Ferro)",                      "Militar-Geographische Institut");
@@ -240,20 +281,24 @@ public final strictfp class CoordinateRe
         rd("Naparima 1972",                                               "Naparima");
         rd("Nivellement General de la Corse 1948",                        "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
         rd("Nivellement General de la France - IGN69",                    "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
+        rd("Nivellement General de la France - IGN78",                    "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
         rd("Nivellement General de la France - Lallemand",                "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
         rd("Nivellement General de Nouvelle Caledonie",                   "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
         rd("Nivellement General de Polynesie Francaise",                  "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
         rd("Nivellement General du Luxembourg",                           "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
         rd("Nivellement General Guyanais 1977",                           "Nivellement Général Corse / France / Nouvelle-Calédonie / Polynésie Française / Luxembourd / Guyanais");
         rd("NGO 1948 (Oslo)",                                             "NGO 1948");
-        rd("NAD27 Michigan",                                              "North American Datum 1927 — Michigan");
         rd("NAD83 (High Accuracy Reference Network)",                     "North American Datum 1983 — High Accuracy Reference Network");
         rd("NAD83 (National Spatial Reference System 2007)",              "North American Datum 1983 — National Spatial Reference System 2007");
         rd("NAD83 Canadian Spatial Reference System",                     "North American Datum 1983 — Canadian Spatial Reference System");
-        rd("Nord Sahara 1959 (Paris)",                                    "Nord Sahara 1959");
-        rd("Nord de Guerre (Paris)",                                      "Ancienne Triangulation Française");
         rd("Nouvelle Triangulation Francaise",                            "Nouvelle Triangulation Française");
         rd("Nouvelle Triangulation Francaise (Paris)",                    "Nouvelle Triangulation Française");
+        rd("NAD83 (Continuously Operating Reference Station 1996)",       "North American Datum 1983 — Continuously Operating Reference Station 1996");       // For better sort order.
+        rd("NAD83 (National Spatial Reference System 2011)",              "North American Datum 1983 — National Spatial Reference System 2011");
+        rd("NAD83 (National Spatial Reference System MA11)",              "North American Datum 1983 — National Spatial Reference System MA11 / PA11");
+        rd("NAD83 (National Spatial Reference System PA11)",              "North American Datum 1983 — National Spatial Reference System MA11 / PA11");
+        rd("Norway Normal Null 1954",                                     "Norway Normal Null");
+        rd("Norway Normal Null 2000",                                     "Norway Normal Null");
         rd("Ordnance Datum Newlyn (Orkney Isles)",                        "Ordnance Datum Newlyn");
         rd("OSGB 1936",                                                   "OSGB");
         rd("OSGB 1970 (SN)",                                              "OSGB");
@@ -264,9 +309,10 @@ public final strictfp class CoordinateRe
         rd("Pitcairn 2006",                                               "Pitcairn");
         rd("Porto Santo 1936",                                            "Porto Santo");
         rd("Porto Santo 1995",                                            "Porto Santo");
-        rd("Posiciones Geodesicas Argentinas 1994",                       "Posiciones Geodesicas Argentinas");
-        rd("Posiciones Geodesicas Argentinas 1998",                       "Posiciones Geodesicas Argentinas");
-        rd("Posiciones Geodesicas Argentinas 2007",                       "Posiciones Geodesicas Argentinas");
+        rd("Posiciones Geodésicas Argentinas 1994",                       "Posiciones Geodésicas Argentinas");
+        rd("Posiciones Geodésicas Argentinas 1998",                       "Posiciones Geodésicas Argentinas");
+        rd("Posiciones Geodésicas Argentinas 2007",                       "Posiciones Geodésicas Argentinas");
+        rd("Puerto Rico Vertical Datum of 2002",                          "Puerto Rico");
         rd("Qatar 1948",                                                  "Qatar");
         rd("Qatar 1974",                                                  "Qatar");
         rd("Qatar National Datum 1995",                                   "Qatar");
@@ -281,8 +327,8 @@ public final strictfp class CoordinateRe
         rd("Rikets hojdsystem 1900",                                      "Rikets hojdsystem");
         rd("Rikets hojdsystem 1970",                                      "Rikets hojdsystem");
         rd("Rikets hojdsystem 2000",                                      "Rikets hojdsystem");
-        rd("Samboja",                                                     "Gunung Segara");      // For a deprecated CRS.
-        rd("Segora",                                                      "Gunung Segara");      // For a deprecated CRS.
+        rd("Santa Cruz da Graciosa",                                      "Santa Cruz");
+        rd("Santa Cruz das Flores",                                       "Santa Cruz");
         rd("Sierra Leone 1968",                                           "Sierra Leone");
         rd("Sierra Leone Colony 1924",                                    "Sierra Leone");
         rd("SIRGAS-Chile",                                                "SIRGAS");
@@ -293,10 +339,9 @@ public final strictfp class CoordinateRe
         rd("Sri Lanka Datum 1999",                                        "Sri Lanka");
         rd("Sri Lanka Vertical Datum",                                    "Sri Lanka");
         rd("Stockholm 1938 (Stockholm)",                                  "Stockholm 1938");
-        rd("Sudan",                                                       "Adindan");            // For a deprecated CRS.
-        rd("System Jednotne Trigonometricke Site Katastralni (Ferro)",    "System Jednotne Trigonometricke Site Katastralni");
-        rd("System Jednotne Trigonometricke Site Katastralni/05",         "System Jednotne Trigonometricke Site Katastralni");
-        rd("System Jednotne Trigonometricke Site Katastralni/05 (Ferro)", "System Jednotne Trigonometricke Site Katastralni");
+        rd("Systém Jednotné Trigonometrické Síte Katastrální (Ferro)",    "Systém Jednotné Trigonometrické Síte Katastrální");
+        rd("Systém Jednotné Trigonometrické Síte Katastrální/05",         "Systém Jednotné Trigonometrické Síte Katastrální");
+        rd("Systém Jednotné Trigonometrické Síte Katastrální/05 (Ferro)", "Systém Jednotné Trigonometrické Síte Katastrální");
         rd("Tahaa 54",                                                    "Tahaa");
         rd("Tahaa SAU 2001",                                              "Tahaa");
         rd("Tahiti 52",                                                   "Tahiti");
@@ -304,8 +349,8 @@ public final strictfp class CoordinateRe
         rd("Taiwan Datum 1967",                                           "Taiwan Datum");
         rd("Taiwan Datum 1997",                                           "Taiwan Datum");
         rd("Tananarive 1925 (Paris)",                                     "Tananarive 1925");
+        rd("Tokyo 1892",                                                  "Tokyo");
         rd("Viti Levu 1912",                                              "Viti Levu");
-        rd("Viti Levu 1916",                                              "Viti Levu");          // For a deprecated CRS.
         rd("Voirol 1875",                                                 "Voirol");
         rd("Voirol 1875 (Paris)",                                         "Voirol");
         rd("Voirol 1879",                                                 "Voirol");
@@ -316,6 +361,13 @@ public final strictfp class CoordinateRe
     }
 
     /**
+     * The datums from the above list which are deprecated, but that we do not want to replace by the non-deprecated
+     * datum. We disable some replacements when they allow better sorting of deprecated CRS.
+     */
+    private static final Set<String> KEEP_DEPRECATED_DATUM = new HashSet<String>(Arrays.asList(
+        "Dealul Piscului 1970"));           // Datum does not exist but is an alias for S-42 in Romania.
+
+    /**
      * Shortcut for {@link #SECTION_TITLES} initialization.
      * {@code "rd"} stands for "rename datum".
      */
@@ -324,8 +376,23 @@ public final strictfp class CoordinateRe
     }
 
     /**
-     * The keywords before which to cut the CRS names. The main intend here is to preserve the
-     * "far west", "west", "central west", "central", "central east", "east", "far east" order.
+     * Words to ignore in a datum name in order to detect if a CRS name is the acronym of the datum name.
+     */
+    private static final Set<String> DATUM_WORDS_TO_IGNORE = new HashSet<String>(Arrays.asList(
+            "of",           // VIVD:   Virgin Islands Vertical Datum of 2009
+            "de",           // RRAF:   Reseau de Reference des Antilles Francaises
+            "des",          // RGAF:   Reseau Geodesique des Antilles Francaises
+            "la",           // RGR:    Reseau Geodesique de la Reunion
+            "et",           // RGSPM:  Reseau Geodesique de Saint Pierre et Miquelon
+            "para",         // SIRGAS: Sistema de Referencia Geocentrico para America del Sur 1995
+            "del",          // SIRGAS: Sistema de Referencia Geocentrico para America del Sur 1995
+            "las",          // SIRGAS: Sistema de Referencia Geocentrico para las AmericaS 2000
+            "Tides"));      // MLWS:   Mean Low Water Spring Tides
+
+    /**
+     * The keywords before which to cut the CRS names when sorting by alphabetical order.
+     * The main intend here is to preserve the "far west", "west", "central west", "central",
+     * "central east", "east", "far east" order.
      */
     private static final String[] CUT_BEFORE = {
         " far west",        // "MAGNA-SIRGAS / Colombia Far West zone"
@@ -339,7 +406,7 @@ public final strictfp class CoordinateRe
     };
 
     /**
-     * The keywords after which to cut the CRS names.
+     * The keywords after which to cut the CRS names when sorting by alphabetical order.
      *
      * Note: alphabetical sorting of Roman numbers work for zones from I to VIII inclusive.
      * If there is more zones (for example with "JGD2000 / Japan Plane Rectangular"), then
@@ -372,17 +439,24 @@ public final strictfp class CoordinateRe
     private final CRSAuthorityFactory factory;
 
     /**
+     * The datum from the {@link #SECTION_TITLES} that we didn't found after we processed all codes.
+     * Used for verification purpose only.
+     */
+    private final Set<String> unusedDatumMapping;
+
+    /**
      * Creates a new instance.
      */
     private CoordinateReferenceSystems() throws FactoryException {
         super(null);
+        unusedDatumMapping = new HashSet<String>(SECTION_TITLES.keySet());
         properties.setProperty("TITLE",           "Apache SIS™ Coordinate Reference System (CRS) codes");
         properties.setProperty("PRODUCT.NAME",    "Apache SIS™");
         properties.setProperty("PRODUCT.VERSION", getVersion());
         properties.setProperty("PRODUCT.URL",     "http://sis.apache.org");
         properties.setProperty("JAVADOC.GEOAPI",  "http://www.geoapi.org/snapshot/javadoc");
         properties.setProperty("FACTORY.NAME",    "EPSG");
-        properties.setProperty("FACTORY.VERSION", "7.9");
+        properties.setProperty("FACTORY.VERSION", "8.9");
         properties.setProperty("FACTORY.VERSION.SUFFIX", ", together with other sources");
         properties.setProperty("DESCRIPTION", "<p><b>Notation:</b></p>\n" +
                 "<ul>\n" +
@@ -408,6 +482,14 @@ public final strictfp class CoordinateRe
         final CoordinateReferenceSystems writer = new CoordinateReferenceSystems();
         final File file = writer.write(new File("CoordinateReferenceSystems.html"));
         System.out.println("Created " + file.getAbsolutePath());
+        if (!writer.unusedDatumMapping.isEmpty()) {
+            System.out.println();
+            System.out.println("WARNING: the following datums were expected but not found. Maybe their spelling changed?");
+            for (final String name : writer.unusedDatumMapping) {
+                System.out.print("  - ");
+                System.out.println(name);
+            }
+        }
     }
 
     /**
@@ -467,6 +549,66 @@ public final strictfp class CoordinateRe
     }
 
     /**
+     * Omits the trailing number, if any.
+     * For example if the given name is "Abidjan 1987", then this method returns "Abidjan".
+     */
+    private static String omitTrailingNumber(String name) {
+        int i = CharSequences.skipTrailingWhitespaces(name, 0, name.length());
+        while (i != 0) {
+            final char c = name.charAt(--i);
+            if (c < '0' || c > '9') {
+                name = name.substring(0, CharSequences.skipTrailingWhitespaces(name, 0, i+1));
+                break;
+            }
+        }
+        return name;
+    }
+
+    /**
+     * If the first word of the CRS name seems to be an acronym of the datum name,
+     * puts that acronym in a {@code <abbr title="datum name">...</abbr>} element.
+     */
+    static String insertAbbreviationTitle(final String crsName, final String datumName) {
+        int s = crsName.indexOf(' ');
+        if (s < 0) s = crsName.length();
+        int p = crsName.indexOf('(');
+        if (p >= 0 && p < s) s = p;
+        p = datumName.indexOf('(');
+        if (p < 0) p = datumName.length();
+        final String acronym = crsName.substring(0, s);
+        final String ar = omitTrailingNumber(acronym);
+        final String dr = omitTrailingNumber(datumName.substring(0, p));
+        if (dr.startsWith(ar)) {
+            return crsName;                                 // Avoid redudancy between CRS name and datum name.
+        }
+        /*
+         * If the first CRS word does not seem to be an acronym of the datum name, verify
+         * if there is some words that we should ignore in the datum name and try again.
+         */
+        if (!CharSequences.isAcronymForWords(ar, dr)) {
+            final String[] words = (String[]) CharSequences.split(dr, ' ');
+            int n = 0;
+            for (final String word : words) {
+                if (!DATUM_WORDS_TO_IGNORE.contains(word)) {
+                    words[n++] = word;
+                }
+            }
+            if (n == words.length || n < 2) {
+                return crsName;
+            }
+            final StringBuilder b = new StringBuilder();
+            for (int i=0; i<n; i++) {
+                if (i != 0) b.append(' ');
+                b.append(words[i]);
+            }
+            if (!CharSequences.isAcronymForWords(ar, b)) {
+                return crsName;
+            }
+        }
+        return "<abbr title=\"" + datumName + "\">" + acronym + "</abbr>" + crsName.substring(s);
+    }
+
+    /**
      * Invoked when a CRS has been successfully created. This method modifies the default
      * {@link org.opengis.test.report.AuthorityCodesReport.Row} attribute values created
      * by GeoAPI.
@@ -477,36 +619,51 @@ public final strictfp class CoordinateRe
      */
     @Override
     protected Row createRow(final String code, final IdentifiedObject object) {
-        if (code.equals("EPSG:5804")) {
-            System.out.println("");
-        }
         final Row row = super.createRow(code, object);
         final CoordinateReferenceSystem crs = (CoordinateReferenceSystem) object;
         final CoordinateReferenceSystem crsXY = AbstractCRS.castOrCopy(crs).forConvention(AxesConvention.RIGHT_HANDED);
         if (!Utilities.deepEquals(crs.getCoordinateSystem(), crsXY.getCoordinateSystem(), ComparisonMode.IGNORE_METADATA)) {
             row.annotation = YX_ORDER;
         }
+        CoordinateReferenceSystem replacement = crs;
         row.remark = getRemark(crs);
-        if (object instanceof Deprecable) {
-            row.isDeprecated = ((Deprecable) object).isDeprecated();
-        }
         /*
-         * If the object is deprecated, try to find the reason.
-         * Don't take the whole comment, because it may be pretty long.
+         * If the object is deprecated, find the replacement.
+         * We do not take the whole comment because it may be pretty long.
          */
-        if (row.isDeprecated) {
-            InternationalString i18n = object.getRemarks();
-            for (final Identifier id : object.getIdentifiers()) {
-                if (id instanceof Deprecable && ((Deprecable) id).isDeprecated()) {
-                    i18n = ((Deprecable) id).getRemarks();
-                    break;
+        if (object instanceof Deprecable) {
+            row.isDeprecated = ((Deprecable) object).isDeprecated();
+            if (row.isDeprecated) {
+                String replacedBy = null;
+                InternationalString i18n = object.getRemarks();
+                for (final Identifier id : object.getIdentifiers()) {
+                    if (id instanceof Deprecable && ((Deprecable) id).isDeprecated()) {
+                        i18n = ((Deprecable) id).getRemarks();
+                        if (id instanceof DeprecatedCode) {
+                            replacedBy = ((DeprecatedCode) id).replacedBy;
+                        }
+                        break;
+                    }
+                }
+                if (i18n != null) {
+                    row.remark = i18n.toString(getLocale());
+                }
+                /*
+                 * If a replacement exists for a deprecated CRS, use the datum of the replacement instead than
+                 * the datum of the deprecated CRS for determining in which section to put the CRS. The reason
+                 * is that some CRS are deprecated because they were associated to the wrong datum, in which
+                 * case the deprecated CRS would appear in the wrong section if we do not apply this correction.
+                 */
+                if (!KEEP_DEPRECATED_DATUM.contains(CRS.getSingleComponents(crs).get(0).getDatum().getName().getCode())) {
+                    if (replacedBy != null) try {
+                        replacement = factory.createCoordinateReferenceSystem("EPSG:" + replacedBy);
+                    } catch (FactoryException e) {
+                        // Ignore - keep the datum of the deprecated object.
+                    }
                 }
-            }
-            if (i18n != null) {
-                row.remark = i18n.toString(getLocale());
             }
         }
-        ((ByName) row).setup(CRS.getSingleComponents(crs).get(0).getDatum());
+        ((ByName) row).setup(CRS.getSingleComponents(replacement).get(0).getDatum(), unusedDatumMapping);
         return row;
     }
 
@@ -532,15 +689,10 @@ public final strictfp class CoordinateRe
             // because those authority codes need parameters.
             row.hasError = false;
             row.remark = "Projected";
-            ((ByName) row).setup(CommonCRS.WGS84.datum());
+            ((ByName) row).setup(CommonCRS.WGS84.datum(), unusedDatumMapping);
         } else {
-            String message = exception.getMessage();
-            if (message.contains("Unable to format units in UCUM")) {
-                // Simplify a very long and badly formatted message.
-                message = "Unable to format units in UCUM";
-            }
-            row.remark = message;
-            ((ByName) row).setup(null);
+            row.remark = exception.getMessage();
+            ((ByName) row).setup(null, unusedDatumMapping);
         }
         return row;
     }
@@ -555,6 +707,9 @@ public final strictfp class CoordinateRe
         return new ByName();
     }
 
+
+
+
     /**
      * A row with an natural ordering that use the first part of the name before to use the authority code.
      * We use only the part of the name prior some keywords (e.g. {@code "zone"}).
@@ -589,20 +744,24 @@ public final strictfp class CoordinateRe
         /**
          * Computes the {@link #reducedName} field value.
          */
-        final void setup(final Datum datum) {
+        final void setup(final Datum datum, final Set<String> unusedDatumMapping) {
+            final String datumName;
             if (datum != null) {
-                section = datum.getName().getCode();
+                datumName = datum.getName().getCode();
             } else {
                 // Temporary patch (TODO: remove after we implemented the missing methods in SIS)
                 if (name.startsWith("NSIDC EASE-Grid")) {
-                    section = "Unspecified datum";
+                    datumName = "Unspecified datum";
                 } else if (code.equals("EPSG:2163")) {
-                    section = "Unspecified datum";
+                    datumName = "Unspecified datum";
                 } else if (code.equals("EPSG:5818")) {
-                    section = "Seismic bin grid datum";
+                    datumName = "Seismic bin grid datum";
+                } else {
+                    datumName = null;       // Keep ordering based on the name.
                 }
             }
-            section = JDK8.getOrDefault(SECTION_TITLES, section, section);
+            section = JDK8.getOrDefault(SECTION_TITLES, datumName, datumName);
+            unusedDatumMapping.remove(datumName);
             /*
              * Get a copy of the name in all lower case.
              */
@@ -631,11 +790,15 @@ public final strictfp class CoordinateRe
             if (s != 0) b.setLength(s);
             uniformizeZoneNumber(b);
             reducedName = b.toString();
+            if (datumName != null) {
+                name = insertAbbreviationTitle(name, datumName);
+            }
         }
 
         /**
          * If the string ends with a number optionally followed by "N" or "S", replaces the hemisphere
          * symbol by a sign and makes sure that the number uses at least 3 digits (e.g. "2N" → "+002").
+         * This string will be used for better sorting order.
          */
         private static void uniformizeZoneNumber(final StringBuilder b) {
             if (b.indexOf("/") < 0) {

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -50,16 +50,20 @@ import org.apache.sis.referencing.cs.Def
 import org.apache.sis.referencing.crs.DefaultVerticalCRS;
 import org.apache.sis.internal.jaxb.metadata.replace.ReferenceSystemMetadata;
 import org.apache.sis.internal.jaxb.gmx.Anchor;
+import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.referencing.NamedIdentifier;
 import org.apache.sis.util.iso.SimpleInternationalString;
 import org.apache.sis.util.ComparisonMode;
 import org.apache.sis.xml.Namespaces;
 import org.apache.sis.xml.MarshallerPool;
 import org.apache.sis.xml.IdentifierSpace;
+import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.TestUtilities;
 import org.apache.sis.test.XMLComparator;
 import org.apache.sis.test.XMLTestCase;
 import org.apache.sis.test.DependsOn;
+import org.junit.After;
+import org.junit.Rule;
 import org.junit.Test;
 
 import static org.apache.sis.test.Assert.*;
@@ -85,6 +89,21 @@ import org.apache.sis.internal.jdk7.Stan
 @DependsOn(ReferencingInMetadataTest.class)
 public strictfp class DefaultMetadataTest extends XMLTestCase {
     /**
+     * A JUnit {@link Rule} for listening to log events. This field is public because JUnit requires us to
+     * do so, but should be considered as an implementation details (it should have been a private field).
+     */
+    @Rule
+    public final LoggingWatcher loggings = new LoggingWatcher(Loggers.XML);
+
+    /**
+     * Verifies that no unexpected warning has been emitted in any test defined in this class.
+     */
+    @After
+    public void assertNoUnexpectedLog() {
+        loggings.assertNoUnexpectedLog();
+    }
+
+    /**
      * Sets the temporal extent. The current implementation does nothing, because {@code sis-metadata} does not have
      * any dependency to {@code sis-temporal}. However a future version or an other module may implement this method.
      *
@@ -401,5 +420,6 @@ public strictfp class DefaultMetadataTes
         pool.recycle(unmarshaller);
         final DefaultMetadata expected = createHardCoded();
         assertTrue(metadata.equals(expected, ComparisonMode.DEBUG));
+        loggings.skipNextLogIfContains("sis-temporal");
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -202,6 +202,7 @@ import org.junit.BeforeClass;
     org.apache.sis.referencing.factory.MultiAuthoritiesFactoryTest.class,
     org.apache.sis.referencing.factory.sql.EPSGFactoryTest.class,
     org.apache.sis.referencing.factory.sql.EPSGInstallerTest.class,
+    org.apache.sis.referencing.factory.sql.EPSGDataFormatterTest.class,
     org.apache.sis.referencing.EPSGFactoryFallbackTest.class,
     org.apache.sis.referencing.AuthorityFactoriesTest.class,
     org.apache.sis.referencing.CRSTest.class,

Modified: sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml (original)
+++ sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml Mon Feb 22 16:56:41 2016
@@ -26,7 +26,7 @@
                 xmlns:xlink        = "http://www.w3.org/1999/xlink"
                 gml:id             = "WorldMercator">
 
-  <gml:identifier codeSpace="test">3395</gml:identifier>  <!-- Not the real EPSG::3395 -->
+  <gml:identifier codeSpace="test">3395</gml:identifier>                    <!-- Not the real EPSG:3395 -->
   <gml:name>World Mercator</gml:name>
   <gml:domainOfValidity>
     <gmd:EX_Extent>
@@ -64,7 +64,7 @@
   </gml:coordinateOperationAccuracy>
   <gml:method>
     <gml:OperationMethod gml:id="Mercator">
-      <gml:identifier codeSpace="test">19883</gml:identifier>  <!-- Not the real EPSG::19883 -->
+      <gml:identifier codeSpace="test">19883</gml:identifier>               <!-- Not the real EPSG:19883 -->
       <gml:name>Mercator (1SP)</gml:name>
       <gml:formula>See EPSG guide.</gml:formula>
       <gml:sourceDimensions>2</gml:sourceDimensions>

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LongConsumer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LongConsumer.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LongConsumer.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LongConsumer.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -18,7 +18,7 @@ package org.apache.sis.internal.jdk8;
 
 
 /**
- * Placeholder for the {@link ava.util.function.LongConsumer} interface.
+ * Placeholder for the {@link java.util.function.LongConsumer} interface.
  */
 public interface LongConsumer {
     /**

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/package-info.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/package-info.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/package-info.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -25,7 +25,7 @@
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.3
+ * @version 0.7
  * @module
  */
 package org.apache.sis.internal.jdk8;

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -24,7 +24,7 @@ package org.apache.sis.internal.system;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.5
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public final class Semaphores {
@@ -53,6 +53,16 @@ public final class Semaphores {
     public static final byte NULL_COLLECTION = 4;
 
     /**
+     * A flag to indicate that a parameter value outside its domain of validity should not cause an exception
+     * to be thrown. This flag is set only when creating a deprecated operation from the EPSG database.
+     * Typically the operation is deprecated precisely because it used invalid parameter values,
+     * but SIS should still be able to create those deprecated objects if a user request them.
+     *
+     * <p><b>Example:</b> EPSG:3752 was a Mercator (variant A) projection but set the latitude of origin to 41°S.</p>
+     */
+    public static final byte SUSPEND_PARAMETER_CHECK = 8;
+
+    /**
      * The flags per running thread.
      */
     private static final ThreadLocal<Semaphores> FLAGS = new ThreadLocal<Semaphores>();

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -83,9 +83,9 @@ public final class Supervisor extends St
      */
     public static synchronized void register() {
         if (name == null) {
-            name = ObjectName.WILDCARD; // In case of failure.
-            final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
+            name = ObjectName.WILDCARD;                         // In case of failure.
             try {
+                final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
                 final ObjectName n = new ObjectName(NAME);
                 server.registerMBean(new Supervisor(), n);
                 name = n; // Store only on success.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -76,7 +76,7 @@ public final class CollectionsExt extend
     public static <T> T first(final Iterable<T> collection) {
         if (collection != null) {
             final Iterator<T> it = collection.iterator();
-            if (it != null && it.hasNext()) { // This check for null is paranoiac.
+            if (it != null && it.hasNext()) {                       // This check for null is paranoiac.
                 return it.next();
             }
         }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -149,7 +149,7 @@ public abstract class SetOfUnknownSize<E
          * iterate over the elements of this Set. The reason is that this Set may compute the values dynamically and
          * it is sometime difficult to ensure that this Set's iterator is fully consistent with the values recognized
          * by the contains(Object) method. For example the iterator may return "EPSG:4326" while the contains(Object)
-         * method may accept both "EPSG:4326" and "EPSG::4326". For this equals(Object) method, we consider the
+         * method may accept both "EPSG:4326" and "EPSG:4326". For this equals(Object) method, we consider the
          * contains(Object) method of the other Set as more reliable.
          */
         if (object == this) {

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -91,7 +91,7 @@ public class UnmodifiableArrayList<E> ex
      *
      * @param array The array to wrap.
      */
-    protected UnmodifiableArrayList(final E[] array) { // NOT "E..." - see javadoc.
+    protected UnmodifiableArrayList(final E[] array) {                          // NOT "E..." - see javadoc.
         this.array = Objects.requireNonNull(array);
     }
 
@@ -115,7 +115,7 @@ public class UnmodifiableArrayList<E> ex
      * @return The given array wrapped in an unmodifiable list, or {@code null} if the given
      *         array was null.
      */
-    public static <E> UnmodifiableArrayList<E> wrap(final E[] array) { // NOT "E..." - see javadoc.
+    public static <E> UnmodifiableArrayList<E> wrap(final E[] array) {          // NOT "E..." - see javadoc.
         return (array != null) ? new UnmodifiableArrayList<E>(array) : null;
     }
 

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/math/DecimalFunctions.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/math/DecimalFunctions.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/math/DecimalFunctions.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/math/DecimalFunctions.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -441,8 +441,10 @@ public final class DecimalFunctions exte
      *   <li>Otherwise this method returns {@code fractionDigits}.</li>
      * </ul>
      *
-     * Examples:
+     * <div class="note"><b>Note:</b>
+     * The threshold of 4 trailing fraction digits is arbitrary and may change in any future SIS version.</div>
      *
+     * <div class="note"><b>Examples:</b>
      * <ul>
      *   <li>{@code fractionDigitsForValue(179.12499999999824)} returns 14,
      *       the amount of digits after the decimal separator.</li>
@@ -455,9 +457,7 @@ public final class DecimalFunctions exte
      *   <li>{@code fractionDigitsForValue(179.12499997999999, 3)} returns 14 because rounding the 3 last digits
      *       results in 179.12499997000. The condition for 4 trailing zero fraction digits is not meet.</li>
      * </ul>
-     *
-     * <div class="note"><b>Note:</b>
-     * The threshold of 4 trailing fraction digits is arbitrary and may change in any future SIS version.</div>
+     * </div>
      *
      * @param  value The value for which to get the number of significant fraction fraction digits minus rounding error.
      * @param  uncertainDigits Number of trailing fraction digits which may be rounding error artefacts.

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -22,6 +22,7 @@ import java.util.FormattableFlags;
 import java.io.Serializable;
 import javax.measure.unit.Unit;
 import org.apache.sis.internal.util.Utilities;
+import org.apache.sis.internal.util.PatchedUnitFormat;
 import org.apache.sis.util.collection.CheckedContainer;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Emptiable;
@@ -676,9 +677,13 @@ public class Range<E extends Comparable<
         }
         final Unit<?> unit = unit();
         if (unit != null) {
-            // No need to check if we should omit the space because Unit.toString()
-            // uses UCUM format, so we will never have symbol like the ° one.
-            buffer.append(' ').append(unit);
+            final String symbol = PatchedUnitFormat.toString(unit);
+            if (!symbol.isEmpty()) {
+                if (Character.isLetterOrDigit(symbol.codePointAt(0))) {
+                    buffer.append(' ');
+                }
+                buffer.append(symbol);
+            }
         }
         return buffer.toString();
     }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -277,8 +277,9 @@ class SexagesimalConverter extends UnitC
          * @param  unit  The vocabulary key for the field (minutes or seconds).
          * @return The exception to throw.
          */
-        private static IllegalArgumentException illegalField(final double value, final double field, final int unit) {
-            return new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentField_4, "angle", value, unit, field));
+        private static IllegalArgumentException illegalField(final double value, final double field, final short unit) {
+            return new IllegalArgumentException(Errors.format(Errors.Keys.IllegalArgumentField_4,
+                    "angle", value, Vocabulary.format(unit), field));
         }
     }
 }

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -70,7 +70,7 @@ public final class Units extends Static
     public static final Unit<Duration> MILLISECOND = SI.MetricPrefix.MILLI(SI.SECOND);
 
     /**
-     * The EPSG::1029 definition of year.
+     * The EPSG:1029 definition of year.
      */
     private static final Unit<Duration> YEAR = SI.SECOND.divide(31556925.445);
 
@@ -593,8 +593,8 @@ public final class Units extends Static
      *
      * <p>The same unit may be represented by different EPSG codes depending on the context:</p>
      * <ul>
-     *   <li>EPSG::9102 – <cite>degree</cite> – is used for prime meridian and coordinate operation parameters.</li>
-     *   <li>EPSG::9122 – <cite>degree (supplier to define representation)</cite> – is used for coordinate system axes.</li>
+     *   <li>EPSG:9102 – <cite>degree</cite> – is used for prime meridian and coordinate operation parameters.</li>
+     *   <li>EPSG:9122 – <cite>degree (supplier to define representation)</cite> – is used for coordinate system axes.</li>
      * </ul>
      *
      * When such choice exists, the code to return is determined by the {@code inAxis} argument,

Modified: sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -41,8 +41,7 @@ import static java.lang.Character.*;
  */
 public final class StringBuilders extends Static {
     /**
-     * Letters in the range 00C0 (192) to 00FF (255) inclusive with their accent removed,
-     * when possible.
+     * Letters in the range 00C0 (192) to 00FF (255) inclusive with their accent removed, when possible.
      */
     private static final String ASCII = "AAAAAAÆCEEEEIIIIDNOOOOO*OUUUUYÞsaaaaaaæceeeeiiiionooooo/ouuuuyþy";
     // Original letters (with accent) = "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ";



Mime
View raw message