Review request for #7087549 (Alan Bateman)
Chris Zhang
belliedmonkey at gmail.com
Mon Dec 12 17:32:10 PST 2011
-----ÓʼþÔ¼þ-----
·¢¼þÈË: nio-dev-bounces at openjdk.java.net
[mailto:nio-dev-bounces at openjdk.java.net] ´ú±í nio-dev-request at openjdk.java.
net
·¢ËÍʱ¼ä: 2011Äê12ÔÂ13ÈÕ 4:00
ÊÕ¼þÈË: nio-dev at openjdk.java.net
Ö÷Ìâ: nio-dev Digest, Vol 45, Issue 7
Send nio-dev mailing list submissions to
nio-dev at openjdk.java.net
To subscribe or unsubscribe via the World Wide Web, visit
http://mail.openjdk.java.net/mailman/listinfo/nio-dev
or, via email, send a message with subject or body 'help' to
nio-dev-request at openjdk.java.net
You can reach the person managing the list at
nio-dev-owner at openjdk.java.net
When replying, please edit your Subject line so it is more specific
than "Re: Contents of nio-dev digest..."
Today's Topics:
1. Re: Review request for #7087549 (Alan Bateman)
----------------------------------------------------------------------
Message: 1
Date: Mon, 12 Dec 2011 10:14:11 +0000
From: Alan Bateman <Alan.Bateman at oracle.com>
Subject: Re: Review request for #7087549
To: Brandon Passanisi <brandon.passanisi at oracle.com>
Cc: nio-dev at openjdk.java.net
Message-ID: <4EE5D3F3.7030504 at oracle.com>
Content-Type: text/plain; charset="utf-8"
On 09/12/2011 20:59, Brandon Passanisi wrote:
> Hi Alan. I believe I understand the intention now. Are you
> suggesting the following:
>
> 1. Change the last line of newInputStream (line 384 in the webrev
> version of FileSystemProvider.java) so that the options parameter
> is passed into the Files.newByteChannel() call, i.e.: return
> Channels.newInputStream(Files.newByteChannel(path, options));
> 2. Since the null check is done by newByteChannel, remove the
> Objects.requireNonNull call.
>
> If this is correct, I can create an updated webrev for review.
Exactly! The bug is only an issue for providers that support additional
open options but don't override newInputStream. With the above changes
then the opens are passed through to newByteChannel so the provider can
handle them. With that clear then I think the test should be focused on
exercising newInputStream with custom options, something like the following:
static enum CustomOptions implements OpenOption {
IGNORE,
}
static class MyProvider extends
PassThroughFileSystem.PassThroughProvider {
public MyProvider() {
}
public InputStream newInputStream(Path path, OpenOption... options)
throws IOException
{
if (options.length != 1)
throw new RuntimeException("One option expected");
if (options[0] != CustomOptions.IGNORE)
throw new RuntimeException(options[0] + " not expected");
return super.newInputStream(path);
}
}
public static void main(String[] args) throws Exception {
FileSystemProvider provider = new MyProvider();
Map<String,?> env = Collections.emptyMap();
URI uri = URI.create("pass:///");
FileSystem fs = provider.newFileSystem(uri, env);
:
InputStream in = Files.newInputStream(path, CustomOptions.IGNORE);
}
PassThroughFileSystem is in test/java/nio/file/Files and is used by
tests that need to use a custom file system.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20111212/4f20601b
/attachment-0001.html
End of nio-dev Digest, Vol 45, Issue 7
**************************************
More information about the nio-dev
mailing list