[ https://issues.apache.org/jira/browse/HADOOP-6796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12874228#action_12874228 ]
Rodrigo Schmidt commented on HADOOP-6796: ----------------------------------------- @Dmytro: srcPath is currently defined as a Path object and I don't want to change that. Calling 'new Path("")', crashes because "" is not a valid path. That's why I defaulted it to "/" @Scott: No checks for getPath() == null afaik, on the other hand, if srcPath is null, all the method calls I mentioned will crash. @Eli: You create a FileStatus with a null srcPath if you do 'stat = new FileStatus();'. This patch actually changes srcPath to Path("/") whenever it's null, which is exactly the behavior you proposed, but without triggering the exception when someone does that. I don't think passing null should be prevented, since we don't do that for other parameters like "owner" or "group". In such cases we default the value to empty strings. The equivalent for srcPath should be Path("/") IMO. > FileStatus allows null srcPath but crashes if that's done > --------------------------------------------------------- > > Key: HADOOP-6796 > URL: https://issues.apache.org/jira/browse/HADOOP-6796 > Project: Hadoop Common > Issue Type: Bug > Components: fs > Affects Versions: 0.22.0 > Reporter: Rodrigo Schmidt > Assignee: Rodrigo Schmidt > Priority: Minor > Fix For: 0.22.0 > > Attachments: HADOOP-6796.patch > > > FileStatus allows constructor invocation with a null srcPath but many methods > like write, readFields, compareTo, equals, and hashCode depend on this > property. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.