001package co.codewizards.cloudstore.core.repo.local; 002 003import co.codewizards.cloudstore.core.oio.File; 004 005 006/** 007 * Thrown if a {@link LocalRepoManager} could not be created for a given {@link File}, because the file 008 * is not a {@link File#isDirectory() directory}. 009 * <p> 010 * Note, that the path exists in the file system, though. If it does not exist, a {@link FileNotFoundException} 011 * is thrown instead. 012 * @author Marco หงุ่ยตระกูล-Schulze - marco at codewizards dot co 013 */ 014public class FileNoDirectoryException extends LocalRepoManagerException { 015 private static final long serialVersionUID = 1L; 016 017 private final File file; 018 019 public FileNoDirectoryException(final File file) { 020 super(createMessage(file)); 021 this.file = file; 022 } 023 024 public FileNoDirectoryException(final File file, final Throwable cause) { 025 super(createMessage(file), cause); 026 this.file = file; 027 } 028 029 public File getFile() { 030 return file; 031 } 032 033 private static String createMessage(final File file) { 034 return String.format("File exists, but is not a directory: %s", file == null ? null : file.getAbsolutePath()); 035 } 036}