You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2020/05/31 22:31:14 UTC

[sis] branch geoapi-4.0 updated (658b0e8 -> 4534d17)

This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a change to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git.


    from 658b0e8  Better filtering in CoordinateOperationRegistry about whether to extract the horizontal component of a 3D CRS. This change allows ResampledGridCoverageTest.crs4D_to_crs3D() to pass.
     new 5d82f2a  Minor method renaming.
     new 4534d17  Use EPSG data for "sis-referencing" tests if the "non-free" profile is explicitly enabled.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../sis/internal/metadata/sql/Initializer.java      | 13 ++++++++++---
 .../sis/internal/metadata/sql/LocalDataSource.java  | 12 ++++++++++--
 core/sis-referencing/pom.xml                        | 21 +++++++++++++++++++++
 .../apache/sis/internal/system/DataDirectory.java   |  6 +++---
 pom.xml                                             |  4 ++--
 5 files changed, 46 insertions(+), 10 deletions(-)


[sis] 02/02: Use EPSG data for "sis-referencing" tests if the "non-free" profile is explicitly enabled.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 4534d17c493a0e8e664cd25b5946566a6130b558
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sun May 31 12:50:27 2020 +0200

    Use EPSG data for "sis-referencing" tests if the "non-free" profile is explicitly enabled.
---
 core/sis-referencing/pom.xml | 21 +++++++++++++++++++++
 pom.xml                      |  4 ++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/core/sis-referencing/pom.xml b/core/sis-referencing/pom.xml
index 523e2ab..48cd69a 100644
--- a/core/sis-referencing/pom.xml
+++ b/core/sis-referencing/pom.xml
@@ -170,4 +170,25 @@
     </dependency>
   </dependencies>
 
+  <!-- Because the EPSG database is not free, require the user to ask it explicitly. -->
+  <profiles>
+    <profile>
+      <id>non-free</id>
+      <dependencies>
+        <dependency>
+          <groupId>org.apache.sis.non-free</groupId>
+          <artifactId>sis-epsg</artifactId>
+          <version>${sis.non-free.version}</version>
+          <scope>test</scope>
+          <exclusions>
+            <exclusion>
+              <groupId>*</groupId>
+              <artifactId>*</artifactId>
+            </exclusion>
+          </exclusions>
+        </dependency>
+      </dependencies>
+    </profile>
+  </profiles>
+
 </project>
diff --git a/pom.xml b/pom.xml
index 9989505..7a3c6c7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -597,8 +597,8 @@
     </profile>
 
     <!-- ===================================================================
-           If the user has not set the SIS_DATA environment variable, set a
-           default value where we can create a minimalist database.
+           If the user has not set the SIS_DATA environment variable,
+           set a default value where we can create a minimalist database.
          =================================================================== -->
     <profile>
       <id>sis-data</id>


[sis] 01/02: Minor method renaming.

Posted by de...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 5d82f2ab1e4605c392800775c1aa560031f930fb
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Sun May 31 00:17:06 2020 +0200

    Minor method renaming.
---
 .../org/apache/sis/internal/metadata/sql/Initializer.java   | 13 ++++++++++---
 .../apache/sis/internal/metadata/sql/LocalDataSource.java   | 12 ++++++++++--
 .../java/org/apache/sis/internal/system/DataDirectory.java  |  6 +++---
 3 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
index 0f8069a..d80a91e 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
@@ -321,7 +321,7 @@ public abstract class Initializer {
              */
             DataSource        embedded   = null;
             LocalDataSource[] candidates = null;
-            final boolean     isEnvClear = DataDirectory.isEnvClear();
+            final boolean     isEnvClear = DataDirectory.isUndefined();
             if (isEnvClear) {
                 embedded = embedded();                  // Check embedded data first only if SIS_DATA is not defined.
             }
@@ -369,8 +369,15 @@ public abstract class Initializer {
      */
     public static boolean hasJNDI() {
         return NamingManager.hasInitialContextFactoryBuilder() ||
-               AccessController.doPrivileged((PrivilegedAction<Boolean>) () ->
-                       System.getProperty(Context.INITIAL_CONTEXT_FACTORY) != null);
+               AccessController.doPrivileged((PrivilegedAction<Boolean>) Initializer::isContextDefined);
+    }
+
+    /**
+     * Returns whether an initial context factory is specified.
+     * Defined as a separated method for clearer stack trace in case of security exception.
+     */
+    private static Boolean isContextDefined() {
+        return System.getProperty(Context.INITIAL_CONTEXT_FACTORY) != null;
     }
 
     /**
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java
index f56d8fd..c31f502 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java
@@ -110,7 +110,7 @@ public final class LocalDataSource implements DataSource, Comparable<LocalDataSo
             final String home;
             switch (dialect) {
                 // More cases may be added in the future.
-                case DERBY: home = AccessController.doPrivileged((PrivilegedAction<String>) () -> System.getProperty(DERBY_HOME_KEY)); break;
+                case DERBY: home = AccessController.doPrivileged((PrivilegedAction<String>) LocalDataSource::getDerbyHome); break;
                 default:    home = null; break;
             }
             final String  dbFile;
@@ -165,6 +165,14 @@ public final class LocalDataSource implements DataSource, Comparable<LocalDataSo
     }
 
     /**
+     * Returns the home directory of Derby databases, or {@code null} if none.
+     * Defined as a separated method for clearer stack trace in case of security exception.
+     */
+    private static String getDerbyHome() {
+        return System.getProperty(DERBY_HOME_KEY);
+    }
+
+    /**
      * Wraps an existing data source for adding a shutdown method to it.
      * This method is used for source of data embedded in a separated JAR file.
      *
@@ -241,7 +249,7 @@ public final class LocalDataSource implements DataSource, Comparable<LocalDataSo
     }
 
     /**
-     * Creates the database if needed. For Derby we need to explicitly allows creation.
+     * Creates the database if needed. For Derby we need to explicitly allow creation.
      * For HSQLDB the creation is enabled by default.
      */
     final void createDatabase() throws Exception {
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java
index 0dccacf..1ed2403 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java
@@ -146,7 +146,7 @@ public enum DataDirectory {
     }
 
     /**
-     * Returns {@code true} if the {@value #ENV} environment variable is unset. In case of doubt, this method
+     * Returns {@code true} if the {@value #ENV} environment variable is undefined. In case of doubt, this method
      * returns {@code false}. This method is used for avoiding or at least delaying the log messages emitted by
      * {@link #getRootDirectory()} when a fallback exists in absence of any user attempt to configure the system.
      *
@@ -154,11 +154,11 @@ public enum DataDirectory {
      *
      * @since 0.8
      */
-    public static synchronized boolean isEnvClear() {
+    public static synchronized boolean isUndefined() {
         if (rootDirectory == null) try {
             return getenv() == null;
         } catch (SecurityException e) {
-            Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM), DataDirectory.class, "isEnvClear", e);
+            Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM), DataDirectory.class, "isUndefined", e);
         }
         return false;
     }