Project

General

Profile

« Previous | Next » 

Revision 8304

Added by Matt Jones over 10 years ago

Reviewed code for all uses of FileInputStream, checking to see if the method should be closing the stream, and if so, closing it in the method as well as in the finally clause to ensure we don't leak file descriptors.

View differences:

DBQuery.java
60 60
import javax.servlet.ServletOutputStream;
61 61
import javax.servlet.http.HttpServletResponse;
62 62

  
63
import org.apache.commons.io.IOUtils;
63 64
import org.apache.commons.lang.StringEscapeUtils;
64 65
import org.apache.log4j.Logger;
65 66
import org.dataone.service.exceptions.NotImplemented;
......
2326 2327
            while (b != -1) {
2327 2328
                zipOut.write(buf, 0, b);
2328 2329
                b = fin.read(buf);
2329
            }//while
2330
            }
2331
            fin.close();
2330 2332
            zipOut.closeEntry();
2331 2333
        }//try
2332 2334
        catch (IOException ioe) {
2333 2335
            logMetacat.error("DBQuery.addDataFileToZipOutputStream - I/O error: "
2334 2336
                    + ioe.getMessage());
2335
        }//catch
2337
        } finally {
2338
            IOUtils.closeQuietly(fin);
2339
        }
2336 2340
    }//addDataFileToZipOutputStream()
2337 2341

  
2338 2342
    /**

Also available in: Unified diff