1. /*
  2. * @(#)TransformerFactoryConfigurationError.java 1.9 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.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. private Exception exception;
  16. /**
  17. * Create a new <code>TransformerFactoryConfigurationError</code> with no
  18. * detail mesage.
  19. */
  20. public TransformerFactoryConfigurationError() {
  21. super();
  22. this.exception = null;
  23. }
  24. /**
  25. * Create a new <code>TransformerFactoryConfigurationError</code> with
  26. * the <code>String</code> specified as an error message.
  27. *
  28. * @param msg The error message for the exception.
  29. */
  30. public TransformerFactoryConfigurationError(String msg) {
  31. super(msg);
  32. this.exception = null;
  33. }
  34. /**
  35. * Create a new <code>TransformerFactoryConfigurationError</code> with a
  36. * given <code>Exception</code> base cause of the error.
  37. *
  38. * @param e The exception to be encapsulated in a
  39. * TransformerFactoryConfigurationError.
  40. */
  41. public TransformerFactoryConfigurationError(Exception e) {
  42. super(e.toString());
  43. this.exception = e;
  44. }
  45. /**
  46. * Create a new <code>TransformerFactoryConfigurationError</code> with the
  47. * given <code>Exception</code> base cause and detail message.
  48. *
  49. * @param e The exception to be encapsulated in a
  50. * TransformerFactoryConfigurationError
  51. * @param msg The detail message.
  52. * @param e The exception to be wrapped in a TransformerFactoryConfigurationError
  53. */
  54. public TransformerFactoryConfigurationError(Exception e, String msg) {
  55. super(msg);
  56. this.exception = e;
  57. }
  58. /**
  59. * Return the message (if any) for this error . If there is no
  60. * message for the exception and there is an encapsulated
  61. * exception then the message of that exception will be returned.
  62. *
  63. * @return The error message.
  64. */
  65. public String getMessage() {
  66. String message = super.getMessage();
  67. if ((message == null) && (exception != null)) {
  68. return exception.getMessage();
  69. }
  70. return message;
  71. }
  72. /**
  73. * Return the actual exception (if any) that caused this exception to
  74. * be raised.
  75. *
  76. * @return The encapsulated exception, or null if there is none.
  77. */
  78. public Exception getException() {
  79. return exception;
  80. }
  81. }