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 8eceb4133a Replace `Path` by `File` in `ResourceEvent` for resolving 
serialization warning. The `File` object was what we needed for storing in 
`RecentFiles` anyway. Opportunistic documentation cleanup.
8eceb4133a is described below

commit 8eceb4133aeb9d02cf5869f2957baba273bdf319
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Sun Jan 15 01:37:29 2023 +0100

    Replace `Path` by `File` in `ResourceEvent` for resolving serialization 
warning.
    The `File` object was what we needed for storing in `RecentFiles` anyway.
    Opportunistic documentation cleanup.
---
 .../main/java/org/apache/sis/gui/RecentFiles.java  | 10 ++-----
 .../org/apache/sis/gui/dataset/PathAction.java     | 12 ++++++--
 .../org/apache/sis/gui/dataset/ResourceCell.java   |  4 +--
 .../org/apache/sis/gui/dataset/ResourceEvent.java  | 33 +++++++++++++---------
 .../org/apache/sis/gui/dataset/package-info.java   |  2 +-
 .../sis/internal/referencing/Arithmetic.java       |  2 +-
 .../referencing/provider/DatumShiftGridFile.java   |  2 ++
 .../referencing/provider/DatumShiftGridLoader.java |  2 +-
 .../main/java/org/apache/sis/math/Fraction.java    |  2 +-
 .../apache/sis/measure/DefaultQuantityFactory.java |  2 +-
 .../org/apache/sis/measure/QuantityFormat.java     |  4 +--
 .../java/org/apache/sis/measure/UnitRegistry.java  |  2 +-
 .../src/main/java/org/apache/sis/util/Numbers.java |  2 +-
 .../internal/storage/io/FileCacheByteChannel.java  | 10 +++----
 .../sis/internal/storage/io/HttpByteChannel.java   |  2 +-
 .../sis/internal/storage/io/IOUtilities.java       | 21 --------------
 .../org/apache/sis/storage/DataStoreProvider.java  |  8 +++---
 .../org/apache/sis/storage/ProbeInputStream.java   |  2 ++
 .../java/org/apache/sis/storage/ProbeReader.java   |  2 ++
 .../storage/io/FileCacheByteChannelTest.java       |  2 +-
 20 files changed, 61 insertions(+), 65 deletions(-)

diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/RecentFiles.java 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/RecentFiles.java
index 7e20c151c2..9535ffde4a 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/RecentFiles.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/RecentFiles.java
@@ -17,7 +17,6 @@
 package org.apache.sis.gui;
 
 import java.io.File;
-import java.nio.file.Path;
 import java.util.Set;
 import java.util.StringJoiner;
 import javafx.event.ActionEvent;
@@ -36,7 +35,7 @@ import org.apache.sis.util.ArraysExt;
  * Manages a list of recently opened files. The list of files is initialized 
from user preferences.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.4
  * @since   1.1
  */
 final class RecentFiles implements EventHandler<ActionEvent> {
@@ -116,11 +115,8 @@ final class RecentFiles implements 
EventHandler<ActionEvent> {
      * the latest item is discarded.
      */
     private void touched(final ResourceEvent event, final boolean closed) {
-        final Path path = event.getResourcePath();
-        final File file;
-        try {
-            file = path.toFile();
-        } catch (UnsupportedOperationException e) {
+        final File file = event.getResourceFile().orElse(null);
+        if (file == null) {
             // Recently used URIs are not saved here.
             return;
         }
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/PathAction.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/PathAction.java
index d6a49eb7e0..aba7d0ab10 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/PathAction.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/PathAction.java
@@ -32,6 +32,7 @@ import javafx.scene.input.ClipboardContent;
 import org.apache.sis.internal.gui.ExceptionReporter;
 import org.apache.sis.internal.storage.ResourceOnFileSystem;
 import org.apache.sis.internal.storage.URIDataStore;
+import org.apache.sis.internal.storage.io.IOUtilities;
 import org.apache.sis.storage.DataStoreException;
 import org.apache.sis.storage.Resource;
 
@@ -42,7 +43,7 @@ import org.apache.sis.storage.Resource;
  * or open the containing folder using native file browser.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.4
  * @since   1.1
  */
 final class PathAction implements EventHandler<ActionEvent> {
@@ -69,9 +70,16 @@ final class PathAction implements EventHandler<ActionEvent> {
     /**
      * Whether the "Open containing folder" operation is disabled.
      */
-    static final boolean isBrowseDisabled = !(Desktop.isDesktopSupported() &&
+    private static final boolean isBrowseDisabled = 
!(Desktop.isDesktopSupported() &&
             Desktop.getDesktop().isSupported(Desktop.Action.BROWSE_FILE_DIR));
 
+    /**
+     * Returns {@code true} if {@code PathAction} cannot handle the given path 
for browsing.
+     */
+    static boolean isBrowseDisabled(final Object path) {
+        return PathAction.isBrowseDisabled || IOUtilities.toPathOrNull(path) 
== null;
+    }
+
     /**
      * Invoked when the user selected "Copy file path" item in the contextual 
menu of a {@link ResourceTree} cell.
      * This method copies the path of the selected resource to the clipboard.
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceCell.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceCell.java
index be4635181b..2078a769fc 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceCell.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceCell.java
@@ -47,7 +47,7 @@ import org.apache.sis.util.resources.Vocabulary;
  * The same call may be recycled many times for different {@link ResourceItem} 
data.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.3
+ * @version 1.4
  *
  * @see ResourceItem
  *
@@ -168,7 +168,7 @@ final class ResourceCell extends TreeCell<Resource> {
                 }
                 final ObservableList<MenuItem> items = menu.getItems();
                 
items.get(COPY_PATH).setDisable(!IOUtilities.isKindOfPath(path));
-                items.get(OPEN_FOLDER).setDisable(PathAction.isBrowseDisabled 
|| IOUtilities.toFile(path) == null);
+                
items.get(OPEN_FOLDER).setDisable(PathAction.isBrowseDisabled(path));
                 final CheckMenuItem aggregated = (CheckMenuItem) 
items.get(AGGREGATED);
                 aggregated.setDisable(!aggregatable);
                 aggregated.setSelected(aggregatable && 
item.isView(TreeViewType.AGGREGATION));
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceEvent.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceEvent.java
index 1f44d45726..c0107a1bbd 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceEvent.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceEvent.java
@@ -16,6 +16,8 @@
  */
 package org.apache.sis.gui.dataset;
 
+import java.io.File;
+import java.util.Optional;
 import java.nio.file.Path;
 import javafx.event.Event;
 import javafx.event.EventType;
@@ -24,10 +26,10 @@ import javafx.event.EventType;
 /**
  * Event sent when a resource is loaded or closed. The {@linkplain 
#getSource() source}
  * of this event are the {@link ResourceTree} instance on which handlers are 
registered.
- * The event contains a {@link Path} to the resource opened or closed.
+ * The event contains a {@link File} to the resource opened or closed.
  *
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.4
  *
  * @see ResourceTree#onResourceLoaded
  * @see ResourceTree#onResourceClosed
@@ -39,7 +41,7 @@ public class ResourceEvent extends Event {
     /**
      * For cross-version compatibility.
      */
-    private static final long serialVersionUID = -425980517754215310L;
+    private static final long serialVersionUID = 1363812583271647542L;
 
     /**
      * The type for load events.
@@ -56,12 +58,9 @@ public class ResourceEvent extends Event {
     static final EventType<ResourceEvent> CLOSED = new EventType<>("CLOSED");
 
     /**
-     * Path to the resource being loaded or closed.
-     *
-     * @todo The default implementation provided by the JDK is not 
serializable.
-     *       We have no workaround at this time.
+     * Path to the resource being opened or closed, or {@code null} if unknown.
      */
-    private final Path path;
+    private final File file;
 
     /**
      * Creates a new event.
@@ -72,15 +71,23 @@ public class ResourceEvent extends Event {
      */
     ResourceEvent(final ResourceTree source, final Path path, final 
EventType<ResourceEvent> type) {
         super(source, null, type);
-        this.path = path;
+        File f;
+        try {
+            f = path.toFile();
+        } catch (UnsupportedOperationException e) {
+            f = null;
+        }
+        file = f;
     }
 
     /**
-     * Returns the path to the resource being loaded or closed.
+     * Returns the path to the resource being opened or closed.
+     *
+     * @return path to the resource being opened or closed.
      *
-     * @return path to the resource being loaded or closed.
+     * @since 1.4
      */
-    public Path getResourcePath() {
-        return path;
+    public Optional<File> getResourceFile() {
+        return Optional.ofNullable(file);
     }
 }
diff --git 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/package-info.java
 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/package-info.java
index 2ebdaecc2c..81a21094de 100644
--- 
a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/package-info.java
+++ 
b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/package-info.java
@@ -24,7 +24,7 @@
  * @author  Smaniotto Enzo (GSoC)
  * @author  Johann Sorel (Geomatys)
  * @author  Martin Desruisseaux (Geomatys)
- * @version 1.3
+ * @version 1.4
  * @since   1.1
  */
 package org.apache.sis.gui.dataset;
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Arithmetic.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Arithmetic.java
index 22e5201cef..d6ffd7d4ed 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Arithmetic.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/Arithmetic.java
@@ -114,7 +114,7 @@ public enum Arithmetic {
      * If the conversion is not exact, then this method returns {@code null}.
      *
      * @param  element  the value to return as a long integer, or {@code null} 
if zero.
-     * @return the value as a long integer, or {@code null} if it can not be 
converted.
+     * @return the value as a long integer, or {@code null} if it cannot be 
converted.
      */
     private static Long tryLongValue(final Number element) {
         if (element == null || element instanceof Long) {
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java
index 5b5cf52834..1075976a75 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridFile.java
@@ -117,6 +117,8 @@ abstract class DatumShiftGridFile<C extends Quantity<C>, T 
extends Quantity<T>>
      * The files from which the grid has been loaded. This is not used 
directly by this class
      * (except for {@link #equals(Object)} and {@link #hashCode()}), but can 
be used by math
      * transform for setting the parameter values. Shall never be null and 
never empty.
+     *
+     * @see <a href="https://issues.apache.org/jira/browse/SIS-569";>SIS-569</a>
      */
     private final URI[] files;
 
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java
index 1db194ec33..ca42083b37 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/DatumShiftGridLoader.java
@@ -173,7 +173,7 @@ abstract class DatumShiftGridLoader {
      *
      * @param  path  the path from where to read bytes.
      * @return a channel for reading bytes from the given path.
-     * @throws IOException if the channel can not be created.
+     * @throws IOException if the channel cannot be created.
      */
     static ReadableByteChannel newByteChannel(final URI path) throws 
IOException {
         try {
diff --git a/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java 
b/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
index 9c41ea3bd2..5805c1ac5d 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/math/Fraction.java
@@ -80,7 +80,7 @@ public final class Fraction extends Number implements 
Comparable<Fraction>, Seri
      * @param  numerator    numerator of the fraction to return.
      * @param  denominator  denominator of the fraction to return.
      * @return the simplified fraction.
-     * @throws ArithmeticException if the numerator and denominator can not be 
represented by 32 bit integers.
+     * @throws ArithmeticException if the numerator and denominator cannot be 
represented by 32 bit integers.
      *
      * @since 1.4
      */
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/measure/DefaultQuantityFactory.java
 
b/core/sis-utility/src/main/java/org/apache/sis/measure/DefaultQuantityFactory.java
index 915e151a72..943088f37d 100644
--- 
a/core/sis-utility/src/main/java/org/apache/sis/measure/DefaultQuantityFactory.java
+++ 
b/core/sis-utility/src/main/java/org/apache/sis/measure/DefaultQuantityFactory.java
@@ -23,7 +23,7 @@ import javax.measure.spi.QuantityFactory;
 
 
 /**
- * Default factory when {@link SystemUnit} can not be used directly.
+ * Default factory when {@link SystemUnit} cannot be used directly.
  *
  * @author  Martin Desruisseaux (MPO, Geomatys)
  * @version 1.4
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/measure/QuantityFormat.java 
b/core/sis-utility/src/main/java/org/apache/sis/measure/QuantityFormat.java
index a12835a01a..8adfd750d2 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/QuantityFormat.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/QuantityFormat.java
@@ -158,7 +158,7 @@ public class QuantityFormat extends Format implements 
javax.measure.format.Quant
      *
      * @param  source  the text to parse.
      * @return the quantity parsed from the specified text.
-     * @throws MeasurementParseException if the given text can not be parsed.
+     * @throws MeasurementParseException if the given text cannot be parsed.
      * @since  1.4
      */
     @Override
@@ -173,7 +173,7 @@ public class QuantityFormat extends Format implements 
javax.measure.format.Quant
      * @param  source  the text, part of which should be parsed.
      * @param  pos     index and error index information.
      * @return the quantity parsed from the specified character sub-sequence.
-     * @throws MeasurementParseException if the given text can not be parsed.
+     * @throws MeasurementParseException if the given text cannot be parsed.
      * @since  1.4
      */
     @Override
diff --git 
a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitRegistry.java 
b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitRegistry.java
index 0749a07cae..1fed3d861f 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitRegistry.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitRegistry.java
@@ -255,7 +255,7 @@ final class UnitRegistry implements SystemOfUnits, 
Serializable {
      *
      * @param  symbols  the string representation of a unit.
      * @return the unit with the given string representation,
-     *         or {@code null} if the give symbols can not be parsed.
+     *         or {@code null} if the give symbols cannot be parsed.
      */
     @Override
     public Unit<?> getUnit(final String symbols) {
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java 
b/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
index 6ae0d9ebdc..349489de61 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/Numbers.java
@@ -244,7 +244,7 @@ public final class Numbers extends Static {
      * @param  value  the value to return as a long integer.
      * @return the value rounded to nearest long integer.
      * @throws NullPointerException if the given number is {@code null}.
-     * @throws ArithmeticException if the value can not be represented as a 
long integer.
+     * @throws ArithmeticException if the value cannot be represented as a 
long integer.
      *
      * @see Math#round(double)
      * @see BigDecimal#longValueExact()
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/FileCacheByteChannel.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/FileCacheByteChannel.java
index 6189da27c7..986b804628 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/FileCacheByteChannel.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/FileCacheByteChannel.java
@@ -285,7 +285,7 @@ public abstract class FileCacheByteChannel implements 
SeekableByteChannel {
      * The source of bytes will be provided by {@link #openConnection(long, 
long)}.
      *
      * @param  prefix  prefix of the temporary file to create.
-     * @throws IOException if the temporary file can not be created.
+     * @throws IOException if the temporary file cannot be created.
      */
     protected FileCacheByteChannel(final String prefix) throws IOException {
         rangesOfAvailableBytes = RangeSet.create(Long.class, true, false);
@@ -313,7 +313,7 @@ public abstract class FileCacheByteChannel implements 
SeekableByteChannel {
      * @param  end    position of the last byte to read with the returned 
stream (inclusive),
      *                or {@link Long#MAX_VALUE} for end of stream.
      * @return information about the input stream providing the bytes to read 
starting at the given start position.
-     * @throws IOException if the connection can not be established.
+     * @throws IOException if the connection cannot be established.
      */
     protected abstract Connection openConnection(long start, long end) throws 
IOException;
 
@@ -410,7 +410,7 @@ public abstract class FileCacheByteChannel implements 
SeekableByteChannel {
      * {@link #position} (it may be 0).
      *
      * @return the opened connection (never {@code null}).
-     * @throws IOException if the connection can not be established.
+     * @throws IOException if the connection cannot be established.
      */
     private Connection openConnection() throws IOException {
         long end = endOfInterest;
@@ -510,7 +510,7 @@ public abstract class FileCacheByteChannel implements 
SeekableByteChannel {
         }
         /*
          * At this point we need to download data from the input stream.
-         * If previous connection can not be used, open a new one for the 
range of bytes to read.
+         * If previous connection cannot be used, open a new one for the range 
of bytes to read.
          * Then skip all bytes between the current position and the requested 
position.
          * Those bytes will be saved in the cache.
          */
@@ -693,7 +693,7 @@ public abstract class FileCacheByteChannel implements 
SeekableByteChannel {
     /**
      * Notifies that the connection has been used and should not be closed 
before some timeout.
      * This method may schedule a task to be executed in a background thread 
after the timeout.
-     * If the connection can not read sub-ranges of bytes, then this method 
does nothing because
+     * If the connection cannot read sub-ranges of bytes, then this method 
does nothing because
      * reopening a new connection would be costly.
      */
     private void usedConnection() {
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/HttpByteChannel.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/HttpByteChannel.java
index 2af097c789..b9e91523a0 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/HttpByteChannel.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/HttpByteChannel.java
@@ -77,7 +77,7 @@ final class HttpByteChannel extends FileCacheByteChannel {
      *
      * @param  name  data store name to report in case of failure.
      * @param  path  URL to the file to read.
-     * @throws IOException if the temporary file can not be created.
+     * @throws IOException if the temporary file cannot be created.
      */
     public HttpByteChannel(final String name, final URI path) throws 
IOException {
         super("http-");
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java
index 60b852f4bc..7e4ca240b6 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/io/IOUtilities.java
@@ -201,27 +201,6 @@ public final class IOUtilities extends Static {
         return null;
     }
 
-    /**
-     * Returns the given path as a {@link File}, or {@code null} if it cannot 
be converted.
-     *
-     * @param  path  the object to convert to a {@link File}. Can be {@code 
null}.
-     * @return the given path as a {@link File}, or {@code null} if it cannot 
be converted.
-     */
-    public static File toFile(final Object path) {
-        if (path instanceof File) {
-            return (File) path;
-        } else if (path instanceof Path) try {
-            return ((Path) path).toFile();
-        } catch (UnsupportedOperationException e) {
-            // Ignore.
-        } else if (path instanceof URI) try {
-            return new File((URI) path);
-        } catch (IllegalArgumentException e) {
-            // Ignore.
-        }
-        return null;
-    }
-
     /**
      * Converts the given {@link URI} to a {@link URL} with the same path 
except for the file extension,
      * which is replaced by the given extension. This method is used for 
opening auxiliary files such as
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
index de42ec7c41..92950cfb09 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/DataStoreProvider.java
@@ -336,7 +336,7 @@ public abstract class DataStoreProvider {
             final Class<S> type, final Prober<? super S> prober) throws 
DataStoreException
     {
         ArgumentChecks.ensureNonNull("prober", prober);
-        boolean undetermined = false;
+        boolean undetermined;
         /*
          * Synchronization is not a documented feature for now because the 
policy may change in future version.
          * Current version uses the storage source as the synchronization lock 
because using `StorageConnector`
@@ -446,7 +446,7 @@ public abstract class DataStoreProvider {
                  */
                 final ProbeInputStream stream = new 
ProbeInputStream(connector, (InputStream) input);
                 result = prober.test(type.cast(stream));
-                stream.close();                 // Reset (not close) the 
wrapped stream.
+                stream.close();     // No "try with resource". See 
`ProbeInputStream.close()` contract.
             } else if (input instanceof RewindableLineReader) {
                 /*
                  * `Reader` supports at most one mark. So we keep it for 
ourselves and prevent users
@@ -458,9 +458,9 @@ public abstract class DataStoreProvider {
                 result = prober.test(input);
                 r.protectedReset();
             } else if (input instanceof Reader) {
-                final Reader stream = new ProbeReader(connector, (Reader) 
input);
+                final ProbeReader stream = new ProbeReader(connector, (Reader) 
input);
                 result = prober.test(type.cast(stream));
-                stream.close();                 // Reset (not close) the 
wrapped reader.
+                stream.close();     // No "try with resource". See 
`ProbeReader.close()` contract.
             } else {
                 /*
                  * All other cases are objects like File, URL, etc. which can 
be used without mark/reset.
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeInputStream.java
 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeInputStream.java
index 812b0488dd..dee9603fa9 100644
--- 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeInputStream.java
+++ 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeInputStream.java
@@ -75,6 +75,8 @@ final class ProbeInputStream extends FilterInputStream {
 
     /**
      * Closes this stream and resets the wrapped stream to its original 
position.
+     * The wrapped stream is <em>not</em> closed, so this method does not 
really
+     * release any resource. Closing the wrapped stream is caller's 
responsibility.
      */
     @Override
     public void close() throws IOException {
diff --git 
a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeReader.java 
b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeReader.java
index be36208eb7..5f25cba743 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeReader.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/ProbeReader.java
@@ -77,6 +77,8 @@ final class ProbeReader extends FilterReader {
 
     /**
      * Closes this reader and resets the wrapped reader to its original 
position.
+     * The wrapped reader is <em>not</em> closed, so this method does not 
really
+     * release any resource. Closing the wrapped reader is caller's 
responsibility.
      */
     @Override
     public void close() throws IOException {
diff --git 
a/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/FileCacheByteChannelTest.java
 
b/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/FileCacheByteChannelTest.java
index 043d6c7990..fc7c8ad3c9 100644
--- 
a/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/FileCacheByteChannelTest.java
+++ 
b/storage/sis-storage/src/test/java/org/apache/sis/internal/storage/io/FileCacheByteChannelTest.java
@@ -64,7 +64,7 @@ public final class FileCacheByteChannelTest extends TestCase {
          *
          * @param  test  a name to use for identifying the test in error 
messages.
          * @param  rg    generator of random numbers for controlling the 
behavior of this channel.
-         * @throws IOException if the temporary file can not be created.
+         * @throws IOException if the temporary file cannot be created.
          */
         Implementation(final String test, final Random rg) throws IOException {
             super("Test-");

Reply via email to