o Wrapped checked exception
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@645233 13f79535-47bb-0310-9956-ffa450edef68master
parent
dac53b5855
commit
90d9118e31
|
|
@ -27,7 +27,6 @@ import org.codehaus.plexus.util.xml.CompactXMLWriter;
|
||||||
import org.codehaus.plexus.util.xml.XMLWriter;
|
import org.codehaus.plexus.util.xml.XMLWriter;
|
||||||
|
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -72,7 +71,7 @@ public class PluginUtilsTest
|
||||||
assertEquals( pattern, output );
|
assertEquals( pattern, output );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldFindTwoScriptsWhenNoExcludesAreGiven() throws UnsupportedEncodingException
|
public void testShouldFindTwoScriptsWhenNoExcludesAreGiven()
|
||||||
{
|
{
|
||||||
String testScript = "test.txt";
|
String testScript = "test.txt";
|
||||||
|
|
||||||
|
|
@ -84,7 +83,7 @@ public class PluginUtilsTest
|
||||||
assertEquals( 2, files.length );
|
assertEquals( 2, files.length );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testShouldFindOneScriptsWhenAnExcludeIsGiven() throws UnsupportedEncodingException
|
public void testShouldFindOneScriptsWhenAnExcludeIsGiven()
|
||||||
{
|
{
|
||||||
String testScript = "test.txt";
|
String testScript = "test.txt";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ public class TestUtils
|
||||||
assertEquals( URLDecoder.decode( resource.getPath(), "UTF-8" ), basedir + classname );
|
assertEquals( URLDecoder.decode( resource.getPath(), "UTF-8" ), basedir + classname );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String dirname( String file ) throws UnsupportedEncodingException
|
public static String dirname( String file )
|
||||||
{
|
{
|
||||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
URL fileResource = cl.getResource( file );
|
URL fileResource = cl.getResource( file );
|
||||||
|
|
@ -52,7 +52,19 @@ public class TestUtils
|
||||||
|
|
||||||
String path = fullPath.substring( 0, fullPath.length() - file.length() );
|
String path = fullPath.substring( 0, fullPath.length() - file.length() );
|
||||||
|
|
||||||
return URLDecoder.decode( path, "UTF-8" ); // necessary for JDK 1.5+, where spaces are escaped to %20
|
try
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* FIXME: URL encoding and HTML form encoding are not the same. Use FileUtils.toFile(URL) from plexus-utils
|
||||||
|
* once PLXUTILS-56 is released.
|
||||||
|
*/
|
||||||
|
// necessary for JDK 1.5+, where spaces are escaped to %20
|
||||||
|
return URLDecoder.decode( path, "UTF-8" );
|
||||||
|
}
|
||||||
|
catch ( UnsupportedEncodingException e )
|
||||||
|
{
|
||||||
|
throw new Error( "Broken JVM, UTF-8 must be supported", e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -106,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 ) throws UnsupportedEncodingException
|
private File fileOf( String classpathResource )
|
||||||
{
|
{
|
||||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||||
URL resource = cl.getResource( classpathResource );
|
URL resource = cl.getResource( classpathResource );
|
||||||
|
|
@ -114,8 +114,19 @@ public class JavaMojoDescriptorExtractorTest
|
||||||
File result = null;
|
File result = null;
|
||||||
if ( resource != null )
|
if ( resource != null )
|
||||||
{
|
{
|
||||||
// URLDecoder.decode necessary for JDK 1.5+, where spaces are escaped to %20
|
try
|
||||||
result = new File( URLDecoder.decode( resource.getPath(), "UTF-8" ) );
|
{
|
||||||
|
/*
|
||||||
|
* FIXME: URL encoding and HTML form encoding are not the same. Use FileUtils.toFile(URL) from
|
||||||
|
* plexus-utils once PLXUTILS-56 is released.
|
||||||
|
*/
|
||||||
|
// URLDecoder.decode necessary for JDK 1.5+, where spaces are escaped to %20
|
||||||
|
result = new File( URLDecoder.decode( resource.getPath(), "UTF-8" ) );
|
||||||
|
}
|
||||||
|
catch ( UnsupportedEncodingException e )
|
||||||
|
{
|
||||||
|
throw new Error( "Broken JVM, UTF-8 must be supported", e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue