sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1769347 - in /sis/branches/JDK8/core: sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
Date Fri, 11 Nov 2016 21:34:39 GMT
Author: desruisseaux
Date: Fri Nov 11 21:34:39 2016
New Revision: 1769347

URL: http://svn.apache.org/viewvc?rev=1769347&view=rev
Log:
Add a comment explaining why we need that SQLUtilities.toBoolean(String) throws an exception
if the given value is not recognized.
Remove an obsolete comment.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
    sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java?rev=1769347&r1=1769346&r2=1769347&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
[UTF-8] Fri Nov 11 21:34:39 2016
@@ -2512,7 +2512,12 @@ next:               while (r.next()) {
                 /*
                  * Determines if the inverse operation can be performed by reversing the
parameter sign.
                  * The EPSG dataset uses "Yes" or "No" value, but SIS scripts use boolean
type. We have
-                 * to accept both.
+                 * to accept both. Note that if we do not recognize the string as a boolean
value, then
+                 * we need a SQLException, not a null value.  If the value is wrongly null,
this method
+                 * will succeed anyway and EPSGDataAccess will finish its work without apparent
problem,
+                 * but Apache SIS will fail later when it will try to compute the inverse
operation, for
+                 * example in a call to CRS.findOperation(…). The exception thrown at such
later time is
+                 * much more difficult to relate to the root cause than if we throw the exception
here.
                  */
                 InternationalString isReversible = null;
                 try (ResultSet r = executeQuery("ParameterSign",
@@ -2525,7 +2530,7 @@ next:               while (r.next()) {
                             b = r.getBoolean(1);
                             if (r.wasNull()) b = null;
                         } else {
-                            b = SQLUtilities.toBoolean(r.getString(1));
+                            b = SQLUtilities.toBoolean(r.getString(1));     // May throw
SQLException - see above comment.
                         }
                         if (b != null) {
                             isReversible = b ? SignReversalComment.OPPOSITE : SignReversalComment.SAME;

Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java?rev=1769347&r1=1769346&r2=1769347&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/util/LocalesTest.java
[UTF-8] Fri Nov 11 21:34:39 2016
@@ -91,7 +91,6 @@ public final strictfp class LocalesTest
 
     /**
      * Tests the {@link Locales#parse(String)} method with a IETF BCP 47 language tag string.
-     * This functionality is supported only on the JDK7 branch.
      */
     @Test
     public void testParseIETF() {



Mime
View raw message