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 13:21:17 UTC

svn commit: rev 46108 - incubator/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting

Author: andreas
Date: Wed Sep 15 04:21:17 2004
New Revision: 46108

Modified:
   incubator/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java
Log:
check if file exists before creating

Modified: incubator/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java
==============================================================================
--- incubator/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java	(original)
+++ incubator/lenya/trunk/src/java/org/apache/lenya/cms/cocoon/acting/UploadAction.java	Wed Sep 15 04:21:17 2004
@@ -166,9 +166,11 @@
      * @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];

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