8241619: (fs) Files.newByteChannel(path, Set.of(CREATE_NEW, READ)) does not throw a FileAlreadyExistsException when the file exists

Reviewed-by: alanb
This commit is contained in:
Brian Burkhalter 2021-03-23 16:03:59 +00:00
parent e9321cdc41
commit 8fa34e4043
6 changed files with 78 additions and 14 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -451,6 +451,10 @@ public abstract class FileSystemProvider {
* if an unsupported option is specified
* @throws IOException
* if an I/O error occurs
* @throws FileAlreadyExistsException
* If a file of that name already exists and the {@link
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
* <i>(optional specific exception)</i>
* @throws SecurityException
* In the case of the default provider, and a security manager is
* installed, the {@link SecurityManager#checkWrite(String) checkWrite}
@ -507,6 +511,11 @@ public abstract class FileSystemProvider {
* @throws UnsupportedOperationException
* If this provider that does not support creating file channels,
* or an unsupported open option or file attribute is specified
* @throws FileAlreadyExistsException
* If a file of that name already exists and the {@link
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
* and the file is being opened for writing
* <i>(optional specific exception)</i>
* @throws IOException
* If an I/O error occurs
* @throws SecurityException
@ -555,6 +564,11 @@ public abstract class FileSystemProvider {
* If this provider that does not support creating asynchronous file
* channels, or an unsupported open option or file attribute is
* specified
* @throws FileAlreadyExistsException
* If a file of that name already exists and the {@link
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
* and the file is being opened for writing
* <i>(optional specific exception)</i>
* @throws IOException
* If an I/O error occurs
* @throws SecurityException
@ -594,8 +608,9 @@ public abstract class FileSystemProvider {
* if an unsupported open option is specified or the array contains
* attributes that cannot be set atomically when creating the file
* @throws FileAlreadyExistsException
* if a file of that name already exists and the {@link
* If a file of that name already exists and the {@link
* StandardOpenOption#CREATE_NEW CREATE_NEW} option is specified
* and the file is being opened for writing
* <i>(optional specific exception)</i>
* @throws IOException
* if an I/O error occurs