You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Daniel Bengtsson (JIRA)" <ji...@apache.org> on 2012/11/18 21:00:59 UTC

[jira] [Created] (HADOOP-9060) isSymlink returns false for link to non-existing file

Daniel Bengtsson created HADOOP-9060:
----------------------------------------

             Summary: isSymlink returns false for link to non-existing file
                 Key: HADOOP-9060
                 URL: https://issues.apache.org/jira/browse/HADOOP-9060
             Project: Hadoop Common
          Issue Type: Bug
         Environment: Kubuntu 12.10 commons-io 2.4
            Reporter: Daniel Bengtsson


This problem showed when trying to use FileUtils.sizeOfDirectory() of a directory that contained a symlink to a file that did not exist. I got the exception:

java.lang.IllegalArgumentException: /tmp/test/link does not exist
	at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2413)
	at org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2479)
	at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2417)
	at org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2479)
	at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2417)
	at org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2479)
	at org.apache.commons.io.FileUtils.sizeOf(FileUtils.java:2417)
	at org.apache.commons.io.FileUtils.sizeOfDirectory(FileUtils.java:2479)

And /tmp/test/link is here linking to a file that do not exist.

The trace comes from a unit test that looks like:

assertTrue(FileUtils.sizeOfDirectory(new File("/tmp/test/")) > 0);

To me I would expect that either isSymlink() reported true even though the link is to file that do not exist or sizeOfDirectory() should not bail out when encountering non-existing files.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira