001/*
002 * Copyright (C) 2014 The Guava Authors
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package com.google.common.io;
018
019import com.google.common.annotations.Beta;
020import com.google.common.annotations.GwtIncompatible;
021import com.google.j2objc.annotations.J2ObjCIncompatible;
022import java.nio.file.FileSystemException;
023import java.nio.file.SecureDirectoryStream;
024import org.checkerframework.checker.nullness.qual.Nullable;
025
026/**
027 * Exception indicating that a recursive delete can't be performed because the file system does not
028 * have the support necessary to guarantee that it is not vulnerable to race conditions that would
029 * allow it to delete files and directories outside of the directory being deleted (i.e., {@link
030 * SecureDirectoryStream} is not supported).
031 *
032 * <p>{@link RecursiveDeleteOption#ALLOW_INSECURE} can be used to force the recursive delete method
033 * to proceed anyway.
034 *
035 * @since 21.0
036 * @author Colin Decker
037 */
038@Beta
039@GwtIncompatible
040@J2ObjCIncompatible // java.nio.file
041public final class InsecureRecursiveDeleteException extends FileSystemException {
042
043  public InsecureRecursiveDeleteException(@Nullable String file) {
044    super(file, null, "unable to guarantee security of recursive delete");
045  }
046}