简体   繁体   中英

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? (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.

我认为很明显 - 当文件未实例化或不存在时

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM