fixed tests when there are spaces in directory name
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@645078 13f79535-47bb-0310-9956-ffa450edef68master
parent
31e3987e33
commit
b7ef019ea8
|
|
@ -27,7 +27,9 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URLDecoder;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -104,7 +106,7 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
assertEquals( "Implementation parameter", "source2.sub.MyBla", parameter.getImplementation() );
|
assertEquals( "Implementation parameter", "source2.sub.MyBla", parameter.getImplementation() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private File fileOf( String classpathResource )
|
private File fileOf( String classpathResource ) throws UnsupportedEncodingException
|
||||||
{
|
{
|
||||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
URL resource = cl.getResource( classpathResource );
|
URL resource = cl.getResource( classpathResource );
|
||||||
|
|
@ -112,7 +114,8 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
File result = null;
|
File result = null;
|
||||||
if ( resource != null )
|
if ( resource != null )
|
||||||
{
|
{
|
||||||
result = new File( resource.getPath() );
|
// URLDecoder.decode necessary for JDK 1.5+, where spaces are escaped to %20
|
||||||
|
result = new File( URLDecoder.decode( resource.getPath(), "UTF-8" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue