You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

AntException.java 3.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // -------------------------------------------------------------------------------
  2. // Copyright (c)2000 Apache Software Foundation
  3. // -------------------------------------------------------------------------------
  4. package org.apache.ant;
  5. /**
  6. * Signals a problem while setting up or executing a build.
  7. *
  8. * @author James Duncan Davidson (duncan@apache.org)
  9. */
  10. public class AntException extends Exception {
  11. // -----------------------------------------------------------------
  12. // PRIVATE MEMBERS
  13. // -----------------------------------------------------------------
  14. /**
  15. * The cause of this exception.
  16. */
  17. private Throwable cause;
  18. /**
  19. * Project within which this exception occured, if applicable.
  20. */
  21. private Project project;
  22. /**
  23. * Target within which this exception occurred, if applicable.
  24. */
  25. private Target target;
  26. /**
  27. * Task within which this exception occurred, if applicable.
  28. */
  29. private Task task;
  30. // -----------------------------------------------------------------
  31. // CONSTRUCTORS
  32. // -----------------------------------------------------------------
  33. /**
  34. * Constructs a new AntException with no message.
  35. */
  36. public AntException() {
  37. super();
  38. }
  39. /**
  40. * Constructs a new AntException with the given message.
  41. */
  42. public AntException(String msg) {
  43. super(msg);
  44. }
  45. /**
  46. * Constructs a new AntException with the given message and cause.
  47. */
  48. public AntException(String msg, Throwable cause) {
  49. super(msg);
  50. this.cause = cause;
  51. }
  52. /**
  53. * Constructs a new AntException with the given cause and a
  54. * detailed message of (cause==null ? null : cause.toString())
  55. */
  56. public AntException(Throwable cause) {
  57. super(cause==null ? null : cause.toString());
  58. this.cause = cause;
  59. }
  60. // -----------------------------------------------------------------
  61. // PUBLIC METHODS
  62. // -----------------------------------------------------------------
  63. /**
  64. * Returns the cause of this exception.
  65. */
  66. public Throwable getCause() {
  67. return cause;
  68. }
  69. /**
  70. * Returns the Project within the scope of which this exception occurred,
  71. * if applicable. Otherwise null.
  72. */
  73. public Project getProject() {
  74. return project;
  75. }
  76. /**
  77. * Returns the Target within the scope of which this exception occurred,
  78. * if applicable. Otherwise null.
  79. */
  80. public Target getTarget() {
  81. return target;
  82. }
  83. /**
  84. * Returns the Task wihtin the scope of which this exception occurred,
  85. * if applicable. Otherwise null.
  86. */
  87. public Task getTask() {
  88. return task;
  89. }
  90. // -----------------------------------------------------------------
  91. // PACKAGE METHODS
  92. // -----------------------------------------------------------------
  93. /**
  94. * Sets the project within the scope of which this exception occurred.
  95. * This method is called by the internal error handling mechanism of
  96. * Ant before it is propogated out.
  97. */
  98. void setProject(Project project) {
  99. this.project = project;
  100. }
  101. /**
  102. * Sets the target within the scope of which this exception occurred.
  103. * This method is called by the internal error handling mechansim of
  104. * Ant before it is propogated out.
  105. */
  106. void setTarget(Target target) {
  107. this.target = target;
  108. }
  109. /**
  110. * Sets the task within the scope of which this exception occurred.
  111. * This method is called by the internal error handling mechanism of
  112. * Ant before it is propogated out.
  113. */
  114. void setTask(Task task) {
  115. this.task = task;
  116. }
  117. }