sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1731686 [1/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
Author: desruisseaux
Date: Mon Feb 22 16:56:41 2016
New Revision: 1731686

URL: http://svn.apache.org/viewvc?rev=1731686&view=rev
Log:
Merge from the JDK7 branch.

Added:
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
      - copied unchanged from r1731655, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/EPSGParameterDomain.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java
      - copied, changed from r1731655, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/InstallationScriptProvider.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java
      - copied unchanged from r1731655, sis/branches/JDK7/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameter.java
    sis/branches/JDK6/core/sis-referencing/src/main/resources/org/
      - copied from r1731655, sis/branches/JDK7/core/sis-referencing/src/main/resources/org/
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatter.java
      - copied, changed from r1731655, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatter.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatterTest.java
      - copied unchanged from r1731655, sis/branches/JDK7/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGDataFormatterTest.java
Modified:
    sis/branches/JDK6/   (props changed)
    sis/branches/JDK6/core/pom.xml
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
    sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Transliterator.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java
    sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java
    sis/branches/JDK6/core/sis-referencing/pom.xml
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DeprecatedCode.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticAuthorityFactory.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/IdentifiedObjectSet.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/UnavailableFactoryException.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/AuthorityCodes.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGFactory.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGInstaller.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/SQLTranslator.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/package-info.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
    sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/internal/jaxb/referencing/CC_GeneralOperationParameterTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/AuthorityFactoriesTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/CommonCRSTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/EPSGFactoryFallbackTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/crs/DefaultProjectedCRSTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2002.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2004.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2005.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/GIGS2006.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/MultiAuthoritiesFactoryTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGFactoryTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/EPSGInstallerTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateOperationMethods.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/integration/DefaultMetadataTest.java
    sis/branches/JDK6/core/sis-referencing/src/test/java/org/apache/sis/test/suite/ReferencingTestSuite.java
    sis/branches/JDK6/core/sis-referencing/src/test/resources/org/apache/sis/referencing/operation/Conversion.xml
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/LongConsumer.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/jdk8/package-info.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Semaphores.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/system/Supervisor.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/CollectionsExt.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/SetOfUnknownSize.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/internal/util/UnmodifiableArrayList.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/math/DecimalFunctions.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Range.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/SexagesimalConverter.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/measure/Units.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/StringBuilders.java
    sis/branches/JDK6/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/measure/MeasurementRangeTest.java
    sis/branches/JDK6/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
    sis/branches/JDK6/ide-project/NetBeans/build.xml
    sis/branches/JDK6/pom.xml

Propchange: sis/branches/JDK6/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Feb 22 16:56:41 2016
@@ -1,4 +1,4 @@
 /sis/branches/Android:1430670-1480699
-/sis/branches/JDK7:1394913-1728771
-/sis/branches/JDK8:1584960-1728765
+/sis/branches/JDK7:1394913-1731655
+/sis/branches/JDK8:1584960-1731653
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK6/core/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/pom.xml?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/pom.xml (original)
+++ sis/branches/JDK6/core/pom.xml Mon Feb 22 16:56:41 2016
@@ -67,6 +67,17 @@
       </roles>
     </developer>
     <developer>
+      <name>Rémi Maréchal</name>
+      <id>rmarechal</id>
+      <email>remi.marechal@geomatys.com</email>
+      <organization>Geomatys</organization>
+      <organizationUrl>http://www.geomatys.com/</organizationUrl>
+      <timezone>+1</timezone>
+      <roles>
+        <role>developer</role>
+      </roles>
+    </developer>
+    <developer>
       <name>Travis L. Pinney</name>
       <id>tlpinney</id>
       <email>travis.pinney@gmail.com</email>

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ReferencingServices.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -64,7 +64,7 @@ import org.apache.sis.util.Deprecable;
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.7
  * @module
  */
 public class ReferencingServices extends OptionalDependency {
@@ -586,6 +586,8 @@ public class ReferencingServices extends
      * @return The information, or {@code null} if none.
      *
      * @see org.apache.sis.internal.util.MetadataServices#getInformation(String)
+     *
+     * @since 0.7
      */
     public String getInformation(String key, Locale locale) {
         return null;

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -72,7 +72,7 @@ public abstract class Initializer {
     /**
      * The property name for the home of Derby databases.
      */
-    private static final String HOME_KEY = "derby.system.home";
+    private static final String DERBY_HOME_KEY = "derby.system.home";
 
     /**
      * Name of the JNDI resource to lookup in the {@code "java:comp/env"} context.
@@ -241,8 +241,8 @@ public abstract class Initializer {
              * At this point we determined that there is no JNDI context or no object binded to "jdbc/SpatialMetadata".
              * As a fallback, try to open the Derby database located in $SIS_DATA/Databases/SpatialMetadata directory.
              */
-            boolean create = false;
-            final String home = System.getProperty(HOME_KEY);
+            final boolean create;
+            final String home = System.getProperty(DERBY_HOME_KEY);
             final Path dir = DataDirectory.DATABASES.getDirectory();
             if (dir != null) {
                 Path path = dir.resolve(DATABASE);
@@ -267,6 +267,8 @@ public abstract class Initializer {
                 create = !Files.exists(path);
                 source = forJavaDB(path.toString());
             } else if (home != null) {
+                final Path path = Paths.get(home);
+                create = !Files.exists(path.resolve(DATABASE)) && Files.isDirectory(path);
                 source = forJavaDB(DATABASE);
             } else {
                 return null;

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/SQLUtilities.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.internal.metadata.sql;
 
+import java.sql.SQLException;
+import java.sql.DatabaseMetaData;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Characters;
 import org.apache.sis.util.CharSequences;
@@ -42,6 +44,21 @@ public final class SQLUtilities extends
     }
 
     /**
+     * Returns a simplified form of the URL (truncated before the first {@code ?} or {@code ;} character),
+     * for logging or informative purpose only.
+     *
+     * @param  metadata The metadata of the database.
+     * @return A simplified version of database URL.
+     * @throws SQLException if an error occurred while fetching the URL.
+     */
+    public static String getSimplifiedURL(final DatabaseMetaData metadata) throws SQLException {
+        String url = metadata.getURL();
+        int s1 = url.indexOf('?'); if (s1 < 0) s1 = url.length();
+        int s2 = url.indexOf(';'); if (s2 < 0) s2 = url.length();
+        return url.substring(0, Math.min(s1, s2));
+    }
+
+    /**
      * Returns a string like the given string but with all characters that are not letter or digit
      * replaced by the wildcard % character.
      *

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/ScriptRunner.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -21,8 +21,7 @@ import java.util.HashMap;
 import java.util.Locale;
 import java.io.EOFException;
 import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
+import java.io.BufferedReader;
 import java.io.LineNumberReader;
 import java.io.StringReader;
 import java.sql.Statement;
@@ -100,12 +99,6 @@ public class ScriptRunner {
     private static final String ESCAPE = "$BODY$";
 
     /**
-     * The character encoding of SQL scripts. Typical values are {@code "UTF-8"} or {@code "ISO-8859-1"}.
-     * For SQL scripts provided by the EPSG, the encoding shall be {@code "ISO-8859-1"}.
-     */
-    private final String encoding;
-
-    /**
      * The presumed dialect spoken by the database.
      */
     private final Dialect dialect;
@@ -232,17 +225,13 @@ public class ScriptRunner {
      * </ul>
      *
      * @param connection        The connection to the database.
-     * @param encoding          The encoding of SQL scripts. Typical values are {@code "UTF-8"} or {@code "ISO-8859-1"}.
-     *                          For SQL scripts provided by the EPSG authority, the encoding shall be {@code "ISO-8859-1"}.
      * @param maxRowsPerInsert  Maximum number of rows per {@code "INSERT INTO"} statement.
      * @throws SQLException if an error occurred while creating a SQL statement.
      */
-    protected ScriptRunner(final Connection connection, final String encoding, int maxRowsPerInsert) throws SQLException {
+    protected ScriptRunner(final Connection connection, int maxRowsPerInsert) throws SQLException {
         ArgumentChecks.ensureNonNull("connection", connection);
-        ArgumentChecks.ensureNonNull("encoding", encoding);
         ArgumentChecks.ensurePositive("maxRowsPerInsert", maxRowsPerInsert);
         final DatabaseMetaData metadata = connection.getMetaData();
-        this.encoding           = encoding;
         this.dialect            = Dialect.guess(metadata);
         this.identifierQuote    = metadata.getIdentifierQuoteString();
         this.isSchemaSupported  = metadata.supportsSchemasInTableDefinitions() &&
@@ -278,10 +267,10 @@ public class ScriptRunner {
                  * In addition, we must declare explicitly that we want the tables to be cached on disk. Finally,
                  * HSQL expects "CHR" to be spelled "CHAR".
                  */
-                replace("UNIQUE", "");
-                replace("CHR", "CHAR");
-                replace("CREATE", MORE_WORDS);
-                replace("CREATE TABLE", "CREATE CACHED TABLE");
+                addReplacement("UNIQUE", "");
+                addReplacement("CHR", "CHAR");
+                addReplacement("CREATE", MORE_WORDS);
+                addReplacement("CREATE TABLE", "CREATE CACHED TABLE");
                 break;
             }
         }
@@ -317,13 +306,24 @@ public class ScriptRunner {
      * @param inScript The word in the script which need to be replaced.
      * @param replacement The word to use instead.
      */
-    protected final void replace(final String inScript, final String replacement) {
+    protected final void addReplacement(final String inScript, final String replacement) {
         if (replacements.put(inScript, replacement) != null) {
             throw new IllegalArgumentException(inScript);
         }
     }
 
     /**
+     * Returns the word to use instead than the given one.
+     * If there is no replacement, then {@code inScript} is returned.
+     *
+     * @param inScript The word in the script which need to be replaced.
+     * @return The word to use instead.
+     */
+    protected final String getReplacement(final String inScript) {
+        return JDK8.getOrDefault(replacements, inScript, inScript);
+    }
+
+    /**
      * For every entries in the replacements map, replace the entry value by the value returned by
      * {@code function(key, value)}.
      *
@@ -343,44 +343,24 @@ public class ScriptRunner {
      * @throws SQLException if an error occurred while executing a SQL statement.
      */
     public final int run(final String statement) throws IOException, SQLException {
-        return run(new LineNumberReader(new StringReader(statement)));
-    }
-
-    /**
-     * Runs the SQL script from the given input stream, which will be closed.
-     * Lines are read and grouped up to the terminal {@value #END_OF_STATEMENT} character, then sent to the database.
-     *
-     * @param  filename Name of the SQL script being executed. This is used only for error reporting.
-     * @param  in The stream to read. <strong>This stream will be closed</strong> at the end.
-     * @return The number of rows added or modified as a result of the script execution.
-     * @throws IOException if an error occurred while reading the input.
-     * @throws SQLException if an error occurred while executing a SQL statement.
-     */
-    public final int run(final String filename, final InputStream in) throws IOException, SQLException {
-        currentFile = filename;
-        final int count;
-        LineNumberReader reader = new LineNumberReader(new InputStreamReader(in, encoding));
-        try {
-            count = run(reader);
-        } finally {
-            reader.close();
-        }
-        currentFile = null;
-        return count;
+        return run(null, new LineNumberReader(new StringReader(statement)));
     }
 
     /**
      * Run the script from the given reader. Lines are read and grouped up to the
      * terminal {@value #END_OF_STATEMENT} character, then sent to the database.
      *
+     * @param  filename Name of the SQL script being executed. This is used only for error reporting.
      * @param  in The stream to read. It is caller's responsibility to close this reader.
      * @return The number of rows added or modified as a result of the script execution.
      * @throws IOException if an error occurred while reading the input.
      * @throws SQLException if an error occurred while executing a SQL statement.
      */
-    private int run(final LineNumberReader in) throws IOException, SQLException {
-        int     statementCount     = 0;
-        boolean isInsideText       = false;
+    public final int run(final String filename, final BufferedReader in) throws IOException, SQLException {
+        currentFile = filename;
+        currentLine = 0;
+        int     statementCount     = 0;         // For informative purpose only.
+        int     posOpeningQuote    = -1;        // -1 if we are not inside a text.
         boolean isInsideIdentifier = false;
         final StringBuilder buffer = new StringBuilder();
         String line;
@@ -393,7 +373,9 @@ public class ScriptRunner {
                 if (s >= line.length() || line.regionMatches(s, COMMENT, 0, COMMENT.length())) {
                     continue;
                 }
-                currentLine = in.getLineNumber();
+                if (in instanceof LineNumberReader) {
+                    currentLine = ((LineNumberReader) in).getLineNumber();
+                }
             } else {
                 buffer.append('\n');
             }
@@ -429,7 +411,7 @@ public class ScriptRunner {
 parseLine:  while (pos < length) {
                 int c = buffer.codePointAt(pos);
                 int n = Character.charCount(c);
-                if (!isInsideText && !isInsideIdentifier) {
+                if (posOpeningQuote < 0 && !isInsideIdentifier) {
                     int start = pos;
                     while (Character.isUnicodeIdentifierStart(c)) {
                         /*
@@ -480,7 +462,7 @@ parseLine:  while (pos < length) {
                      * replace the standard quote character by the database-specific one.
                      */
                     case IDENTIFIER_QUOTE: {
-                        if (!isInsideText) {
+                        if (posOpeningQuote < 0) {
                             isInsideIdentifier = !isInsideIdentifier;
                             length = buffer.replace(pos, pos + n, identifierQuote).length();
                             n = identifierQuote.length();
@@ -493,10 +475,12 @@ parseLine:  while (pos < length) {
                      */
                     case QUOTE: {
                         if (!isInsideIdentifier) {
-                            if (!isInsideText) {
-                                isInsideText = true;
+                            if (posOpeningQuote < 0) {
+                                posOpeningQuote = pos;
                             } else if ((pos += n) >= length || buffer.codePointAt(pos) != QUOTE) {
-                                isInsideText = false;
+                                editText(buffer, posOpeningQuote, pos);
+                                pos -= length - (length = buffer.length());
+                                posOpeningQuote = -1;
                                 continue;   // Because we already skipped the ' character.
                             } // else found a double ' character, which means to escape it.
                         }
@@ -507,7 +491,7 @@ parseLine:  while (pos < length) {
                      * since SQL statement in JDBC are not expected to contain it.
                      */
                     case END_OF_STATEMENT: {
-                        if (!isInsideText && !isInsideIdentifier) {
+                        if (posOpeningQuote < 0 && !isInsideIdentifier) {
                             if (CharSequences.skipLeadingWhitespaces(buffer, pos + n, length) >= length) {
                                 buffer.setLength(pos);
                             }
@@ -525,10 +509,24 @@ parseLine:  while (pos < length) {
         if (!line.isEmpty() && !line.startsWith(COMMENT)) {
             throw new EOFException(Errors.format(Errors.Keys.UnexpectedEndOfString_1, line));
         }
+        currentFile = null;
         return statementCount;
     }
 
     /**
+     * Invoked for each text found in a SQL statement. The text, <em>including its quote characters</em>,
+     * is the {@code sql} substring from index {@code lower} inclusive to {@code upper} exclusive.
+     * Subclasses can override this method if they wish to modify the text content.
+     * Modifications are applied directly in the given {@code sql} buffer.
+     *
+     * @param sql   The whole SQL statement.
+     * @param lower Index of the opening quote character ({@code '}) of the text in {@code sql}.
+     * @param upper Index after the closing quote character ({@code '}) of the text in {@code sql}.
+     */
+    protected void editText(final StringBuilder sql, final int lower, final int upper) {
+    }
+
+    /**
      * Executes the given SQL statement.
      * This method performs the following choices:
      *
@@ -580,7 +578,7 @@ parseLine:  while (pos < length) {
                                 if (subSQL.charAt(end - 1) == ',') {
                                     end--;
                                 }
-                                count += statement.executeUpdate(sql.append(subSQL, begin, end).toString());
+                                count += statement.executeUpdate(currentSQL = sql.append(subSQL, begin, end).toString());
                                 sql.setLength(startOfValues);       // Prepare for next INSERT INTO statement.
                                 nrows = maxRowsPerInsert;
                                 begin = endOfLine + 1;
@@ -588,7 +586,7 @@ parseLine:  while (pos < length) {
                         }
                         // The remaining of the statement to be executed.
                         int end = CharSequences.skipTrailingWhitespaces(subSQL, begin, subSQL.length());
-                        subSQL = (end > begin) ? sql.append(subSQL, begin, end).toString() : null;
+                        currentSQL = subSQL = (end > begin) ? sql.append(subSQL, begin, end).toString() : null;
                     }
                 }
             }
@@ -621,7 +619,8 @@ parseLine:  while (pos < length) {
     public String status(final Locale locale) {
         String position = null;
         if (currentFile != null) {
-            position = Errors.getResources(locale).getString(Errors.Keys.ErrorInFileAtLine_2, currentFile, currentLine);
+            position = Errors.getResources(locale).getString(Errors.Keys.ErrorInFileAtLine_2, currentFile,
+                    (currentLine != 0) ? currentLine : '?');
         }
         if (currentSQL != null) {
             final StringBuilder buffer = new StringBuilder();

Modified: sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Transliterator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Transliterator.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Transliterator.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/Transliterator.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -363,8 +363,13 @@ public abstract class Transliterator imp
                     }
                 }
             } else {
-                if      (abbreviation.equalsIgnoreCase("Lat" )) abbreviation = "B";
-                else if (abbreviation.equalsIgnoreCase("Long")) abbreviation = "L";
+                if (abbreviation.equalsIgnoreCase("Lat")) {
+                    abbreviation = "B";
+                } else if (abbreviation.regionMatches(true, 0, "Long", 0,
+                        Math.min(3, Math.max(4, abbreviation.length()))))   // Accept "Lon" or "Long".
+                {
+                    abbreviation = "L";
+                }
             }
         }
         return abbreviation;

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/AllMetadataTest.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -44,12 +44,11 @@ import static org.junit.Assert.*;
 @DependsOn(org.apache.sis.metadata.PropertyAccessorTest.class)
 public final strictfp class AllMetadataTest extends MetadataTestCase {
     /**
-     * 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).
+     * 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 listener = new LoggingWatcher(Context.LOGGER);
+    public final LoggingWatcher loggings = new LoggingWatcher(Context.LOGGER);
 
     /**
      * Creates a new test case with all GeoAPI interfaces and code lists to test.
@@ -219,8 +218,12 @@ public final strictfp class AllMetadataT
     @Test
     @Override
     public void testPropertyValues() {
-        listener.maximumLogCount = 4;
         super.testPropertyValues();
+        loggings.assertNextLogContains("angularDistance", "distance");
+        loggings.assertNextLogContains("distance", "equivalentScale");
+        loggings.assertNextLogContains("equivalentScale", "levelOfDetail");
+        loggings.assertNextLogContains("levelOfDetail", "vertical");
+        loggings.assertNoUnexpectedLog();
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultResolutionTest.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -25,6 +25,7 @@ import org.apache.sis.internal.jaxb.Sche
 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.Rule;
 import org.junit.Test;
 
@@ -36,27 +37,25 @@ import static org.apache.sis.test.Assert
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.3
- * @version 0.6
+ * @version 0.7
  * @module
  */
 @DependsOn(DefaultRepresentativeFractionTest.class)
 public final strictfp class DefaultResolutionTest extends TestCase {
     /**
-     * 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).
+     * 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 listener = new LoggingWatcher(Context.LOGGER) {
-        /**
-         * Ensures that the logging message contains the name of the exclusive properties.
-         */
-        @Override
-        protected void verifyMessage(final String message) {
-            assertTrue(message.contains("distance"));
-            assertTrue(message.contains("equivalentScale"));
-        }
-    };
+    public final LoggingWatcher loggings = new LoggingWatcher(Context.LOGGER);
+
+    /**
+     * Verifies that no unexpected warning has been emitted in any test defined in this class.
+     */
+    @After
+    public void assertNoUnexpectedLog() {
+        loggings.assertNoUnexpectedLog();
+    }
 
     /**
      * Tests the {@link DefaultResolution#DefaultResolution(RepresentativeFraction)} constructor.
@@ -86,11 +85,13 @@ public final strictfp class DefaultResol
         metadata.setDistance(2.0);
         assertEquals("distance", Double.valueOf(2.0), metadata.getDistance());
         assertNull("equivalentScale", metadata.getEquivalentScale());
+        loggings.assertNoUnexpectedLog();
 
-        listener.maximumLogCount = 1;
         metadata.setEquivalentScale(scale);
         assertSame("equivalentScale", scale, metadata.getEquivalentScale());
         assertNull("distance", metadata.getDistance());
+        loggings.assertNextLogContains("distance", "equivalentScale");
+        loggings.assertNoUnexpectedLog();
 
         metadata.setDistance(null); // Expected to be a no-op.
         assertSame("equivalentScale", scale, metadata.getEquivalentScale());

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescriptionTest.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -20,6 +20,7 @@ import org.apache.sis.util.iso.SimpleInt
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.TestCase;
+import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -36,21 +37,19 @@ import static org.apache.sis.test.Assert
  */
 public final strictfp class DefaultScopeDescriptionTest extends TestCase {
     /**
-     * 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).
+     * 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 listener = new LoggingWatcher(Context.LOGGER) {
-        /**
-         * Ensures that the logging message contains the name of the exclusive properties.
-         */
-        @Override
-        protected void verifyMessage(final String message) {
-            assertTrue(message.contains("dataset"));
-            assertTrue(message.contains("other"));
-        }
-    };
+    public final LoggingWatcher loggings = new LoggingWatcher(Context.LOGGER);
+
+    /**
+     * Verifies that no unexpected warning has been emitted in any test defined in this class.
+     */
+    @After
+    public void assertNoUnexpectedLog() {
+        loggings.assertNoUnexpectedLog();
+    }
 
     /**
      * Tests the various setter methods. Since they are exclusive properties,
@@ -61,13 +60,15 @@ public final strictfp class DefaultScope
         final DefaultScopeDescription metadata = new DefaultScopeDescription();
         metadata.setDataset("A dataset");
         assertEquals("dataset", "A dataset", metadata.getDataset());
+        loggings.assertNoUnexpectedLog();
 
-        listener.maximumLogCount = 1;
         metadata.setOther(new SimpleInternationalString("Other value"));
         assertEquals("other", "Other value", String.valueOf(metadata.getOther()));
         assertNull("dataset", metadata.getDataset());
+        loggings.assertNextLogContains("dataset", "other");
+        loggings.assertNoUnexpectedLog();
 
-        metadata.setDataset(null); // Expected to be a no-op.
+        metadata.setDataset(null);                  // Expected to be a no-op.
         assertEquals("other", "Other value", String.valueOf(metadata.getOther()));
         assertNull("dataset", metadata.getDataset());
 

Modified: sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/spatial/DefaultGeorectifiedTest.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -21,6 +21,7 @@ import org.apache.sis.util.iso.SimpleInt
 import org.apache.sis.internal.jaxb.Context;
 import org.apache.sis.test.LoggingWatcher;
 import org.apache.sis.test.TestCase;
+import org.junit.After;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -37,21 +38,19 @@ import static org.apache.sis.test.Assert
  */
 public final strictfp class DefaultGeorectifiedTest extends TestCase {
     /**
-     * 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).
+     * 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 listener = new LoggingWatcher(Context.LOGGER) {
-        /**
-         * Ensures that the logging message contains the name of the exclusive properties.
-         */
-        @Override
-        protected void verifyMessage(final String message) {
-            assertTrue(message.contains("checkPointAvailability"));
-            assertTrue(message.contains("checkPointDescription"));
-        }
-    };
+    public final LoggingWatcher loggings = new LoggingWatcher(Context.LOGGER);
+
+    /**
+     * Verifies that no unexpected warning has been emitted in any test defined in this class.
+     */
+    @After
+    public void assertNoUnexpectedLog() {
+        loggings.assertNoUnexpectedLog();
+    }
 
     /**
      * Tests {@link DefaultGeorectified#isCheckPointAvailable()} and
@@ -66,11 +65,13 @@ public final strictfp class DefaultGeore
         // Setting the description shall set automatically the availability.
         metadata.setCheckPointDescription(description);
         assertTrue("checkPointAvailability", metadata.isCheckPointAvailable());
+        loggings.assertNoUnexpectedLog();
 
         // Setting the availability flag shall hide the description and logs a message.
-        listener.maximumLogCount = 1;
         metadata.setCheckPointAvailable(false);
         assertNull("checkPointDescription", metadata.getCheckPointDescription());
+        loggings.assertNextLogContains("checkPointDescription", "checkPointAvailability");
+        loggings.assertNoUnexpectedLog();
 
         // Setting the availability flag shall bring back the description.
         metadata.setCheckPointAvailable(true);

Modified: sis/branches/JDK6/core/sis-referencing/pom.xml
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/pom.xml?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/pom.xml (original)
+++ sis/branches/JDK6/core/sis-referencing/pom.xml Mon Feb 22 16:56:41 2016
@@ -70,6 +70,17 @@ Implementations of Coordinate Reference
         <role>developer</role>
       </roles>
     </developer>
+    <developer>
+      <name>Rémi Maréchal</name>
+      <id>rmarechal</id>
+      <email>remi.marechal@geomatys.com</email>
+      <organization>Geomatys</organization>
+      <organizationUrl>http://www.geomatys.com/</organizationUrl>
+      <timezone>+1</timezone>
+      <roles>
+        <role>developer</role>
+      </roles>
+    </developer>
   </developers>
 
 

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/jaxb/referencing/Code.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -116,7 +116,7 @@ public final class Code {
              * an EPSG code has the "EPSG" codespace. Example:
              *
              *    - XML: <gml:identifier codeSpace="IOGP">urn:ogc:def:crs:EPSG::4326</gml:identifier>
-             *    - ISO: For "EPSG::4326", Identifier.codeSpace = "EPSG" and Identifier.code = "4326".
+             *    - ISO: For "EPSG:4326", Identifier.codeSpace = "EPSG" and Identifier.code = "4326".
              *
              * Apache SIS attempts to organize this apparent contradiction by considering IOGP as the codespace of
              * the EPSG codespace, but this interpretation is not likely to be widely used by libraries other than

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DeprecatedCode.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DeprecatedCode.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DeprecatedCode.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DeprecatedCode.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -44,18 +44,26 @@ public final class DeprecatedCode extend
     private static final long serialVersionUID = 357222258307746767L;
 
     /**
+     * The replacement for the deprecated object, or {@code null} if none.
+     */
+    public final String replacedBy;
+
+    /**
      * Creates a deprecated identifier.
      *
      * @param authority  Organization or party responsible for definition and maintenance of the code space or code.
      * @param codeSpace  Name or identifier of the person or organization responsible for namespace.
      * @param code       Identifier code or name, optionally from a controlled list or pattern defined by a code space.
      * @param version    The version of the associated code space or code as specified by the code authority, or {@code null} if none.
+     * @param replacedBy The replacement for the deprecated object, or {@code null} if none.
      * @param remarks    Comments on or information about why this identifier is deprecated, or {@code null} if none.
      */
     public DeprecatedCode(final Citation authority, final String codeSpace,
-            final String code, final String version, final InternationalString remarks)
+            final String code, final String version, final String replacedBy,
+            InternationalString remarks)
     {
         super(authority, codeSpace, code, version, remarks);
+        this.replacedBy = replacedBy;
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Equirectangular.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -224,6 +224,8 @@ public final class Equirectangular exten
 
     /**
      * Gets a parameter value identified by the given descriptor and stores it only if different than zero.
+     * This method performs the same work than {@code Initializer.getAndStore(ParameterDescriptor)} in the
+     * {@link org.apache.sis.referencing.operation.projection} package.
      *
      * @param  source     The parameters from which to read the value.
      * @param  target     Where to store the parameter values.
@@ -235,7 +237,7 @@ public final class Equirectangular exten
             final ParameterDescriptor<Double> descriptor) throws IllegalArgumentException
     {
         final double value = source.doubleValue(descriptor);    // Apply a unit conversion if needed.
-        MapProjection.validate(descriptor, value);              // Unconditional validation for semi-axes.
+        MapProjection.validate(descriptor, value);              // Unconditional validation for all parameters.
         if (value != 0) {                                       // All default values in this class are zero.
             target.parameter(descriptor.getName().getCode()).setValue(value);
         }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/MapProjection.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -21,6 +21,7 @@ import java.util.HashMap;
 import java.util.NoSuchElementException;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.measure.unit.SI;
+import javax.measure.unit.Unit;
 import org.opengis.util.FactoryException;
 import org.opengis.util.InternationalString;
 import org.opengis.metadata.Identifier;
@@ -142,7 +143,11 @@ public abstract class MapProjection exte
     }
 
     /**
-     * Validates the given parameter value.
+     * Validates the given parameter value. This method duplicates the verification already
+     * done by {@link org.apache.sis.parameter.DefaultParameterValue#setValue(Object, Unit)}.
+     * But we check again because we have no guarantee that the parameters given by the user
+     * were instances of {@code DefaultParameterValue}, or that the descriptor associated to
+     * the user-specified {@code ParameterValue} has sufficient information.
      *
      * @param  descriptor The descriptor that specify the parameter to validate.
      * @param  value The parameter value in the units given by the descriptor.

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/Mercator2SP.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -77,7 +77,7 @@ public final class Mercator2SP extends A
          * projection according EPSG. But we declare them as optional parameters because they are sometime used in
          * Well Known Text (WKT).
          */
-        builder.setRequired(false); // Will apply to all remaining parameters.
+        builder.setRequired(false);         // Will apply to all remaining parameters.
         final InternationalString remarks = notFormalParameter("Mercator (variant A)");
         final ParameterDescriptor<Double> latitudeOfOrigin = createZeroConstant(builder
                 .addNamesAndIdentifiers(Mercator1SP.LATITUDE_OF_ORIGIN)

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -119,7 +119,7 @@ import org.apache.sis.internal.jdk7.Obje
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.6
+ * @version 0.7
  * @module
  *
  * @see DefaultParameterDescriptor
@@ -151,16 +151,20 @@ public class DefaultParameterValue<T> ex
     /**
      * The value, or {@code null} if undefined.
      * Except for the constructors, the {@link #equals(Object)} and the {@link #hashCode()} methods,
-     * this field shall be read only by {@link #getValue()} and written by {@link #setValue(Object, Unit)}.
+     * this field should be read only by {@link #getValue()} and written only by {@link #setValue(Object, Unit)}.
+     *
+     * @since 0.7
      */
-    private T value;
+    protected T value;
 
     /**
      * The unit of measure for the value, or {@code null} if it does not apply.
      * Except for the constructors, the {@link #equals(Object)} and the {@link #hashCode()} methods,
-     * this field shall be read only by {@link #getUnit()} and written by {@link #setValue(Object, Unit)}.
+     * this field should be read only by {@link #getUnit()} and written only by {@link #setValue(Object, Unit)}.
+     *
+     * @since 0.7
      */
-    private Unit<?> unit;
+    protected Unit<?> unit;
 
     /**
      * Creates a parameter value from the specified descriptor.
@@ -679,8 +683,11 @@ public class DefaultParameterValue<T> ex
     public void setValue(final double value, final Unit<?> unit) throws InvalidParameterValueException {
         try {
             setValue(wrap(value, descriptor.getValueClass()), unit);
+        } catch (InvalidParameterValueException e) {
+            throw e;        // Need to be thrown explicitely because it is a subclass of IllegalArgumentException.
         } catch (IllegalArgumentException e) {
-            throw new InvalidParameterValueException(e.getLocalizedMessage(), Verifier.getDisplayName(descriptor), value);
+            throw (InvalidParameterValueException) new InvalidParameterValueException(
+                    e.getLocalizedMessage(), Verifier.getDisplayName(descriptor), value).initCause(e);
         }
     }
 
@@ -716,17 +723,19 @@ public class DefaultParameterValue<T> ex
      * @param  unit  The unit associated to the new parameter value, or {@code null}.
      * @throws InvalidParameterValueException if the type of {@code value} is inappropriate for this parameter,
      *         or if the value is illegal for some other reason (for example the value is numeric and out of range).
+     *
+     * @see #validate(Object)
      */
     @SuppressWarnings("unchecked")
     protected void setValue(final Object value, final Unit<?> unit) throws InvalidParameterValueException {
         final T convertedValue = Verifier.ensureValidValue(descriptor, value, unit);
         if (value != null) {
             validate(convertedValue);
-            this.value = (T) value; // Type has been verified by Verifier.ensureValidValue(…).
+            this.value = (T) value;                 // Type has been verified by Verifier.ensureValidValue(…).
         } else {
             this.value = descriptor.getDefaultValue();
         }
-        this.unit = unit; // Assign only on success.
+        this.unit = unit;                           // Assign only on success.
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/parameter/Verifier.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -18,6 +18,8 @@ package org.apache.sis.parameter;
 
 import java.util.Map;
 import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
 import java.lang.reflect.Array;
 import javax.measure.unit.Unit;
 import javax.measure.converter.UnitConverter;
@@ -26,9 +28,13 @@ import org.opengis.metadata.Identifier;
 import org.opengis.parameter.ParameterDescriptor;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.parameter.InvalidParameterValueException;
+import org.apache.sis.internal.referencing.EPSGParameterDomain;
+import org.apache.sis.internal.system.Semaphores;
+import org.apache.sis.internal.system.Loggers;
 import org.apache.sis.measure.Range;
 import org.apache.sis.measure.Units;
 import org.apache.sis.util.Numbers;
+import org.apache.sis.util.logging.Logging;
 import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
 
@@ -40,7 +46,7 @@ import org.apache.sis.util.resources.Voc
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
  * @since   0.4
- * @version 0.4
+ * @version 0.7
  * @module
  */
 final class Verifier {
@@ -106,10 +112,13 @@ final class Verifier {
         UnitConverter converter = null;
         Object convertedValue = value;
         if (unit != null) {
-            final Unit<?> def = descriptor.getUnit();
+            Unit<?> def = descriptor.getUnit();
             if (def == null) {
-                final String name = getDisplayName(descriptor);
-                throw new InvalidParameterValueException(Errors.format(Errors.Keys.UnitlessParameter_1, name), name, unit);
+                def = getCompatibleUnit(Parameters.getValueDomain(descriptor), unit);
+                if (def == null) {
+                    final String name = getDisplayName(descriptor);
+                    throw new InvalidParameterValueException(Errors.format(Errors.Keys.UnitlessParameter_1, name), name, unit);
+                }
             }
             if (!unit.equals(def)) {
                 final short expectedID = getUnitMessageID(def);
@@ -161,7 +170,7 @@ final class Verifier {
                         componentType = Numbers.primitiveToWrapper(componentType);
                         for (int i=0; i<length; i++) {
                             Number n = (Number) Array.get(value, i);
-                            n = converter.convert(n.doubleValue()); // Value in units that we can compare.
+                            n = converter.convert(n.doubleValue());         // Value in units that we can compare.
                             try {
                                 n = Numbers.cast(n, componentType.asSubclass(Number.class));
                             } catch (IllegalArgumentException e) {
@@ -176,7 +185,7 @@ final class Verifier {
         }
         /*
          * At this point the user's value has been fully converted to the unit of measurement specified
-         * by the ParameterDescriptor. Now compares the converted value to the restricting given by the
+         * by the ParameterDescriptor.  Now compare the converted value to the restriction given by the
          * descriptor (set of valid values and range of value domain).
          */
         if (convertedValue != null) {
@@ -189,10 +198,23 @@ final class Verifier {
                 error = ensureValidValue(valueClass, validValues,
                         descriptor.getMinimumValue(), descriptor.getMaximumValue(), convertedValue);
             }
+            /*
+             * If we found an error, we will usually throw an exception. An exception to this rule is
+             * when EPSGDataAccess is creating a deprecated ProjectedCRS in which some parameters are
+             * known to be invalid (the CRS was deprecated precisely for that reason). In such cases,
+             * we will log a warning instead than throwing an exception.
+             */
             if (error != null) {
                 error.convertRange(converter);
                 final String name = getDisplayName(descriptor);
-                throw new InvalidParameterValueException(error.message(null, name, value), name, value);
+                final String message = error.message(null, name, value);
+                if (!Semaphores.query(Semaphores.SUSPEND_PARAMETER_CHECK)) {
+                    throw new InvalidParameterValueException(message, name, value);
+                } else {
+                    final LogRecord record = new LogRecord(Level.WARNING, message);
+                    record.setLoggerName(Loggers.COORDINATE_OPERATION);
+                    Logging.log(DefaultParameterValue.class, "setValue", record);
+                }
             }
         }
         return valueClass.cast(convertedValue);
@@ -290,6 +312,22 @@ final class Verifier {
     }
 
     /**
+     * If the given domain of values accepts units of incompatible dimensions, return the unit which is compatible
+     * with the given units. This is a non-public mechanism handling a few parameters in the EPSG database, like
+     * <cite>Ordinate 1 of evaluation point</cite> (EPSG:8617).
+     */
+    private static Unit<?> getCompatibleUnit(final Range<?> valueDomain, final Unit<?> unit) {
+        if (valueDomain instanceof EPSGParameterDomain) {
+            for (final Unit<?> valid : ((EPSGParameterDomain) valueDomain).units) {
+                if (unit.isCompatible(valid)) {
+                    return valid;
+                }
+            }
+        }
+        return null;
+    }
+
+    /**
      * Returns an error message for the error detected by
      * {@link #ensureValidValue(Class, Set, Range, Object)}.
      *

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/AuthorityFactories.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -19,6 +19,7 @@ package org.apache.sis.referencing;
 import java.util.ServiceLoader;
 import java.util.logging.Level;
 import java.util.logging.LogRecord;
+import java.sql.SQLTransientException;
 import org.opengis.util.FactoryException;
 import org.opengis.referencing.AuthorityFactory;
 import org.opengis.referencing.cs.CSAuthorityFactory;
@@ -30,6 +31,7 @@ import org.apache.sis.internal.system.Lo
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.system.SystemListener;
 import org.apache.sis.referencing.factory.MultiAuthoritiesFactory;
+import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.referencing.factory.sql.EPSGFactory;
 import org.apache.sis.util.logging.Logging;
 
@@ -108,9 +110,7 @@ final class AuthorityFactories<T extends
             if (factory == null) try {
                 factory = new EPSGFactory(null);
             } catch (FactoryException e) {
-                final LogRecord record = new LogRecord(Level.CONFIG, e.getLocalizedMessage());
-                record.setLoggerName(Loggers.CRS_FACTORY);
-                Logging.log(CRS.class, "getAuthorityFactory", record);
+                log(Level.CONFIG, e);
                 factory = EPSGFactoryFallback.INSTANCE;
             }
             EPSG[0] = factory;
@@ -119,13 +119,65 @@ final class AuthorityFactories<T extends
     }
 
     /**
-     * Returns the EPSG factory. This method tries to instantiate an {@link EPSGFactory} if possible,
-     * or an {@link EPSGFactoryFallback} otherwise.
+     * Returns the fallback to use if the authority factory is not available. Unless the problem may be temporary,
+     * this method replaces the {@link EPSGFactory} instance by {@link EPSGFactoryFallback} in order to prevent
+     * the same exception to be thrown and logged on every calls to {@link CRS#forCode(String)}.
+     */
+    static CRSAuthorityFactory fallback(final UnavailableFactoryException e) throws UnavailableFactoryException {
+        final boolean isTransient = (e.getCause() instanceof SQLTransientException);
+        final AuthorityFactory unavailable = e.getUnavailableFactory();
+        final CRSAuthorityFactory factory;
+        synchronized (EPSG) {
+            if (unavailable != EPSG[0]) {
+                throw e;                                // Exception did not come from a factory that we control.
+            }
+            factory = EPSGFactoryFallback.INSTANCE;
+            if (!isTransient) {
+                ALL.reload();
+                EPSG[0] = factory;
+            }
+        }
+        log(Level.WARNING, e);
+        return factory;
+    }
+
+    /**
+     * Notifies that a factory is unavailable, but without giving a fallback and without logging.
+     * The caller is responsible for logging a warning and to provide its own fallback.
+     */
+    static void failure(final UnavailableFactoryException e) {
+        if (!(e.getCause() instanceof SQLTransientException)) {
+            final AuthorityFactory unavailable = e.getUnavailableFactory();
+            synchronized (EPSG) {
+                if (unavailable == EPSG[0]) {
+                    ALL.reload();
+                    EPSG[0] = EPSGFactoryFallback.INSTANCE;
+                }
+            }
+        }
+    }
+
+    /**
+     * Logs the given exception at the given level. This method pretends that the logging come from
+     * {@link CRS#getAuthorityFactory(String)}, which is the public facade for {@link #EPSG()}.
+     */
+    private static void log(final Level level, final Exception e) {
+        final LogRecord record = new LogRecord(level, e.getLocalizedMessage());
+        record.setLoggerName(Loggers.CRS_FACTORY);
+        Logging.log(CRS.class, "getAuthorityFactory", record);
+    }
+
+    /**
+     * Invoked by {@link LazySet} for adding the EPSG factory before any other factory fetched by {@code ServiceLoader}.
+     * We put the EPSG factory first because it is often used anyway even for {@code CRS} and {@code AUTO} namespaces.
+     *
+     * <p>This method tries to instantiate an {@link EPSGFactory} if possible,
+     * or an {@link EPSGFactoryFallback} otherwise.</p>
      */
     @Override
     @SuppressWarnings("unchecked")
     protected T[] initialValues() {
-        EPSG();                         // Force creation of EPSG factory if not already done.
+        EPSG();                         // Force EPSGFactory instantiation if not already done.
         return (T[]) EPSG;
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/Builder.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -649,7 +649,7 @@ public abstract class Builder<B extends
     private void addIdentifier(final Citation authority, final String codeSpace, final String identifier, final String version) {
         final Identifier id;
         if (isDeprecated()) {
-            id = new DeprecatedCode(authority, codeSpace, identifier, version, getRemarks());
+            id = new DeprecatedCode(authority, codeSpace, identifier, version, null, getRemarks());
         } else {
             id = new ImmutableIdentifier(authority, codeSpace, identifier, version, getDescription());
         }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -51,6 +51,7 @@ import org.apache.sis.referencing.crs.De
 import org.apache.sis.referencing.crs.DefaultVerticalCRS;
 import org.apache.sis.referencing.crs.DefaultCompoundCRS;
 import org.apache.sis.metadata.iso.extent.Extents;
+import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.Static;
@@ -148,7 +149,11 @@ public final class CRS extends Static {
             throws NoSuchAuthorityCodeException, FactoryException
     {
         ArgumentChecks.ensureNonNull("code", code);
-        return AuthorityFactories.ALL.createCoordinateReferenceSystem(code);
+        try {
+            return AuthorityFactories.ALL.createCoordinateReferenceSystem(code);
+        } catch (UnavailableFactoryException e) {
+            return AuthorityFactories.fallback(e).createCoordinateReferenceSystem(code);
+        }
     }
 
     /**

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -57,6 +57,7 @@ import org.apache.sis.referencing.crs.De
 import org.apache.sis.referencing.crs.DefaultVerticalCRS;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultGeocentricCRS;
+import org.apache.sis.referencing.factory.UnavailableFactoryException;
 import org.apache.sis.metadata.iso.citation.Citations;
 import org.apache.sis.internal.referencing.provider.TransverseMercator;
 import org.apache.sis.internal.referencing.Formulas;
@@ -222,7 +223,7 @@ public enum CommonCRS {
      *   <tr><th>Semi-minor axis length:</th>  <td>6356752 <i>(approximative)</i></td></tr>
      *   <tr><th>Inverse flattening:</th>      <td>298.257222101 <i>(definitive)</i></td></tr>
      *   <tr><th>Ellipsoid axes unit:</th>     <td>{@link SI#METRE}</td></tr>
-     *   <tr><th>UTM zones:</th>               <td>28 to 38 in the North hemisphere</td></tr>
+     *   <tr><th>UTM zones:</th>               <td>28 to 37 in the North hemisphere</td></tr>
      * </table></blockquote>
      *
      * <div class="note"><b>Note:</b>
@@ -231,7 +232,7 @@ public enum CommonCRS {
      * while the {@code "IGNF:MILLER"} authority code uses the GRS80 datum.</div>
      */
     ETRS89((short) 4258, (short) 4937, (short) 4936, (short) 6258, (short) 7019,    // Geodetic info
-           (short) 25800, (short) 0, (byte) 28, (byte) 38),                         // UTM info
+           (short) 25800, (short) 0, (byte) 28, (byte) 37),                         // UTM info
 
     /**
      * European Datum 1950.
@@ -507,7 +508,7 @@ public enum CommonCRS {
                         failure(this, "geographic", e);
                     }
                     /*
-                     * All constants defined in this enumeration use the same coordinate system, EPSG::6422.
+                     * All constants defined in this enumeration use the same coordinate system, EPSG:6422.
                      * We will arbitrarily create this CS only for the most frequently created CRS,
                      * and share that CS instance for all other constants.
                      */
@@ -564,7 +565,7 @@ public enum CommonCRS {
                         }
                     }
                     /*
-                     * All constants defined in this enumeration use the same coordinate system, EPSG::6423.
+                     * All constants defined in this enumeration use the same coordinate system, EPSG:6423.
                      * We will arbitrarily create this CS only for the most frequently created CRS,
                      * and share that CS instance for all other constants.
                      */
@@ -622,7 +623,7 @@ public enum CommonCRS {
                         }
                     }
                     /*
-                     * All constants defined in this enumeration use the same coordinate system, EPSG::6500.
+                     * All constants defined in this enumeration use the same coordinate system, EPSG:6500.
                      * We will arbitrarily create this CS only for the most frequently created CRS,
                      * and share that CS instance for all other constants.
                      */
@@ -885,7 +886,7 @@ public enum CommonCRS {
                 }
             }
             /*
-             * All constants defined in this enumeration use the same coordinate system, EPSG::4400.
+             * All constants defined in this enumeration use the same coordinate system, EPSG:4400.
              * We will arbitrarily create this CS only for a frequently created CRS, and share that
              * CS instance for all other constants.
              */
@@ -1540,6 +1541,9 @@ public enum CommonCRS {
      * After invoking this method, the caller will fallback on hard-coded values.
      */
     static void failure(final Object caller, final String method, final FactoryException e) {
+        if (e instanceof UnavailableFactoryException) {
+            AuthorityFactories.failure((UnavailableFactoryException) e);
+        }
         Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), caller.getClass(), method, e);
     }
 }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -35,7 +35,9 @@ import org.apache.sis.referencing.factor
 import org.apache.sis.internal.referencing.provider.TransverseMercator;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.util.iso.SimpleInternationalString;
+import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.resources.Errors;
+import org.apache.sis.util.CharSequences;
 import org.apache.sis.util.Debug;
 
 
@@ -59,12 +61,6 @@ final class EPSGFactoryFallback extends
     static final boolean FORCE_HARDCODED = false;
 
     /**
-     * A temporary flag for tests that need to be revisited after the upgrade to the next EPSG database version.
-     */
-    @Debug
-    static final boolean PENDING_NEXT_EPSG = false;
-
-    /**
      * The singleton instance.
      */
     static final CRSAuthorityFactory INSTANCE = new EPSGFactoryFallback();
@@ -156,7 +152,16 @@ final class EPSGFactoryFallback extends
     public IdentifiedObject createObject(final String code) throws NoSuchAuthorityCodeException {
         NumberFormatException cause = null;
         try {
-            final int n = Integer.parseInt(code);
+            /*
+             * Parse the value after the last ':'. We do not bother to verify if the part before ':' is legal
+             * (e.g. "EPSG:4326", "EPSG::4326", "urn:ogc:def:crs:epsg::4326", etc.) because this analysis has
+             * already be done by MultiAuthoritiesFactory. We nevertheless skip the prefix in case this factory
+             * is used directly (not through MultiAuthoritiesFactory), which should be rare. The main case is
+             * when using the factory returned by AuthorityFactories.fallback(…).
+             */
+            final int n = Integer.parseInt(CharSequences.trimWhitespaces(code,
+                            code.lastIndexOf(DefaultNameSpace.DEFAULT_SEPARATOR) + 1,
+                            code.length()).toString());
             for (final CommonCRS crs : CommonCRS.values()) {
                 if (n == crs.geographic) return crs.geographic();
                 if (n == crs.geocentric) return crs.geocentric();

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultDerivedCRS.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -37,7 +37,6 @@ import org.opengis.referencing.crs.Proje
 import org.opengis.referencing.crs.EngineeringCRS;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.cs.CoordinateSystem;
-import org.opengis.referencing.cs.EllipsoidalCS;
 import org.opengis.referencing.cs.VerticalCS;
 import org.opengis.referencing.cs.TimeCS;
 import org.opengis.referencing.operation.Conversion;
@@ -288,9 +287,9 @@ public class DefaultDerivedCRS extends A
         if (baseCRS != null && derivedCS != null) {
             final String type = getType(baseCRS, derivedCS);
             if (type != null) {
-                if (WKTKeywords.GeodeticCRS.equals(type)) return new Geodetic(properties, (GeodeticCRS) baseCRS, conversion, (EllipsoidalCS) derivedCS);
-                if (WKTKeywords.VerticalCRS.equals(type)) return new Vertical(properties, (VerticalCRS) baseCRS, conversion,    (VerticalCS) derivedCS);
-                if (WKTKeywords.TimeCRS    .equals(type)) return new Temporal(properties, (TemporalCRS) baseCRS, conversion,        (TimeCS) derivedCS);
+                if (WKTKeywords.GeodeticCRS.equals(type)) return new Geodetic(properties, (GeodeticCRS) baseCRS, conversion,              derivedCS);
+                if (WKTKeywords.VerticalCRS.equals(type)) return new Vertical(properties, (VerticalCRS) baseCRS, conversion, (VerticalCS) derivedCS);
+                if (WKTKeywords.TimeCRS    .equals(type)) return new Temporal(properties, (TemporalCRS) baseCRS, conversion,     (TimeCS) derivedCS);
                 if (WKTKeywords.EngineeringCRS.equals(type)) {
                     /*
                      * This case may happen for baseCRS of kind GeodeticCRS, ProjectedCRS or EngineeringCRS.
@@ -340,9 +339,9 @@ public class DefaultDerivedCRS extends A
         if (baseCRS != null && derivedCS != null) {
             final String type = getType(baseCRS, derivedCS);
             if (type != null) {
-                if (WKTKeywords.GeodeticCRS.equals(type)) return new Geodetic(properties, (GeodeticCRS) baseCRS, interpolationCRS, method, baseToDerived, (EllipsoidalCS) derivedCS);
-                if (WKTKeywords.VerticalCRS.equals(type)) return new Vertical(properties, (VerticalCRS) baseCRS, interpolationCRS, method, baseToDerived,    (VerticalCS) derivedCS);
-                if (WKTKeywords.TimeCRS    .equals(type)) return new Temporal(properties, (TemporalCRS) baseCRS, interpolationCRS, method, baseToDerived,        (TimeCS) derivedCS);
+                if (WKTKeywords.GeodeticCRS.equals(type)) return new Geodetic(properties, (GeodeticCRS) baseCRS, interpolationCRS, method, baseToDerived,              derivedCS);
+                if (WKTKeywords.VerticalCRS.equals(type)) return new Vertical(properties, (VerticalCRS) baseCRS, interpolationCRS, method, baseToDerived, (VerticalCS) derivedCS);
+                if (WKTKeywords.TimeCRS    .equals(type)) return new Temporal(properties, (TemporalCRS) baseCRS, interpolationCRS, method, baseToDerived,     (TimeCS) derivedCS);
                 if (WKTKeywords.EngineeringCRS.equals(type)) {
                     if (baseCRS instanceof EngineeringCRS) {
                         // See the comment in create(Map, SingleCRS, Conversion, CoordinateSystem)
@@ -646,13 +645,13 @@ public class DefaultDerivedCRS extends A
         }
 
         /** Creates a new geodetic CRS from the given properties. */
-        Geodetic(Map<String,?> properties, GeodeticCRS baseCRS, Conversion conversion, EllipsoidalCS derivedCS) {
+        Geodetic(Map<String,?> properties, GeodeticCRS baseCRS, Conversion conversion, CoordinateSystem derivedCS) {
             super(properties, baseCRS, conversion, derivedCS);
         }
 
         /** Creates a new geodetic CRS from the given properties. */
         Geodetic(Map<String,?> properties, GeodeticCRS baseCRS, CoordinateReferenceSystem interpolationCRS,
-                OperationMethod method, MathTransform baseToDerived, EllipsoidalCS derivedCS)
+                OperationMethod method, MathTransform baseToDerived, CoordinateSystem derivedCS)
         {
             super(properties, baseCRS, interpolationCRS, method, baseToDerived, derivedCS);
         }
@@ -662,19 +661,14 @@ public class DefaultDerivedCRS extends A
             return (GeodeticDatum) super.getDatum();
         }
 
-        /** Returns the coordinate system given at construction time. */
-        @Override public EllipsoidalCS getCoordinateSystem() {
-            return (EllipsoidalCS) super.getCoordinateSystem();
-        }
-
         /** Returns a coordinate reference system of the same type than this CRS but with different axes. */
         @Override AbstractCRS createSameType(final Map<String,?> properties, final CoordinateSystem derivedCS) {
             final Conversion conversionFromBase = getConversionFromBase();
             return new Geodetic(properties, (GeodeticCRS) conversionFromBase.getSourceCRS(),
-                    conversionFromBase, (EllipsoidalCS) derivedCS);
+                    conversionFromBase, derivedCS);
         }
 
-        /** Returns the WKT keyword for this derived CRS type.*/
+        /** Returns the WKT keyword for this derived CRS type. */
         @Override String keyword(final Formatter formatter) {
             return formatter.shortOrLong(WKTKeywords.GeodCRS, WKTKeywords.GeodeticCRS);
         }
@@ -727,7 +721,7 @@ public class DefaultDerivedCRS extends A
                     conversionFromBase, (VerticalCS) derivedCS);
         }
 
-        /** Returns the WKT keyword for this derived CRS type.*/
+        /** Returns the WKT keyword for this derived CRS type. */
         @Override String keyword(final Formatter formatter) {
             return formatter.shortOrLong(WKTKeywords.VertCRS, WKTKeywords.VerticalCRS);
         }
@@ -780,7 +774,7 @@ public class DefaultDerivedCRS extends A
                     conversionFromBase, (TimeCS) derivedCS);
         }
 
-        /** Returns the WKT keyword for this derived CRS type.*/
+        /** Returns the WKT keyword for this derived CRS type. */
         @Override String keyword(final Formatter formatter) {
             return WKTKeywords.TimeCRS;
         }
@@ -830,7 +824,7 @@ public class DefaultDerivedCRS extends A
             return new Engineering(properties, (EngineeringCRS) conversionFromBase.getSourceCRS(), conversionFromBase, derivedCS);
         }
 
-        /** Returns the WKT keyword for this derived CRS type.*/
+        /** Returns the WKT keyword for this derived CRS type. */
         @Override String keyword(final Formatter formatter) {
             return formatter.shortOrLong(WKTKeywords.EngCRS, WKTKeywords.EngineeringCRS);
         }

Modified: sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java?rev=1731686&r1=1731685&r2=1731686&view=diff
==============================================================================
--- sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK6/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java [UTF-8] Mon Feb 22 16:56:41 2016
@@ -392,8 +392,10 @@ public abstract class ConcurrentAuthorit
                 if (usage == null) {
                     final DAO factory = newDataAccess();
                     if (factory == null) {
-                        throw new UnavailableFactoryException(Errors.format(
+                        UnavailableFactoryException e = new UnavailableFactoryException(Errors.format(
                                 Errors.Keys.FactoryNotFound_1, GeodeticAuthorityFactory.class));
+                        e.setUnavailableFactory(this);
+                        throw e;
                     }
                     usage = new DataAccessRef<DAO>(factory);
                 }



Mime
View raw message