[ 
https://issues.apache.org/jira/browse/RAT-496?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Philipp Ottlinger resolved RAT-496.
-----------------------------------
    Resolution: Fixed

> FileNotFoundException in Resources.getExampleResource() if project path has a 
> space
> -----------------------------------------------------------------------------------
>
>                 Key: RAT-496
>                 URL: https://issues.apache.org/jira/browse/RAT-496
>             Project: Apache Rat
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 0.17
>            Reporter: Tilman Hausherr
>            Assignee: Philipp Ottlinger
>            Priority: Minor
>             Fix For: 0.17
>
>
> I tried to build on my machine and got this:
> java.io.FileNotFoundException: Source 
> 'XXXXX\Eigene%20Dateien\XXXX\Java\creadur-rat\apache-rat-core\target\test-classes\examples\exampleData\Source.java'
>  does not exist
>       at org.apache.commons.io.FileUtils.checkFileExists(FileUtils.java:317)
>       at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:855)
>       at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:888)
>       at org.apache.commons.io.FileUtils.copyFile(FileUtils.java:790)
>       at 
> org.apache.rat.document.FileDocumentTest.setUp(FileDocumentTest.java:50)
> This can be fixed by changing the code in {{Resources.java}} like this:
> {code:java}
>     public static File getExampleResource(String pResource) {
>         URL url = Resources.class.getResource("/examples/" + pResource);
>         Objects.requireNonNull(url, "/examples/" + pResource + " not found");
>         try
>         {
>             return Paths.get(url.toURI()).toFile();
>         }
>         catch (URISyntaxException ex)
>         {
>             throw new IllegalArgumentException(ex);
>         }
>     }
> {code}
> Using IllegalArgumentException because this is an unchecked exception. 
> Alternatively we could throw URISyntaxException but then we'd have to change 
> more files.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to