You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Jon Stevens <jo...@latchkey.com> on 2001/06/22 20:59:20 UTC
[t4 patch] delete the damn file. :-)
Untested...
If there is an exception thrown during the processing, the file won't get
deleted because it isn't in a try/finally statement...
-jon
cvs diff StandardManager.java
Index: StandardManager.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/se
ssion/StandardManager.java,v
retrieving revision 1.10
diff -r1.10 StandardManager.java
353a354,355
> try {
>
445,447c447,451
< // Delete the persistent storage file
< file.delete();
<
---
> } finally {
> // Delete the persistent storage file
> if (file != null && file.exists() )
> file.delete();
> }
Re: [t4 patch] delete the damn file. :-)
Posted by Remy Maucherat <re...@betaversion.org>.
Quoting Jon Stevens <jo...@latchkey.com>:
> Untested...
>
> If there is an exception thrown during the processing, the file won't
> get
> deleted because it isn't in a try/finally statement...
That looks like a good idea (more robust).
I would add the finally block to the second try (the one in the sync(sessions)
block) (apparently, if the first one is failing, it's only because no file
exists).
Remy
> cvs diff StandardManager.java
> Index: StandardManager.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/se
> ssion/StandardManager.java,v
> retrieving revision 1.10
> diff -r1.10 StandardManager.java
> 353a354,355
> > try {
> >
> 445,447c447,451
> < // Delete the persistent storage file
> < file.delete();
> <
> ---
> > } finally {
> > // Delete the persistent storage file
> > if (file != null && file.exists() )
> > file.delete();
> > }
>