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