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

pottlinger pushed a commit to branch fix/RAT-496
in repository https://gitbox.apache.org/repos/asf/creadur-rat.git


The following commit(s) were added to refs/heads/fix/RAT-496 by this push:
     new 205f5b5c RAT-496: Fix FileNotFound if test resource path contains 
spaces
205f5b5c is described below

commit 205f5b5c3c690aed5aec284535c4b2b5094396bf
Author: P. Ottlinger <[email protected]>
AuthorDate: Tue Oct 7 22:33:42 2025 +0200

    RAT-496: Fix FileNotFound if test resource path contains spaces
---
 apache-rat-core/src/it/java/org/apache/rat/ReportTest.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/apache-rat-core/src/it/java/org/apache/rat/ReportTest.java 
b/apache-rat-core/src/it/java/org/apache/rat/ReportTest.java
index 1864725c..d29f0781 100644
--- a/apache-rat-core/src/it/java/org/apache/rat/ReportTest.java
+++ b/apache-rat-core/src/it/java/org/apache/rat/ReportTest.java
@@ -23,7 +23,9 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintStream;
+import java.net.URISyntaxException;
 import java.net.URL;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Stream;
@@ -35,7 +37,6 @@ import org.apache.commons.io.filefilter.AbstractFileFilter;
 import org.apache.commons.io.filefilter.DirectoryFileFilter;
 import org.apache.commons.io.filefilter.NameFileFilter;
 import org.apache.commons.io.filefilter.OrFileFilter;
-import org.apache.commons.lang3.StringUtils;
 import org.apache.rat.api.Document;
 import org.apache.rat.api.RatException;
 import org.apache.rat.commandline.Arg;
@@ -152,9 +153,12 @@ public class ReportTest {
     static Stream<Arguments> args() throws RatException {
         List<Arguments> results = new ArrayList<>();
         URL url = ReportTest.class.getResource("/ReportTest");
-        String urlAsFile = url.getFile();
-        if(StringUtils.isEmpty(urlAsFile)) {
-            throw new RatException("Could not find root directory for " + url);
+
+        String urlAsFile;
+        try {
+            urlAsFile = Paths.get(url.toURI()).toString();
+        } catch (URISyntaxException e) {
+            throw new RatException("Unable to find root directory for " + url, 
e);
         }
 
         File baseDir = new File(urlAsFile);

Reply via email to