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 0a1d7bd6c3 Replace a NullPointerException by a more explicit message 
about the failure cause.
0a1d7bd6c3 is described below

commit 0a1d7bd6c338e8195509dc06a3580fddd58716cb
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Sun Oct 1 22:37:26 2023 +0200

    Replace a NullPointerException by a more explicit message about the failure 
cause.
---
 .../main/org/apache/sis/buildtools/gradle/ZipWriter.java           | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ZipWriter.java
 
b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ZipWriter.java
index f28c53da19..b8440e088f 100644
--- 
a/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ZipWriter.java
+++ 
b/buildSrc/src/org.apache.sis.buildtools/main/org/apache/sis/buildtools/gradle/ZipWriter.java
@@ -19,6 +19,7 @@ package org.apache.sis.buildtools.gradle;
 import java.io.File;
 import java.io.FileFilter;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.IOException;
@@ -218,9 +219,13 @@ abstract class ZipWriter extends Conventions {
      * @throws IOException if an error occurred while reading the source or 
writing the ZIP file.
      */
     protected final void writeDirectory(final File source, final FileFilter 
filter, final String target) throws IOException {
+        final File[] files = listIgnoreHidden(source);
+        if (files == null) {
+            throw new FileNotFoundException("Directory does not exist: " + 
source);
+        }
         path.setLength(0);
         path.append(target);
-        for (final File file : listIgnoreHidden(source)) {
+        for (final File file : files) {
             if (filter == null || filter.accept(file)) {
                 appendRecursively(file);
             }

Reply via email to