unicorn commit: fixed: no initialization failed exception if uploaded or temporary files directories exist

changeset:   1267:ec093465c1ff
tag:         tip
user:        Thomas Gambet <tgambet@w3.org>
date:        Thu Jun 17 12:12:55 2010 -0400
files:       src/org/w3c/unicorn/Framework.java
description:
fixed: no initialization failed exception if uploaded or temporary files directories exist


diff -r 5a2584cc6304 -r ec093465c1ff src/org/w3c/unicorn/Framework.java
--- a/src/org/w3c/unicorn/Framework.java	Thu Jun 17 11:23:24 2010 -0400
+++ b/src/org/w3c/unicorn/Framework.java	Thu Jun 17 12:12:55 2010 -0400
@@ -165,16 +165,18 @@
 		} 
 		
 		// creating uploaded and temporary files directories
-		if ((new File(Property.get("UPLOADED_FILES_REPOSITORY"))).mkdir())
+		File upload_repo = new File(Property.get("UPLOADED_FILES_REPOSITORY"));
+		File temporary_repo = new File(Property.get("UPLOADED_FILES_REPOSITORY"));
+		if (upload_repo.mkdir() || upload_repo.exists())
 			logger.debug("> Created uploaded files directory: \n\t" 
 				+ Property.get("UPLOADED_FILES_REPOSITORY"));
 		else 
 			throw new InitializationFailedException("Unable to create uploaded files directory: \n\t"
 				+ Property.get("UPLOADED_FILES_REPOSITORY"));
-		if ((new File(Property.get("PATH_TO_TEMPORARY_FILES"))).mkdir())
+		if (temporary_repo.mkdir() || temporary_repo.exists())
 			logger.debug("> Created temporary files directory: \n\t" 
 				+ Property.get("PATH_TO_TEMPORARY_FILES"));
-		else 
+		else
 			throw new InitializationFailedException("Unable to create temporary files directory: \n\t"
 				+ Property.get("PATH_TO_TEMPORARY_FILES"));
 		

Received on Thursday, 17 June 2010 16:13:21 UTC