mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8298380: Clean up redundant array length checks in JDK code base
Reviewed-by: dholmes, amenkov, serb, vtewari
This commit is contained in:
parent
33d955ad6e
commit
e3c6cf8eaf
8 changed files with 37 additions and 51 deletions
|
@ -411,13 +411,11 @@ public abstract class FileSystemProvider {
|
|||
public InputStream newInputStream(Path path, OpenOption... options)
|
||||
throws IOException
|
||||
{
|
||||
if (options.length > 0) {
|
||||
for (OpenOption opt: options) {
|
||||
// All OpenOption values except for APPEND and WRITE are allowed
|
||||
if (opt == StandardOpenOption.APPEND ||
|
||||
opt == StandardOpenOption.WRITE)
|
||||
throw new UnsupportedOperationException("'" + opt + "' not allowed");
|
||||
}
|
||||
for (OpenOption opt : options) {
|
||||
// All OpenOption values except for APPEND and WRITE are allowed
|
||||
if (opt == StandardOpenOption.APPEND ||
|
||||
opt == StandardOpenOption.WRITE)
|
||||
throw new UnsupportedOperationException("'" + opt + "' not allowed");
|
||||
}
|
||||
ReadableByteChannel rbc = Files.newByteChannel(path, options);
|
||||
if (rbc instanceof FileChannelImpl) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue