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

svn commit: r645130 - in /maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it: pom.xml verify.bsh

Author: bentmann
Date: Sat Apr  5 09:25:02 2008
New Revision: 645130

URL: http://svn.apache.org/viewvc?rev=645130&view=rev
Log:
o Decoupled IT from file system for more robustness

Modified:
    maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/pom.xml
    maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/verify.bsh

Modified: maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/pom.xml?rev=645130&r1=645129&r2=645130&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/pom.xml (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/pom.xml Sat Apr  5 09:25:02 2008
@@ -9,8 +9,6 @@
   <version>1.0-SNAPSHOT</version>
 
   <build>
-    <!-- some non-ascii characters here -->
-    <finalName>encoding-it-&#x00E4;&#x00F6;&#x00FC;&#x00DF;</finalName>
     <plugins>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -48,5 +46,9 @@
       </plugin>
     </plugins>
   </build>
+  <reporting>
+    <!-- some non-ascii characters here -->
+    <outputDirectory>target/site-&#x00E4;&#x0130;&#x03A3;&#x05D0;&#x06DE;</outputDirectory>
+  </reporting>
 
 </project>

Modified: maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/verify.bsh?rev=645130&r1=645129&r2=645130&view=diff
==============================================================================
--- maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/verify.bsh (original)
+++ maven/plugins/trunk/maven-ant-plugin/src/it/encoding-it/verify.bsh Sat Apr  5 09:25:02 2008
@@ -1,37 +1,23 @@
 import java.io.*;
 import java.util.*;
+import java.util.regex.*;
+
+import org.codehaus.plexus.util.*;
 
 try
 {
-    File targetDir = new File( basedir, "target" );
-    File[] files = targetDir.listFiles();
-    for ( int i = 0; i < files.length; i++ )
+    File buildFile = new File( basedir, "maven-build.xml" );
+    String xml = FileUtils.fileRead( buildFile, "UTF-8" );
+
+    Matcher matcher = Pattern.compile( "value\\s*=\\s*\"\\$\\{maven.build.dir\\}/site-([^\"]+)\"" ).matcher( xml );
+    matcher.find();
+    String chars = matcher.group( 1 );
+
+    if ( !"\u00E4\u0130\u03A3\u05D0\u06DE".equals( chars ) )
     {
-        File file = files[i];
-        if ( file.getName().toLowerCase( Locale.ENGLISH ).endsWith( ".jar" ) )
-        {
-            if ( file.getName().indexOf( '?' ) >= 0 )
-            {
-                System.err.println( "JAR file name contains corrupted characters: " + file );
-                System.err.println( "Platform encoding: " + System.getProperty( "file.encoding" ) );
-                String expected = "\u00E4\u00F6\u00FC\u00DF";
-                System.err.println( "expected string with this platform encoding:" + expected );
-                String result = new String( expected.getBytes() );
-                if ( expected.equals( result ) )
-                {
-                    System.err.println( "Platform encoding supports these characters, filename should not be corrupted." );
-                    return false;
-                }
-                else
-                {
-                    System.err.println( "WARN: Platform encoding does not support these characters: filename is corrupted, but cannot determine if it's plugins' fault or not." );
-                }
-            }
-            return true;
-        }
+        System.err.println( "Generated build script contains corrupted characters: " + buildFile );
+        return false;
     }
-    System.err.println( "Could not find generated JAR file" );
-    return false;
 }
 catch( Throwable t )
 {