cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Perez Carmona, David" <DPerez...@fcc.es>
Subject RV: File remains open
Date Thu, 03 Jun 2004 15:09:13 GMT

Confirmed it happens also in latest Cocoon 2.1.5.
Posted bug 29365 in Bugzilla.

-----Mensaje original-----
De: Perez Carmona, David
Enviado el: jueves, 03 de junio de 2004 15:08
Para: Cocoon (E-mail)
Asunto: RV: File remains open


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?


-----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: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message