You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2004/09/15 12:19:17 UTC

svn commit: rev 46106 - incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting

Author: antonio
Date: Wed Sep 15 03:19:16 2004
New Revision: 46106

Modified:
   incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java
Log:
Check if the images is already uploaded

Modified: incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java
==============================================================================
--- incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java	(original)
+++ incubator/lenya/branches/BRANCH_1_2_X/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java	Wed Sep 15 03:19:16 2004
@@ -15,7 +15,7 @@
  *
  */
 
-/* $Id: UploadAction.java,v 1.9 2004/08/25 09:13:36 andreas Exp $  */
+/* $Id$  */
 
 package org.apache.lenya.cms.cocoon.acting;
 
@@ -167,10 +167,12 @@
      * @throws Exception if an error occurs.
      */
     protected void saveAsset(File assetFile, Part part) throws Exception {
-        boolean created = assetFile.createNewFile();
-        if (!created) {
-            throw new RuntimeException("The file [" + assetFile + "] could not be created.");
-        }
+        if (!assetFile.exists()) {
+            boolean created = assetFile.createNewFile();
+            if (!created) {
+                throw new RuntimeException("The file [" + assetFile + "] could not be created.");
+            }
+	}
 
         byte[] buf = new byte[4096];
         FileOutputStream out = new FileOutputStream(assetFile);

---------------------------------------------------------------------
To unsubscribe, e-mail: lenya-cvs-unsubscribe@cocoon.apache.org
For additional commands, e-mail: lenya-cvs-help@cocoon.apache.org