sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1832103 - in /sis: branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java data/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql
Date Wed, 23 May 2018 14:00:00 GMT
Author: desruisseaux
Date: Wed May 23 14:00:00 2018
New Revision: 1832103

URL: http://svn.apache.org/viewvc?rev=1832103&view=rev
Log:
Fix an error in the version number declared in EPSG history table.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
    sis/data/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java?rev=1832103&r1=1832102&r2=1832103&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/sql/epsg/DataScriptFormatter.java
[UTF-8] Wed May 23 14:00:00 2018
@@ -38,6 +38,8 @@ import org.apache.sis.util.CharSequences
 import org.apache.sis.internal.metadata.sql.ScriptRunner;
 import org.apache.sis.internal.metadata.sql.TestDatabase;
 
+import static org.junit.Assert.assertEquals;
+
 
 /**
  * Rewrites the {@code INSERT TO ...} statements in a SQL script in a more compact form.
@@ -46,7 +48,7 @@ import org.apache.sis.internal.metadata.
  * The steps to follow are documented in the {@code package.html} file.
  *
  * @author  Martin Desruisseaux (IRD, Geomatys)
- * @version 0.8
+ * @version 1.0
  * @since   0.7
  * @module
  */
@@ -189,13 +191,42 @@ public final class DataScriptFormatter e
 
     /**
      * EPSG scripts version 8.9 seems to have 2 errors where the {@code OBJECT_TABLE_NAME}
column contains
-     * {@code "AxisName"} instead of {@code "Coordinate Axis Name"}.
+     * {@code "AxisName"} instead of {@code "Coordinate Axis Name"}. Furthermore the version
number noted
+     * in the history table is a copy-and-paste error.
      */
     @Override
     @Workaround(library="EPSG", version="8.9")
-    protected void editText(final StringBuilder sql, int lower, final int upper) {
-        if (upper - lower == 10 && CharSequences.regionMatches(sql, ++lower, "AxisName"))
{
-            sql.replace(lower, upper-1, "Coordinate Axis Name");
+    protected void editText(final StringBuilder sql, int lower, int upper) {
+        final String table;         // Name of the table where to replace a value.
+        final String before;        // String that must exist before the value to replace,
or null if none.
+        final String oldValue;      // The old value to replace.
+        final String newValue;      // The new value.
+        switch (upper - lower) {    // Optimization for reducing the amount of comparison.
+            default: return;
+            case 10: {
+                table    = "epsg_deprecation";
+                before   = null;
+                oldValue = "AxisName";
+                newValue = "Coordinate Axis Name";
+                break;
+            }
+            case 38: {
+                table    = "epsg_versionhistory";
+                before   = "'8.9'";
+                oldValue = "Version 8.8 full release of Dataset.";
+                newValue = "Version 8.9 full release of Dataset.";
+                break;
+            }
+        }
+        if (CharSequences.regionMatches(sql, ++lower, oldValue) &&
+            CharSequences.regionMatches(sql, 0, "INSERT INTO " + table + " VALUES"))
+        {
+            assertEquals("oldValue.length", oldValue.length(), --upper - lower);
+            if (before != null) {
+                final int i = sql.indexOf(before);
+                if (i < 0 || i >= lower) return;
+            }
+            sql.replace(lower, upper, newValue);
         }
     }
 

Modified: sis/data/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql
URL: http://svn.apache.org/viewvc/sis/data/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql?rev=1832103&r1=1832102&r2=1832103&view=diff
==============================================================================
--- sis/data/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql
[ISO-8859-1] (original)
+++ sis/data/non-free/sis-epsg/src/main/resources/org/apache/sis/referencing/factory/sql/epsg/Data.sql
[ISO-8859-1] Wed May 23 14:00:00 2018
@@ -53812,7 +53812,7 @@ INSERT INTO epsg_versionhistory VALUES
 (166,'2015-09-21','8.7.5','Registry interim release. Released change requests 2015.029, 2015.035,
2015.040 and 2015.044.','8.8','8.7.4'),
 (167,'2015-11-25','8.8','Version 8.8 full release of Dataset.','8.8.1','8.7.5'),
 (168,'2015-12-30','8.8.1','Registry interim release. Released change requests 2015.045, 2015.057,
2015.061, 2015.064, 2015.066, 2015.067 and 2015.070.','8.9','8.8'),
-(169,'2016-02-15','8.9','Version 8.8 full release of Dataset.','8.9.1','8.8.1'),
+(169,'2016-02-15','8.9','Version 8.9 full release of Dataset.','8.9.1','8.8.1'),
 (170,'2016-04-06','8.9.1','Registry interim release. Released change requests 2016.010, 2016.012,
2016.013 and 2016.016.','8.9.2','8.9'),
 (171,'2016-04-06','8.9.2','Registry interim release. Released change request 2016.011.','8.9.3','8.9.1'),
 (172,'2016-07-13','8.9.3','Registry interim release. Released change requests 2015.068, 2015.069,
2016.003, 2016.004, 2016.017, 2016.021 and 2016.022.','8.9.4','8.9.2'),



Mime
View raw message