]> WPIA git - gigi.git/blobdiff - lib/jetty/org/eclipse/jetty/server/session/HashedSession.java
updating jetty to jetty-9.2.16.v2016040
[gigi.git] / lib / jetty / org / eclipse / jetty / server / session / HashedSession.java
index d36e4277e49aa858e2a1c48ad4de69d5085bbab1..04c02b08cd7eeede4eb0b13d479089d62abd8b90 100644 (file)
@@ -1,6 +1,6 @@
 //
 //  ========================================================================
 //
 //  ========================================================================
-//  Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
+//  Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
 //  ------------------------------------------------------------------------
 //  All rights reserved. This program and the accompanying materials
 //  are made available under the terms of the Eclipse Public License v1.0
@@ -145,24 +145,23 @@ public class HashedSession extends MemSession
     throws Exception
     {   
         File file = null;
     throws Exception
     {   
         File file = null;
-        FileOutputStream fos = null;
         if (!_saveFailed && _hashSessionManager._storeDir != null)
         {
         if (!_saveFailed && _hashSessionManager._storeDir != null)
         {
-            try
+            file = new File(_hashSessionManager._storeDir, super.getId());
+            if (file.exists())
+            {
+                file.delete();
+            }
+
+            try(FileOutputStream fos = new FileOutputStream(file,false))
             {
             {
-                file = new File(_hashSessionManager._storeDir, super.getId());
-                if (file.exists())
-                    file.delete();
-                file.createNewFile();
-                fos = new FileOutputStream(file);
                 save(fos);
                 save(fos);
-                IO.close(fos);
             }
             catch (Exception e)
             {
                 saveFailed(); // We won't try again for this session
             }
             catch (Exception e)
             {
                 saveFailed(); // We won't try again for this session
-                if (fos != null) IO.close(fos);
-                if (file != null) file.delete(); // No point keeping the file if we didn't save the whole session
+                if (file != null) 
+                    file.delete(); // No point keeping the file if we didn't save the whole session
                 throw e;             
             }
         }
                 throw e;             
             }
         }