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