sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1748686 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/referencing/EPSGFactoryFallback.java test/java/org/apache/sis/referencing/CRSTest.java
Date Thu, 16 Jun 2016 11:17:14 GMT
Author: desruisseaux
Date: Thu Jun 16 11:17:14 2016
New Revision: 1748686

URL: http://svn.apache.org/viewvc?rev=1748686&view=rev
Log:
Fix a test failure that occurs when the test are executed without EPSG dataset available.

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java?rev=1748686&r1=1748685&r2=1748686&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/EPSGFactoryFallback.java
[UTF-8] Thu Jun 16 11:17:14 2016
@@ -213,7 +213,7 @@ final class EPSGFactoryFallback extends
      * @return the requested object.
      * @throws NoSuchAuthorityCodeException if no matching object has been found.
      */
-    private IdentifiedObject predefined(final String code, final int kind) throws NoSuchAuthorityCodeException
{
+    private IdentifiedObject predefined(String code, final int kind) throws NoSuchAuthorityCodeException
{
         NumberFormatException cause = null;
         try {
             /*
@@ -223,9 +223,8 @@ final class EPSGFactoryFallback extends
              * 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());
+            code = CharSequences.trimWhitespaces(code, code.lastIndexOf(DefaultNameSpace.DEFAULT_SEPARATOR)
+ 1, code.length()).toString();
+            final int n = Integer.parseInt(code);
             if ((kind & PRIME_MERIDIAN) != 0  &&  n == 8901) {
                 return CommonCRS.WGS84.primeMeridian();
             }

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java?rev=1748686&r1=1748685&r2=1748686&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/CRSTest.java
[UTF-8] Thu Jun 16 11:17:14 2016
@@ -16,11 +16,11 @@
  */
 package org.apache.sis.referencing;
 
+import org.opengis.util.FactoryException;
+import org.opengis.referencing.NoSuchAuthorityCodeException;
 import org.opengis.referencing.crs.CoordinateReferenceSystem;
 import org.opengis.referencing.crs.GeodeticCRS;
 import org.opengis.referencing.crs.SingleCRS;
-import org.opengis.util.FactoryException;
-import org.opengis.util.NoSuchIdentifierException;
 import org.apache.sis.referencing.crs.DefaultCompoundCRS;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.HardCodedCRS;
@@ -109,15 +109,15 @@ public final strictfp class CRSTest exte
     /**
      * Test {@link CRS#forCode(String)} with values that should be invalid.
      *
-     * @throws FactoryException if an error other than {@link NoSuchIdentifierException}
happened.
+     * @throws FactoryException if an error other than {@link NoSuchAuthorityCodeException}
happened.
      */
     @Test
     public void testForInvalidCode() throws FactoryException {
         try {
             CRS.forCode("EPSG:4");
             fail("Should not find EPSG:4");
-        } catch (NoSuchIdentifierException e) {
-            assertEquals("4", e.getIdentifierCode());
+        } catch (NoSuchAuthorityCodeException e) {
+            assertEquals("4", e.getAuthorityCode());
         }
     }
 



Mime
View raw message