sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Improve error message if the feature type of filtered data can not be determined.
Date Wed, 21 Aug 2019 08:52:31 GMT
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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 4877df8  Improve error message if the feature type of filtered data can not be determined.
4877df8 is described below

commit 4877df895211274d72f08c130242bfa8552e5e2f
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Aug 21 10:51:42 2019 +0200

    Improve error message if the feature type of filtered data can not be determined.
---
 .../java/org/apache/sis/internal/storage/Resources.java     |  5 +++++
 .../org/apache/sis/internal/storage/Resources.properties    |  1 +
 .../org/apache/sis/internal/storage/Resources_fr.properties |  1 +
 .../apache/sis/internal/storage/query/FeatureSubset.java    | 13 +++++++++----
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
index 351c86c..03bc371 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.java
@@ -72,6 +72,11 @@ public final class Resources extends IndexedResourceBundle {
         public static final short CanNotCreateFolderStore_1 = 43;
 
         /**
+         * Can not infer the feature type resulting from “{0}” filtering.
+         */
+        public static final short CanNotDeriveTypeFromFeature_1 = 55;
+
+        /**
          * Can not get metadata common to “{0}” files. The reason is: {1}
          */
         public static final short CanNotGetCommonMetadata_2 = 39;
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
index 62dced0..a6d6ecc 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources.properties
@@ -21,6 +21,7 @@
 #
 AmbiguousName_4                   = Name \u201c{3}\u201d is ambiguous because it can be understood
as either \u201c{1}\u201d or \u201c{2}\u201d in the context of \u201c{0}\u201d data.
 CanNotCreateFolderStore_1         = Can not create resources based on the content of \u201c{0}\u201d
directory.
+CanNotDeriveTypeFromFeature_1     = Can not infer the feature type resulting from \u201c{0}\u201d
filtering.
 CanNotGetCommonMetadata_2         = Can not get metadata common to \u201c{0}\u201d files.
The reason is: {1}
 CanNotReadCRS_WKT_1               = Can not read the Coordinate Reference System (CRS) Well
Known Text (WKT) in \u201c{0}\u201d.
 CanNotReadDirectory_1             = Can not read \u201c{0}\u201d directory.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
index dbc8aeb..6fbc132 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/Resources_fr.properties
@@ -26,6 +26,7 @@
 #
 AmbiguousName_4                   = Le nom \u00ab\u202f{3}\u202f\u00bb est ambigu\u00eb car
il peut \u00eatre interpr\u00e9t\u00e9 aussi bien comme \u00ab\u202f{1}\u202f\u00bb ou \u00ab\u202f{2}\u202f\u00bb
dans le contexte des donn\u00e9es de \u00ab\u202f{0}\u202f\u00bb.
 CanNotCreateFolderStore_1         = Ne peut pas cr\u00e9er des ressources bas\u00e9es sur
le contenu du r\u00e9pertoire \u00ab\u202f{0}\u202f\u00bb.
+CanNotDeriveTypeFromFeature_1     = Ne peut pas d\u00e9terminer le type de donn\u00e9es r\u00e9sultant
du filtrage \u00ab\u202f{0}\u202f\u00bb.
 CanNotGetCommonMetadata_2         = Ne peut pas obtenir les m\u00e9ta-donn\u00e9es communes
aux fichiers \u00ab\u202f{0}\u202f\u00bb. La raison est\u2008: {1}
 CanNotReadCRS_WKT_1               = Ne peut pas lire le syst\u00e8me de r\u00e9f\u00e9rence
spatial dans le \u00ab\u202fWell Known Text\u202f\u00bb (WKT) de \u00ab\u202f{0}\u202f\u00bb.
 CanNotReadDirectory_1             = Ne peut pas lire le r\u00e9pertoire \u00ab\u202f{0}\u202f\u00bb.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java
index bb714f5..828feb5 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/query/FeatureSubset.java
@@ -22,6 +22,7 @@ import java.util.stream.Stream;
 import org.opengis.util.GenericName;
 import org.apache.sis.internal.feature.FeatureUtilities;
 import org.apache.sis.internal.storage.AbstractFeatureSet;
+import org.apache.sis.internal.storage.Resources;
 import org.apache.sis.filter.InvalidExpressionException;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.storage.DataStoreException;
@@ -86,10 +87,14 @@ final class FeatureSubset extends AbstractFeatureSet {
      */
     @Override
     public synchronized FeatureType getType() throws DataStoreException {
-        if (resultType == null) try {
-            resultType = query.expectedType(source.getType());
-        } catch (IllegalArgumentException | InvalidExpressionException e) {
-            throw new DataStoreContentException(e);
+        if (resultType == null) {
+            final FeatureType type = source.getType();
+            try {
+                resultType = query.expectedType(type);
+            } catch (IllegalArgumentException | InvalidExpressionException e) {
+                throw new DataStoreContentException(Resources.forLocale(getLocale())
+                        .getString(Resources.Keys.CanNotDeriveTypeFromFeature_1, type.getName()),
e);
+            }
         }
         return resultType;
     }


Mime
View raw message