What are the possible causes of File.getAbsolutePath() returning null?
I'm running into a bug that appears to be caused by File.getAbsolutePath()
returning null
. What conditions could cause this? 开发者_JAVA百科 (The system seeing the exception is running Windows XP.)
The javadoc has a brief description of the path resolution procedure, but doesn't mention any situation that would result in a null
path string being returned.
The obvious I suppose -- When the file is not instantiated or doesn't exist
Tracing through the API classes, the answer should be in Win32FileSystem.resolve(File)
(look in your src.zip
file)
You could always copy/paste the code from this method into your own project and then step through it with the File
that's causing the problem.
精彩评论