cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernhard Huber <berni_hu...@a1.net>
Subject Re: [FYI] Stefano's Linotype
Date Mon, 28 Apr 2003 23:03:53 GMT
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();

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();
            }
        }
    }

bye bernhard



Mime
View raw message