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 83075d0552 Results of `Resource.subset(Query)` should also fire
`CloseEvent`.
83075d0552 is described below
commit 83075d05527cd304f91455fb0f9972d003b0249c
Author: Martin Desruisseaux <[email protected]>
AuthorDate: Wed Jun 8 16:00:00 2022 +0200
Results of `Resource.subset(Query)` should also fire `CloseEvent`.
---
.../org/apache/sis/internal/gui/ExceptionReporter.java | 17 ++++++++++-------
.../java/org/apache/sis/storage/CoverageSubset.java | 5 ++---
.../main/java/org/apache/sis/storage/FeatureSubset.java | 5 ++---
.../org/apache/sis/storage/event/StoreListeners.java | 4 ++--
.../main/java/org/apache/sis/storage/package-info.java | 2 +-
5 files changed, 17 insertions(+), 16 deletions(-)
diff --git
a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ExceptionReporter.java
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ExceptionReporter.java
index 4f92ee0a4c..10740edc66 100644
---
a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ExceptionReporter.java
+++
b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ExceptionReporter.java
@@ -42,7 +42,7 @@ import org.apache.sis.gui.Widget;
import org.apache.sis.util.Classes;
import org.apache.sis.storage.DataStore;
import org.apache.sis.storage.Resource;
-import org.apache.sis.storage.event.StoreListeners;
+import org.apache.sis.internal.storage.StoreResource;
/**
@@ -174,13 +174,16 @@ public final class ExceptionReporter extends Widget {
* @param resource the resource that can not be read.
* @param exception the error that occurred.
*/
- public static void canNotReadFile(final Node owner, final Resource
resource, final Throwable exception) {
- final String name;
- if (resource instanceof DataStore) {
+ public static void canNotReadFile(final Node owner, Resource resource,
final Throwable exception) {
+ String name = null;
+ if (resource instanceof StoreResource) {
+ final DataStore ds = ((StoreResource) resource).getOriginator();
+ if (ds != null) name = ds.getDisplayName();
+ }
+ if (name == null && resource instanceof DataStore) {
name = ((DataStore) resource).getDisplayName();
- } else if (resource instanceof StoreListeners) {
- name = ((StoreListeners) resource).getSourceName();
- } else {
+ }
+ if (name == null) {
canNotUseResource(owner, exception);
return;
}
diff --git
a/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java
b/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java
index a5a6c7bd00..0a68a344e8 100644
---
a/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java
+++
b/storage/sis-storage/src/main/java/org/apache/sis/storage/CoverageSubset.java
@@ -27,7 +27,6 @@ import org.apache.sis.coverage.grid.GridDerivation;
import org.apache.sis.coverage.grid.GridRoundingMode;
import org.apache.sis.coverage.grid.GridClippingMode;
import org.apache.sis.coverage.grid.DisjointExtentException;
-import org.apache.sis.storage.event.StoreListeners;
import org.apache.sis.internal.storage.Resources;
import org.apache.sis.internal.util.UnmodifiableArrayList;
@@ -38,7 +37,7 @@ import org.apache.sis.internal.util.UnmodifiableArrayList;
* arguments of {@link GridCoverageResource#read(GridGeometry, int...)} method.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
* @since 1.1
* @module
*/
@@ -61,7 +60,7 @@ final class CoverageSubset extends
AbstractGridCoverageResource {
* @param query the domain and range to read from the {@code source}
coverage.
*/
CoverageSubset(final GridCoverageResource source, final CoverageQuery
query) {
- super(source instanceof StoreListeners ? (StoreListeners) source :
null, false);
+ super(source instanceof AbstractResource ? ((AbstractResource)
source).listeners : null, false);
this.source = source;
this.query = query;
}
diff --git
a/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java
b/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java
index 8823cfa2cb..4affc9612e 100644
---
a/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java
+++
b/storage/sis-storage/src/main/java/org/apache/sis/storage/FeatureSubset.java
@@ -20,7 +20,6 @@ import java.util.OptionalLong;
import java.util.stream.Stream;
import org.apache.sis.internal.feature.FeatureUtilities;
import org.apache.sis.internal.storage.Resources;
-import org.apache.sis.storage.event.StoreListeners;
// Branch-dependent imports
import org.opengis.feature.Feature;
@@ -38,7 +37,7 @@ import org.opengis.filter.SortBy;
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
* @since 1.0
* @module
*/
@@ -64,7 +63,7 @@ final class FeatureSubset extends AbstractFeatureSet {
* This given query is stored as-is (it is not cloned neither optimized).
*/
FeatureSubset(final FeatureSet source, final FeatureQuery query) {
- super(source instanceof StoreListeners ? (StoreListeners) source :
null, false);
+ super(source instanceof AbstractResource ? ((AbstractResource)
source).listeners : null, false);
this.source = source;
this.query = query;
}
diff --git
a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
index a580155f55..ed970aa49e 100644
---
a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
+++
b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
@@ -337,8 +337,8 @@ public class StoreListeners implements Localized {
* Returns a short name or label for the source. It may be the name of the
file opened by a data store.
* The returned name can be useful in warning messages for identifying the
problematic source.
*
- * <p>The default implementation {@linkplain DataStore#getDisplayName()
fetches that name from the data store},
- * or returns an arbitrary name if it can get it otherwise.</p>
+ * <p>The default implementation {@linkplain DataStore#getDisplayName()
fetches a name from the data store},
+ * or returns an arbitrary name if no better name is found.</p>
*
* @return a short name of label for the source (never {@code null}).
*
diff --git
a/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java
b/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java
index 8928ed7a18..e70c106729 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/package-info.java
@@ -26,7 +26,7 @@
*
* @author Johann Sorel (Geomatys)
* @author Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
* @since 0.3
* @module
*/