sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1802164 - in /sis/branches/JDK7: ./ storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
Date Mon, 17 Jul 2017 15:54:44 GMT
Author: desruisseaux
Date: Mon Jul 17 15:54:43 2017
New Revision: 1802164

URL: http://svn.apache.org/viewvc?rev=1802164&view=rev
Log:
Merge from JDK8 branch.

Modified:
    sis/branches/JDK7/   (props changed)
    sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java

Propchange: sis/branches/JDK7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Jul 17 15:54:43 2017
@@ -1,5 +1,5 @@
 /sis/branches/Android:1430670-1480699
 /sis/branches/JDK6:1394913-1508480
-/sis/branches/JDK8:1584960-1802137
+/sis/branches/JDK8:1584960-1802140
 /sis/branches/JDK9:1773327-1789983
 /sis/trunk:1394364-1508466,1519089-1519674

Modified: sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java?rev=1802164&r1=1802163&r2=1802164&view=diff
==============================================================================
--- sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
[UTF-8] (original)
+++ sis/branches/JDK7/storage/sis-gdal/src/main/java/org/apache/sis/storage/gdal/Proj4.java
[UTF-8] Mon Jul 17 15:54:43 2017
@@ -105,11 +105,29 @@ public final class Proj4 extends Static
      */
     public static String definition(final CoordinateReferenceSystem crs) throws FactoryException
{
         ArgumentChecks.ensureNonNull("crs", crs);
-        for (final Identifier id : crs.getIdentifiers()) {
-            if (id instanceof PJ) {
-                return ((PJ) id).getCode();
+        /*
+         * If the given CRS object is associated to a Proj.4 structure, let Proj.4 formats
itself
+         * the definition string. Note that this operation may fail if there is no Proj.4
library
+         * in the current system, or no JNI bindings to that library.
+         */
+        try {
+            for (final Identifier id : crs.getIdentifiers()) {
+                if (id instanceof PJ) {
+                    return ((PJ) id).getCode();
+                }
             }
+        } catch (UnsatisfiedLinkError e) {
+            // Thrown the first time that we try to use the library.
+            Logging.unexpectedException(Logging.getLogger(Modules.GDAL), Proj4.class, "definition",
e);
+        } catch (NoClassDefFoundError e) {
+            // Thrown on all attempts after the first one.
+            Logging.recoverableException(Logging.getLogger(Modules.GDAL), Proj4.class, "definition",
e);
         }
+        /*
+         * If we found no Proj.4 structure, formats the definition string ourself. The string
may differ from
+         * what Proj.4 would have given. In particular, we do not provide "+init=" or "+datum="
parameter.
+         * But the definition should still be semantically equivalent.
+         */
         final String method;
         final GeodeticDatum datum;
         final ParameterValueGroup parameters;



Mime
View raw message