Review Request for JDK-8003992: File and other classes in java.io do not handle embedded nulls properly
Dan Xu
dan.xu at oracle.com
Mon May 6 20:44:45 UTC 2013
On 05/06/2013 06:59 AM, Florian Weimer wrote:
> On 05/03/2013 01:08 AM, Dan Xu wrote:
>> Hi All,
>>
>> Thanks for all your comments. Based on the previous feedback, I have
>> moved to the other approach, i.e., to fail file operations if the
>> invalid NUL characher is found in a file path. As you know, due to the
>> compatibility issue, we cannot throw an exception immediately in the
>> File constructors. So the failure is delayed and only shown up when any
>> file operation is triggered.
>>
>> As for FileInputStream, FileOutputStream, and RandomAccessFile classes,
>> the FileNotFoundException will be thrown right away since their spec
>> allow this exception happen in the constructors. Thanks for your review!
>>
>> webrev: http://cr.openjdk.java.net/~dxu/8003992/webrev.01/
>
> I like this approach, thanks.
>
> I think the additional parenthesis around the return expression and
> the ternary operator are not part of the usual coding standard.
>
Thank you for your good review. I will fix the format.
As for the possible scenario, NUL appearing at the end of a path, I will
regard it as the same kind of invalidity as other embedded NUL cases
since there are no obvious use cases for that. I will push the fix
today. Thanks!
-Dan
More information about the core-libs-dev
mailing list