Author: j16sdiz
Date: 2008-08-22 08:56:29 +0000 (Fri, 22 Aug 2008)
New Revision: 22090

Modified:
   trunk/freenet/src/freenet/node/UptimeEstimator.java
Log:
close dis/dos too, this flush the stream before close

Modified: trunk/freenet/src/freenet/node/UptimeEstimator.java
===================================================================
--- trunk/freenet/src/freenet/node/UptimeEstimator.java 2008-08-22 08:56:08 UTC 
(rev 22089)
+++ trunk/freenet/src/freenet/node/UptimeEstimator.java 2008-08-22 08:56:29 UTC 
(rev 22090)
@@ -11,11 +11,11 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.text.DecimalFormat;

 import freenet.support.Fields;
 import freenet.support.Logger;
 import freenet.support.io.Closer;
-import java.text.DecimalFormat;

 /**
  * A class to estimate the node's average uptime. Every 5 minutes (with a 
fixed offset), we write
@@ -88,6 +88,8 @@
                                }
                        } catch (EOFException e) {
                                // Finished
+                       } finally {
+                               Closer.close(dis);
                        }
                } catch (IOException e) {
                        Logger.error(this, "Unable to read old uptime file: 
"+file+" - we will assume we weren't online during that period");
@@ -119,6 +121,7 @@
                } catch (IOException e) {
                        Logger.error(this, "Unable to write to uptime estimator 
log file: "+logFile);
                } finally {
+                       Closer.close(dos);
                        Closer.close(fos);
                        // Schedule next time
                        schedule(now);


Reply via email to