View Javadoc
1   /*
2    * Copyright (C) 2014 The Guava Authors
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package com.google.common.io;
18  
19  import com.google.common.annotations.Beta;
20  import com.google.common.annotations.GwtIncompatible;
21  import com.google.j2objc.annotations.J2ObjCIncompatible;
22  import java.nio.file.FileSystemException;
23  import java.nio.file.SecureDirectoryStream;
24  import javax.annotation.Nullable;
25  
26  /**
27   * Exception indicating that a recursive delete can't be performed because the file system does not
28   * have the support necessary to guarantee that it is not vulnerable to race conditions that would
29   * allow it to delete files and directories outside of the directory being deleted (i.e.,
30   * {@link SecureDirectoryStream} is not supported).
31   *
32   * <p>{@link RecursiveDeleteOption#ALLOW_INSECURE} can be used to force the recursive delete method
33   * to proceed anyway.
34   *
35   * @since 21.0
36   * @author Colin Decker
37   */
38  @Beta
39  @GwtIncompatible
40  @J2ObjCIncompatible // java.nio.file
41  public final class InsecureRecursiveDeleteException extends FileSystemException {
42  
43    public InsecureRecursiveDeleteException(@Nullable String file) {
44      super(file, null, "unable to guarantee security of recursive delete");
45    }
46  }