cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r410056 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/CopySourceAction.java
Date Mon, 29 May 2006 08:52:08 GMT
Author: antonio
Date: Mon May 29 01:52:08 2006
New Revision: 410056

URL: http://svn.apache.org/viewvc?rev=410056&view=rev
Log:
Using SourceUtil.copy(). Thanks to Frédéric Glorieux. See COCOON-1815

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/CopySourceAction.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/CopySourceAction.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/CopySourceAction.java?rev=410056&r1=410055&r2=410056&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/CopySourceAction.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/CopySourceAction.java Mon
May 29 01:52:08 2006
@@ -28,6 +28,7 @@
 import org.apache.excalibur.source.ModifiableSource;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.SourceUtil;
 import org.apache.excalibur.source.TraversableSource;
 
 /**
@@ -43,7 +44,7 @@
  *</pre>
  *
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
- * @version CVS $Id: CopySourceAction.java,v 1.3 2004/03/05 13:02:43 bdelacretaz Exp $
+ * @version $Id$
  */
 public class CopySourceAction extends ServiceableAction implements ThreadSafe
 {
@@ -89,17 +90,9 @@
         
         // And transfer all content.
         try {
-            byte[] buffer = new byte[1024];
-            int len;
-            while ((len = is.read(buffer, 0, buffer.length)) > 0) {
-                os.write(buffer, 0, len);
-            }
-            os.close();
-        } catch(Exception e) {
-            if (wdest.canCancel(os)) {
-                wdest.cancel(os);
-            }
+            SourceUtil.copy(is, os);
         } finally {
+            os.close();
             is.close();
         }
         // Success !



Mime
View raw message