cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From moslm <...@lastminute.de>
Subject NPE in FileUtils.removeDir(FileUtils.java:126) on shutdown
Date Fri, 16 Apr 2010 13:12:27 GMT

I'm using CXF 2.2.5, running on Java 1.6 and Tomcat 6.18.

When the Tomcat server is stopped, we get always the following
NullPointerException:

INFO: Stopping Coyote HTTP/1.1 on http-8080
Exception in thread "Thread-14" java.lang.NullPointerException
	at org.apache.cxf.helpers.FileUtils.removeDir(FileUtils.java:126)
	at org.apache.cxf.helpers.FileUtils$1.run(FileUtils.java:75)


I did a little debugging:

During the first usage of CXF the FileUtils.getDefaultTempDir() is called.
It resolves the tmp-dir correctly. At the end the 
"private static File defaultTempDir" is set to the right directory.
Then the method schedules the removal of the tmp-dir like this:
             Thread hook = new Thread() {
                @Override
                public void run() {
                    removeDir(defaultTempDir);
                }
            };
            Runtime.getRuntime().addShutdownHook(hook);


So far, so good.  When stopping Tomcat (== stopping the JVM) the hook is
"fired".
The removeDir(defaultTempDir) is called. But "defaultTempDir" is 'null' and
in consequence
the NPE is thrown.

Any idea why the static defaultTempDir is lost when the ShutdownHooks are
fired?  A Bug?

Thanks
Mos


-- 
View this message in context: http://old.nabble.com/NPE-in-FileUtils.removeDir%28FileUtils.java%3A126%29-on-shutdown-tp28266687p28266687.html
Sent from the cxf-user mailing list archive at Nabble.com.


Mime
View raw message