Author: liuzhe
Date: Tue Sep 18 03:57:22 2012
New Revision: 1386980

URL: http://svn.apache.org/viewvc?rev=1386980&view=rev
Log:
The name of the file downloaded from URL is not correct

Modified:
    
incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java

Modified: 
incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java?rev=1386980&r1=1386979&r2=1386980&view=diff
==============================================================================
--- 
incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java
 (original)
+++ 
incubator/ooo/trunk/test/testcommon/source/org/openoffice/test/common/Testspace.java
 Tue Sep 18 03:57:22 2012
@@ -80,28 +80,27 @@ public class Testspace {
        }
        
        public static String prepareData(String dataFilePath, String to) {
-               File dataFile = prepareDataFile(dataFilePath,to);
+               File dataFile = prepareDataFile(dataFilePath, to);
                return dataFile.getAbsolutePath();
        }
        
        public static File prepareDataFile(String dataFilePath) {
-               String name = new File(dataFilePath).getName();
-               return prepareDataFile(dataFilePath, "temp/" + name);
+               getFile("temp").mkdir();
+               return prepareDataFile(dataFilePath, "temp");
        }
        
        public static File prepareDataFile(String dataFilePath, String to) {
                File workingFile = getFile(to);
-               
                if (FileUtil.isUrl(dataFilePath)) {
-                       if (FileUtil.download(dataFilePath, workingFile) == 
null) {
+                       if ((workingFile = FileUtil.download(dataFilePath, 
workingFile)) == null) {
                                throw new RuntimeException("Can not prepare 
data: " + dataFilePath);
                        }
                        return workingFile;
                }
                
-               
                File dataFile = new File(dataFilePath);
-               
+               if (workingFile.isDirectory()) 
+                       workingFile = new File(workingFile, 
workingFile.getName());
                
                if (!dataFile.isAbsolute()) 
                        dataFile = new File(testdata, dataFilePath);


Reply via email to