avatar

595

Close files when we open them. Could be the cause of many problems.

by mrs, 11 Aug, 2008 07:50 PM
355 595  
4242     try {
4343       FileOutputStream fos = new FileOutputStream(fp);
4444       fos.write(data, 0, length);
45       fos.close();
4546     } catch(IOException ioe) {
4647       ErrorManagement.handleException("Error writing " + fileName, ioe);
4748     }
548 595  
146146     try {
147147       FileOutputStream fos = new FileOutputStream(outFile);
148148       ImageIO.write(createResizedCopy(image, new_x, new_y, true), "jpeg", fos);
149       fos.close();
149150     } catch (FileNotFoundException e) {
150151       ErrorManagement.handleException("Can't write " + outFile + " to create thumbnail.", e);
151152       return false;
579 595  
318318       if(mAuxProps != null) {
319319         mAuxProps.store(fos, "Search display information.  Do not modify while running.");
320320       }
321       fos.close();
321322     } catch(IOException e) {
322323       //  D'oh.  It failed to write the display information...
323324       ErrorManagement.handleException("Failed to write display configuration.", e);