InvalidDirectoryException.java

  1. /*
  2. Copyright 2011, Aiki IT, FotoRenamer
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at

  6.     http://www.apache.org/licenses/LICENSE-2.0

  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package de.aikiit.fotorenamer.exception;

  14. import org.apache.log4j.Logger;

  15. import java.io.File;

  16. /**
  17.  * Exception that indicates that an error occurred when touching the selected
  18.  * directory.
  19.  *
  20.  * @author hirsch
  21.  * @version 04.03.11
  22.  */
  23. public class InvalidDirectoryException extends Exception {
  24.     /**
  25.      * Logger.
  26.      */
  27.     private static final Logger LOG =
  28.             Logger.getLogger(InvalidDirectoryException.class);

  29.     /**
  30.     * Shows and logs a given error message.
  31.     * @param message the error message.
  32.     */
  33.     public InvalidDirectoryException(String message) {
  34.         super(message);
  35.         LOG.error("invalid directory: " + message);
  36.     }

  37.     /**
  38.      * Provide error messages for one directory.
  39.      *
  40.      * @param directory Current directory.
  41.      */
  42.     public InvalidDirectoryException(final File directory) {
  43.         super(directory.toString());
  44.         LOG.error("invalid directory: " + directory);
  45.     }

  46. }