19d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair/*
29d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * Copyright 2008 the original author or authors.
39d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair *
49d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * Licensed under the Apache License, Version 2.0 (the "License");
59d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * you may not use this file except in compliance with the License.
69d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * You may obtain a copy of the License at
79d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair *
89d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair *      http://www.apache.org/licenses/LICENSE-2.0
99d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair *
109d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * Unless required by applicable law or agreed to in writing, software
119d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * distributed under the License is distributed on an "AS IS" BASIS,
129d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * See the License for the specific language governing permissions and
149d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * limitations under the License.
159d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair */
169d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismairpackage org.mockftpserver.fake.filesystem
179d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair
189d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair/**
199d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * Exception thrown when a requested operation is not allowed or possible on a directory
209d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * or file that should already exist. This type of error typically causes a 550 reply
219d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * code from an FTP server. Causes include:
229d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * <ul>
239d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair *   <li>The file/directory does not exist</li>
249d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair *   <li>The existing file/directory does not meet some required condition. e.g., trying to remove a non-empty directory</li>
259d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair *   <li>The specified path is expected to be a file, but actually specifies an existing directory, or vice versa</li>
269d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair * </ul>
279d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair */
289d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismairclass ExistingFileOperationException extends FileSystemException {
299d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair
309d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair     String path
319d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair
329d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair     /**
339d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      * @param path
349d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      */
359d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      ExistingFileOperationException(String path) {
369d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair         super(msg(path))
379d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair         this.path = path
389d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair     }
399d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair
409d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair     /**
419d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      * @param path
429d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      * @param cause
439d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      */
449d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      ExistingFileOperationException(Throwable cause, String path) {
459d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair         super(msg(path), cause)
469d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair         this.path = path
479d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair     }
489d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair
499d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      private static String msg(path) {
509d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair          "Error occurred for [$path]"
519d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair      }
529d9aece7b2c2865253fdd2946a4d11a4f642c5aechrismair}