hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rodrigo Schmidt (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-6796) FileStatus allows null srcPath but crashes if that's done
Date Wed, 02 Jun 2010 02:13:38 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-6796?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12874382#action_12874382

Rodrigo Schmidt commented on HADOOP-6796:

Wow! I didn't know this would create so much discussion. I thought it was such a simple code
cleanup and unit tests. :-)

@Eli: Unfortunately we can't get rid of the default constructor because FileStatus is a Writable().
So, I think your proposal boils down to just leaving it the way it is.

I don't like it because it leaves room for people to use the default constructor or a null
srcPath for some corner case conditions and crash unexpectedly down the road with an NPE.

So, my opinion is that any valid Path is better than null as a default value, and "/" seems

The options are the following:

1) Leave it the way it is
2) Use Path("/") if the srcPath is null (current patch)
3) Start accepting a null srcPath and change the methods that currently crash because of it

My patch does (2) because I didn't think it was worth implementing (3). However, I definitely
prefer (3) to (1), so I could definitely implement it.

What do the others think?

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

View raw message