cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: [FYI] Stefano's Linotype
Date Tue, 29 Apr 2003 03:15:28 GMT
on 4/28/03 6:03 PM Bernhard Huber wrote:

> hi,
> as i'm using w2k it complains about sharing violation of document.xml 
> after editing it.
> found in flow.js:
> ....
>                                 var output = new 
> java.io.FileOutputStream(document + "/document.xml");
>                                 process( "linotype/" +"action/save-" + 
> type,{},output);
> ....
> and i was missing some output.close(); statement, and changed it to:
>                                 var output = new 
> java.io.FileOutputStream(document + "/document.xml");
>                                 process( "linotype/" +"action/save-" + 
> type,{},output);
>                                 output.close();

uh, that's right. fixed.

> Moreover in Repository.java the method save(Part part, File file) does 
> not close its stream, too; but asfasik
> it is never used, thus the missing close() is not harmfule,yet anyway 
> the correct method:
>     public static void save(Part part, File file) throws Exception {
>         log("[save] " + part.getFileName() + " -> " + file);
>         InputStream in = null;
>         FileOutputStream out = null;
>         try {
>             in = part.getInputStream();
>             out = new FileOutputStream(file);
> 
>             copy(in, out);
>         } finally {
>             if (out != null) {
>                 out.close();
>             }
>             if (in != null) {
>                 in.close();
>             }
>         }
>     }

This is used in the image upload code that is not yet ported to
linotype. I'm working on it.

-- 
Stefano.



Mime
View raw message