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