cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r433477 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/acting/CopySourceAction.java
Date Tue, 22 Aug 2006 02:46:10 GMT
Author: antonio
Date: Mon Aug 21 19:46:10 2006
New Revision: 433477

URL: http://svn.apache.org/viewvc?rev=433477&view=rev
Log:
Fixing fix for 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=433477&r1=433476&r2=433477&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
Aug 21 19:46:10 2006
@@ -15,8 +15,6 @@
  */
 package org.apache.cocoon.acting;
 
-import java.io.InputStream;
-import java.io.OutputStream;
 import java.util.Map;
 
 import org.apache.avalon.framework.parameters.Parameters;
@@ -46,28 +44,27 @@
  * @author <a href="http://www.apache.org/~sylvain/">Sylvain Wallez</a>
  * @version $Id$
  */
-public class CopySourceAction extends ServiceableAction implements ThreadSafe
-{
-    
+public class CopySourceAction extends ServiceableAction implements ThreadSafe {
+
     private SourceResolver resolver;
 
     public void service(ServiceManager manager) throws ServiceException {
         super.service(manager);
         this.resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
     }
-    
+
     public Map act(Redirector redirector, org.apache.cocoon.environment.SourceResolver oldResolver,
Map objectModel, String source, Parameters par)
         throws Exception {
-        
+
         // Get source and destination Sources
         Source src = resolver.resolveURI(source);
         Source dest = resolver.resolveURI(par.getParameter("dest"));
-        
+
         // Check that dest is writeable
         if (! (dest instanceof ModifiableSource)) {
             throw new IllegalArgumentException("Non-writeable URI : " + dest.getURI());
         }
-        
+
         if (dest instanceof TraversableSource) {
             TraversableSource trDest = (TraversableSource) dest;
             if (trDest.isCollection()) {
@@ -81,19 +78,12 @@
                 }
             }
         }
-        
-        ModifiableSource wdest = (ModifiableSource)dest;
-        
-        // Get streams
-        InputStream is = src.getInputStream();
-        OutputStream os = wdest.getOutputStream();
-        
         // And transfer all content.
         try {
-            SourceUtil.copy(is, os);
+            SourceUtil.copy(src, dest);
         } finally {
-            os.close();
-            is.close();
+            resolver.release(src);
+            resolver.release(dest);
         }
         // Success !
         return EMPTY_MAP;



Mime
View raw message