1. /*
  2. * Copyright 2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.net.ftp.parser;
  17. /**
  18. * This class encapsulates all errors that may be thrown by
  19. * the process of an FTPFileEntryParserFactory creating and
  20. * instantiating an FTPFileEntryParser.
  21. */
  22. public class ParserInitializationException extends RuntimeException {
  23. /**
  24. * Root exception that caused this to be thrown
  25. */
  26. private final Throwable rootCause;
  27. /**
  28. * Constucts a ParserInitializationException with just a message
  29. *
  30. * @param message Exception message
  31. */
  32. public ParserInitializationException(String message) {
  33. super(message);
  34. this.rootCause = null;
  35. }
  36. /**
  37. * Constucts a ParserInitializationException with a message
  38. * and a root cause.
  39. *
  40. * @param message Exception message
  41. * @param rootCause root cause throwable that caused
  42. * this to be thrown
  43. */
  44. public ParserInitializationException(String message, Throwable rootCause) {
  45. super(message);
  46. this.rootCause = rootCause;
  47. }
  48. /**
  49. * returns the root cause of this exception or null
  50. * if no root cause was specified.
  51. *
  52. * @return the root cause of this exception being thrown
  53. */
  54. public Throwable getRootCause() {
  55. return this.rootCause;
  56. }
  57. }