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