There is a piece of code in the MagicFile which concerns me. I don't know
if this part is called, because I have never looked at this code before.

    /**
     * @param path Location of file to be checked
     * @return Type of the file as determined by the magic file
     */
    protected String getMimeType(File file) throws IOException {
        byte[] lithmus = new byte[BUFSIZE];
        //log.debug("path = "+path);
        FileInputStream fir = new FileInputStream(file);
        int res = fir.read(lithmus, 0, BUFSIZE);
        log.debug("read " + res + "  bytes from " + file.getAbsolutePath());
        return getMimeType(lithmus);
    }

IHMO, the FileInputStream has to be closed neatly. Waiting for the Garbage
Collector to do it, is not recommended.

Nico


> MagicFile still s*cks. it eats memory (luckely it gives it back after a
while
> but when the server is bussy this is enough to get OutOfMemory errors




Reply via email to