X-Git-Url: https://code.wpia.club/?p=gigi.git;a=blobdiff_plain;f=lib%2Fjetty%2Forg%2Feclipse%2Fjetty%2Fserver%2Fsession%2FHashedSession.java;h=04c02b08cd7eeede4eb0b13d479089d62abd8b90;hp=d36e4277e49aa858e2a1c48ad4de69d5085bbab1;hb=ba4f228fa9f72d50991a2218cfd83987ef5d385e;hpb=875b5e9651498a0cd8e0001c0742ba843e47cad0 diff --git a/lib/jetty/org/eclipse/jetty/server/session/HashedSession.java b/lib/jetty/org/eclipse/jetty/server/session/HashedSession.java index d36e4277..04c02b08 100644 --- a/lib/jetty/org/eclipse/jetty/server/session/HashedSession.java +++ b/lib/jetty/org/eclipse/jetty/server/session/HashedSession.java @@ -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 @@ -145,24 +145,23 @@ public class HashedSession extends MemSession throws Exception { File file = null; - FileOutputStream fos = 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); - IO.close(fos); } 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; } }