ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r1447450 - /ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
Date Mon, 18 Feb 2013 19:37:49 GMT
Author: antoine
Date: Mon Feb 18 19:37:49 2013
New Revision: 1447450

URL: http://svn.apache.org/r1447450
Log:
fix test error happening under Windows @ Jetbrains see http://teamcity.jetbrains.com/viewType.html?buildTypeId=bt133

Modified:
    ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java

Modified: ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java?rev=1447450&r1=1447449&r2=1447450&view=diff
==============================================================================
--- ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
(original)
+++ ant/core/trunk/src/tests/junit/org/apache/tools/ant/taskdefs/ManifestClassPathTest.java
Mon Feb 18 19:37:49 2013
@@ -22,6 +22,9 @@ import org.apache.tools.ant.BuildFileTes
 import org.apache.tools.ant.taskdefs.condition.Os;
 import org.apache.tools.ant.util.regexp.RegexpMatcherFactory;
 
+import java.io.File;
+import java.io.IOException;
+
 /**
  * Tests <bm:manifestclasspath>.
  */
@@ -167,10 +170,27 @@ public class ManifestClassPathTest
         if (!Os.isFamily("windows")) {
             System.out.println("Test with drive letters only run on windows");
         } else {
+            // the lines below try to find a drive name different than the one containing
the temp dir
+            // if the temp dir is C will try to use D
+            // if the temp dir is on D or other will try to use C
+            File tmpdir = new File(System.getProperty("java.io.tmpdir"));
+            String driveLetter = "C";
+            try {
+                String tmpCanonicalPath = tmpdir.getCanonicalPath();
+                driveLetter = tmpCanonicalPath.substring(1).toUpperCase();
+            } catch (IOException ioe) {
+                System.out.println("exception happened getting canonical path of java.io.tmpdir
: " + ioe.getMessage());
+            }
+            String altDriveLetter = null;
             try {
-                new java.io.File("D:/foo.txt").getCanonicalPath();
+                if ("C".equals(driveLetter)) {
+                    altDriveLetter = "D";
+                } else {
+                    altDriveLetter = "C";
+                }
+                new java.io.File(altDriveLetter + ":/foo.txt").getCanonicalPath();
             } catch (java.io.IOException e) {
-                System.out.println("drive d: doesn't exist or is not ready,"
+                System.out.println("drive " + altDriveLetter + ": doesn't exist or is not
ready,"
                                    + " skipping test");
                 return;
             }



Mime
View raw message