Perez Carmona, David wrote:

After having investigated a bit, I discovered that the guilty for leaving the file 
opened is a CopySourceAction invokation, that tries to get the result of the previous 
pipeline, through the cocoon:// protocol.

The following code from org.apache.cocoon.acting.CopySourceAction leaves the stream 
opened:

public void service(ServiceManager manager) throws ServiceException {
super.service(manager);
this.resolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
}
public Map act(Redirector redirector, SourceResolver oldResolver, Map objectModel, String source, Parameters par)
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());
}


ModifiableSource wdest = (ModifiableSource)dest;


// Get streams
InputStream is = src.getInputStream(); <----Here the file is opened forever
OutputStream os = wdest.getOutputStream();


       // 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);
           }
       } finally {
           is.close();          <------This does nothing, because the stream is a 
ByteArrayStream
       }
       // Success !
       return EMPTY_MAP;


Is this solved in later versions of Cocoon?



I don't actually know. But if you've narrowed it down to a particular class, have a look using http://cvs.apache.org/viewcvs.cgi/cocoon-2.1 to see if the code has changed. If not, you can always provide a patch.

Regards, Upayavira





-----Mensaje original----- De: Perez Carmona, David

Enviado el: jueves, 03 de junio de 2004 12:41
Para: Cocoon (E-mail)
Asunto: File remains open


Hi all,

I have the following pipeline:

<map:match pattern="genera/**.sxw">
        <map:generate src="jar:file:///{realpath:docu}/{1}.sxw!/content.xml"/>
        <map:transform label="t1" src="transf/open-office-a-docbook.xsl"/>
        <map:serialize type="xml"/>
</map:match>

I have an exception inside the transformer.
The result is that the source document remains open (the *.sxw), and I can not replace it with 3rd party utilities.
I'm using Cocoon 2.0.3. Is this solved in newer Cocoon releases? Any workaround?



Thanks in advance for any help.

David

*************************************************************
Este correo ha sido procesado por el antivirus del Grupo FCC.
*************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]







--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to