Merge remote-tracking branch 'origin/jetty-8'

Conflicts:
	jetty-server/src/main/java/org/eclipse/jetty/server/session/HashSessionManager.java
	jetty-server/src/main/java/org/eclipse/jetty/server/session/HashedSession.java
This commit is contained in:
Jan Bartel 2013-05-16 16:06:41 +10:00
commit 67a1b2a18f
2 changed files with 11 additions and 14 deletions

View File

@ -37,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.util.ClassLoadingObjectInputStream; import org.eclipse.jetty.util.ClassLoadingObjectInputStream;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
@ -551,8 +552,7 @@ public class HashSessionManager extends AbstractSessionManager
} }
finally finally
{ {
if (in != null) if (in != null) IO.close(in);
try {in.close();} catch (Exception x) {__log.ignore(x);}
if (error != null) if (error != null)
{ {

View File

@ -150,21 +150,17 @@ public class HashedSession extends AbstractSession
file.createNewFile(); file.createNewFile();
fos = new FileOutputStream(file); fos = new FileOutputStream(file);
save(fos); save(fos);
IO.close(fos);
} }
catch (Exception e) catch (Exception e)
{ {
saveFailed(); saveFailed(); // We won't try again for this session
if (fos != null) if (fos != null) IO.close(fos);
{ if (file != null) file.delete(); // No point keeping the file if we didn't save the whole session
// Must not leave the file open if the saving failed
IO.close(fos);
// No point keeping the file if we didn't save the whole session
file.delete();
throw e; throw e;
} }
} }
} }
}
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ -219,6 +215,7 @@ public class HashedSession extends AbstractSession
fis = new FileInputStream(file); fis = new FileInputStream(file);
_idled = false; _idled = false;
_hashSessionManager.restoreSession(fis, this); _hashSessionManager.restoreSession(fis, this);
IO.close(fis);
didActivate(); didActivate();
@ -229,7 +226,7 @@ public class HashedSession extends AbstractSession
catch (Exception e) catch (Exception e)
{ {
LOG.warn("Problem de-idling session " + super.getId(), e); LOG.warn("Problem de-idling session " + super.getId(), e);
IO.close(fis); if (fis != null) IO.close(fis);//Must ensure closed before invalidate
invalidate(); invalidate();
} }
} }