[
https://issues.apache.org/jira/browse/VFS-241?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Didier Earith updated VFS-241:
------------------------------
Attachment: AbstractFileObject.java
Hi,
I get the same issue.
The java.lang.NullPointerException is raised in the getParent function of the
AbstractFileObject class :
......
synchronized (fs)
{
// Locate the parent of this file
if (parent == null)
{
parent = fs.resolveFile(name.getParent());
}
}
return parent;
}
name.getParent() can return null (if name is the root).
To fix the issue, I have changed the this function to test the result of
name.getParent() call. If null then return null :
....
synchronized (fs)
{
// Locate the parent of this file
if (parent == null)
{
if (name.getParent() == null) {
return null;
}
parent = fs.resolveFile(name.getParent());
}
}
return parent;
}
(see java source file as attachement).
Didier Earith
> Unable to download file if saved in FTP root directory
> ------------------------------------------------------
>
> Key: VFS-241
> URL: https://issues.apache.org/jira/browse/VFS-241
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 2.0
> Environment: WIndows XP, Linux
> Reporter: Michal Ruman
> Attachments: AbstractFileObject.java
>
>
> Problem with file downloading when file is saved in FTP root directory.
> After clicking on download link get exception:
> java.lang.NullPointerException
> at
> org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:272)
> at
> org.apache.commons.vfs.provider.AbstractFileSystem.resolveFile(AbstractFileSystem.java:267)
> at
> org.apache.commons.vfs.provider.AbstractFileObject.getParent(AbstractFileObject.java:512)
> at
> org.apache.commons.vfs.provider.ftp.FtpFileObject.getInfo(FtpFileObject.java:177)
> at
> org.apache.commons.vfs.provider.ftp.FtpFileObject.refresh(FtpFileObject.java:208)
> at
> org.apache.commons.vfs.impl.DecoratedFileObject.refresh(DecoratedFileObject.java:170)
> at
> org.apache.commons.vfs.cache.OnCallRefreshFileObject.getChild(OnCallRefreshFileObject.java:98)
> ...
> Michal Ruman
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.