You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2008/04/05 13:16:33 UTC

svn commit: r645078 - /maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java

Author: hboutemy
Date: Sat Apr  5 04:16:31 2008
New Revision: 645078

URL: http://svn.apache.org/viewvc?rev=645078&view=rev
Log:
fixed tests when there are spaces in directory name

Modified:
    maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java

Modified: maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java
URL: http://svn.apache.org/viewvc/maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java?rev=645078&r1=645077&r2=645078&view=diff
==============================================================================
--- maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java (original)
+++ maven/plugin-tools/trunk/maven-plugin-tools-java/src/test/java/org/apache/maven/tools/plugin/extractor/java/JavaMojoDescriptorExtractorTest.java Sat Apr  5 04:16:31 2008
@@ -27,7 +27,9 @@
 import org.apache.maven.project.MavenProject;
 
 import java.io.File;
+import java.io.UnsupportedEncodingException;
 import java.net.URL;
+import java.net.URLDecoder;
 import java.util.List;
 
 /**
@@ -104,7 +106,7 @@
         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();
         URL resource = cl.getResource( classpathResource );
@@ -112,7 +114,8 @@
         File result = 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;