Bug 32130

Summary: NullPointerException in FileStore (sessions)
Product: Tomcat 5 Reporter: Ronald Klop <ronald-lists>
Component: Catalina:ModulesAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal Keywords: ErrorMessage
Priority: P3    
Version: 5.0.28   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Ronald Klop 2004-11-09 20:35:27 UTC
I get a stacktrace now and then.
See below.

9-nov-2004 21:28:15 org.apache.catalina.core.StandardContext backgroundProcess
WARNING: Unable to perform background process on manager
java.lang.NullPointerException
        at org.apache.catalina.session.FileStore.keys(FileStore.java:217)
        at org.apache.catalina.session.StoreBase.processExpires(StoreBase.java:
207)
        at org.apache.catalina.session.PersistentManagerBase.
backgroundProcess(PersistentManagerBase.java:227)
        at org.apache.catalina.core.StandardContext.
backgroundProcess(StandardContext.java:4647)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.
processChildren(ContainerBase.java:1619)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.
processChildren(ContainerBase.java:1628)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.
processChildren(ContainerBase.java:1628)
        at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.
run(ContainerBase.java:1608)
        at java.lang.Thread.run(Thread.java:534)
Comment 1 Ronald Klop 2004-11-09 20:44:08 UTC
I think the problem was, that I emptied my tomcat\work directory.
The method FileStore.directory() does not check if the directory still exists 
when returning a (cached) File object to it.
Comment 2 Yoav Shapira 2004-11-17 15:45:28 UTC
If you delete a directory that Tomcat created, you're responsible for re-
creating it.  If we add a check for this we'd have to do the same for every 
directory.  Change your script or actions to remove work/*, not work itself.

The keys method already checks for a null directory.  I added a check for a 
null or empty file list in that directory.  That should cover us.

(Done for 5.0.30)
Comment 3 Yoav Shapira 2004-11-17 16:00:51 UTC
Done for 5.5.5 as well.  Thanks for bringing this to our attention.