Skip to content

Commit c33e1c8

Browse files
plamentotevolamy
authored andcommitted
Fix tests failing failing when the test directory contains spaces (#44)
`new File( markerResource.getPath() )` does not work when `markerResource` contains spaces or other characters that are URL encoded. The `File` constructor that takes URI as argument, takes care of those cases.
1 parent cc6551c commit c33e1c8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

plexus-compiler-api/src/test/java/org/codehaus/plexus/compiler/util/scan/AbstractSourceInclusionScannerTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.File;
2020
import java.io.FileWriter;
2121
import java.io.IOException;
22+
import java.net.URISyntaxException;
2223
import java.net.URL;
2324
import java.util.Set;
2425

@@ -71,6 +72,7 @@ public void testGetIncludedSources()
7172
// ----------------------------------------------------------------------
7273

7374
protected File getTestBaseDir()
75+
throws URISyntaxException
7476
{
7577
ClassLoader cl = Thread.currentThread().getContextClassLoader();
7678
URL markerResource = cl.getResource( TESTFILE_DEST_MARKER_FILE );
@@ -79,7 +81,7 @@ protected File getTestBaseDir()
7981

8082
if ( markerResource != null )
8183
{
82-
File marker = new File( markerResource.getPath() );
84+
File marker = new File( markerResource.toURI() );
8385

8486
basedir = marker.getParentFile().getAbsoluteFile();
8587
}

0 commit comments

Comments
 (0)