1bda3441225e0607b5ced8b538123fd7c7a417910chrismair/*
2bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Copyright 2008 the original author or authors.
3bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
4bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Licensed under the Apache License, Version 2.0 (the "License");
5bda3441225e0607b5ced8b538123fd7c7a417910chrismair * you may not use this file except in compliance with the License.
6bda3441225e0607b5ced8b538123fd7c7a417910chrismair * You may obtain a copy of the License at
7bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
8bda3441225e0607b5ced8b538123fd7c7a417910chrismair *      http://www.apache.org/licenses/LICENSE-2.0
9bda3441225e0607b5ced8b538123fd7c7a417910chrismair *
10bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Unless required by applicable law or agreed to in writing, software
11bda3441225e0607b5ced8b538123fd7c7a417910chrismair * distributed under the License is distributed on an "AS IS" BASIS,
12bda3441225e0607b5ced8b538123fd7c7a417910chrismair * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13bda3441225e0607b5ced8b538123fd7c7a417910chrismair * See the License for the specific language governing permissions and
14bda3441225e0607b5ced8b538123fd7c7a417910chrismair * limitations under the License.
15bda3441225e0607b5ced8b538123fd7c7a417910chrismair */
16bda3441225e0607b5ced8b538123fd7c7a417910chrismairpackage org.mockftpserver.fake.filesystem;
17bda3441225e0607b5ced8b538123fd7c7a417910chrismair
18bda3441225e0607b5ced8b538123fd7c7a417910chrismair/**
19bda3441225e0607b5ced8b538123fd7c7a417910chrismair * Exception thrown when a path/filename is not valid. Causes include:
20bda3441225e0607b5ced8b538123fd7c7a417910chrismair * <ul>
21bda3441225e0607b5ced8b538123fd7c7a417910chrismair * <li>The filename contains invalid characters</li>
22bda3441225e0607b5ced8b538123fd7c7a417910chrismair * <li>The path specifies a new filename, but its parent directory does not exist</li>
23bda3441225e0607b5ced8b538123fd7c7a417910chrismair * <li>The path is expected to be a file, but actually specifies an existing directory</li>
24bda3441225e0607b5ced8b538123fd7c7a417910chrismair * </ul>
25bda3441225e0607b5ced8b538123fd7c7a417910chrismair */
26bda3441225e0607b5ced8b538123fd7c7a417910chrismairpublic class InvalidFilenameException extends FileSystemException {
27bda3441225e0607b5ced8b538123fd7c7a417910chrismair
28bda3441225e0607b5ced8b538123fd7c7a417910chrismair    private static final String MESSAGE_KEY = "filesystem.pathIsNotValid";
29bda3441225e0607b5ced8b538123fd7c7a417910chrismair
30bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
31bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * @param path - the path involved in the file system operation that caused the exception
32bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
33bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public InvalidFilenameException(String path) {
34bda3441225e0607b5ced8b538123fd7c7a417910chrismair        super(path, MESSAGE_KEY);
35bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
36bda3441225e0607b5ced8b538123fd7c7a417910chrismair
37bda3441225e0607b5ced8b538123fd7c7a417910chrismair    /**
38bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * @param path  - the path involved in the file system operation that caused the exception
39bda3441225e0607b5ced8b538123fd7c7a417910chrismair     * @param cause - the exception cause, wrapped by this exception
40bda3441225e0607b5ced8b538123fd7c7a417910chrismair     */
41bda3441225e0607b5ced8b538123fd7c7a417910chrismair    public InvalidFilenameException(String path, Throwable cause) {
42bda3441225e0607b5ced8b538123fd7c7a417910chrismair        super(path, MESSAGE_KEY, cause);
43bda3441225e0607b5ced8b538123fd7c7a417910chrismair    }
44bda3441225e0607b5ced8b538123fd7c7a417910chrismair
45bda3441225e0607b5ced8b538123fd7c7a417910chrismair}