1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. package org.apache.tools.ant;
  18. /**
  19. * Used to report exit status of classes which call System.exit().
  20. *
  21. * @see org.apache.tools.ant.util.optional.NoExitSecurityManager
  22. * @see org.apache.tools.ant.types.Permissions
  23. *
  24. */
  25. public class ExitException extends SecurityException {
  26. /** Status code */
  27. private int status;
  28. /**
  29. * Constructs an exit exception.
  30. * @param status the status code returned via System.exit()
  31. */
  32. public ExitException(int status) {
  33. super("ExitException: status " + status);
  34. this.status = status;
  35. }
  36. /**
  37. * Constructs an exit exception.
  38. * @param msg the message to be displayed.
  39. * @param status the status code returned via System.exit()
  40. */
  41. public ExitException(String msg, int status) {
  42. super(msg);
  43. this.status = status;
  44. }
  45. /**
  46. * The status code returned by System.exit()
  47. *
  48. * @return the status code returned by System.exit()
  49. */
  50. public int getStatus() {
  51. return status;
  52. }
  53. }