Review Request for JDK-8003992: File and other classes in java.io do not handle embedded nulls properly
Martin Buchholz
martinrb at google.com
Wed Feb 27 02:18:14 UTC 2013
Filenames are a lot like environment variables, and we already have code
that rejects NUL chars in environment variable names:
// Check that name is suitable for insertion into Environment map
private static void validateVariable(String name) {
if (name.indexOf('=') != -1 ||
name.indexOf('\u0000') != -1)
throw new IllegalArgumentException
("Invalid environment variable name: \"" + name + "\"");
}
On Tue, Feb 26, 2013 at 4:33 PM, Mike Duigou <mike.duigou at oracle.com> wrote:
> Hi Dan;
>
> External link to the bug (will hopefully work soon):
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8003992
>
> I would like to better understand why silently removing the garbage null
> characters is the right answer here.
>
> If null is an invalid character for the underlying operating system or
> filesystem then perhaps an error should be signalled.
>
> Mike
>
> On Feb 26 2013, at 16:10 , Dan Xu wrote:
>
> > Hi All,
> >
> > Please help review the fix for JDK-8003992: File and other classes in
> java.io do not handle embedded nulls properly.
> >
> > Java IO, not like NIO, does not check NUL character in the given file
> path name, which brings confusion to Java users. This fix is going to
> address this issue by removing any NUL character from the given file path.
> And it also cleans and optimizes the path-name normalization logic. Thanks!
> >
> > Bug: https://jbs.oracle.com/bugs/browse/JDK-8003992
> > webrev: http://cr.openjdk.java.net/~dxu/8003992/webrev.00/
> >
> > -Dan
>
>
More information about the core-libs-dev
mailing list