1. /*
  2. * @(#)FactoryConfigurationError.java 1.7 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.xml.parsers;
  8. /**
  9. * Thrown when a problem with configuration with the Parser Factories
  10. * exists. This error will typically be thrown when the class of a
  11. * parser factory specified in the system properties cannot be found
  12. * or instantiated.
  13. *
  14. * @since JAXP 1.0
  15. * @version 1.0
  16. */
  17. public class FactoryConfigurationError extends Error {
  18. private Exception exception;
  19. /**
  20. * Create a new <code>FactoryConfigurationError</code> with no
  21. * detail mesage.
  22. */
  23. public FactoryConfigurationError() {
  24. super();
  25. this.exception = null;
  26. }
  27. /**
  28. * Create a new <code>FactoryConfigurationError</code> with
  29. * the <code>String </code> specified as an error message.
  30. *
  31. * @param msg The error message for the exception.
  32. */
  33. public FactoryConfigurationError(String msg) {
  34. super(msg);
  35. this.exception = null;
  36. }
  37. /**
  38. * Create a new <code>FactoryConfigurationError</code> with a
  39. * given <code>Exception</code> base cause of the error.
  40. *
  41. * @param e The exception to be encapsulated in a
  42. * FactoryConfigurationError.
  43. */
  44. public FactoryConfigurationError(Exception e) {
  45. super(e.toString());
  46. this.exception = e;
  47. }
  48. /**
  49. * Create a new <code>FactoryConfigurationError</code> with the
  50. * given <code>Exception</code> base cause and detail message.
  51. *
  52. * @param e The exception to be encapsulated in a
  53. * FactoryConfigurationError
  54. * @param msg The detail message.
  55. * @param e The exception to be wrapped in a FactoryConfigurationError
  56. */
  57. public FactoryConfigurationError(Exception e, String msg) {
  58. super(msg);
  59. this.exception = e;
  60. }
  61. /**
  62. * Return the message (if any) for this error . If there is no
  63. * message for the exception and there is an encapsulated
  64. * exception then the message of that exception, if it exists will be
  65. * returned. Else the name of the encapsulated exception will be
  66. * returned.
  67. *
  68. * @return The error message.
  69. */
  70. public String getMessage () {
  71. String message = super.getMessage ();
  72. if (message == null && exception != null) {
  73. return exception.getMessage();
  74. }
  75. return message;
  76. }
  77. /**
  78. * Return the actual exception (if any) that caused this exception to
  79. * be raised.
  80. *
  81. * @return The encapsulated exception, or null if there is none.
  82. */
  83. public Exception getException () {
  84. return exception;
  85. }
  86. }