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.

ExitException.java 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright 2001-2004 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. * @author Conor MacNeill
  25. * @author <a href="mailto:martijn@kruithof.xs4all.nl">Martijn Kruithof</a>
  26. */
  27. public class ExitException extends SecurityException {
  28. /** Status code */
  29. private int status;
  30. /**
  31. * Constructs an exit exception.
  32. * @param status the status code returned via System.exit()
  33. */
  34. public ExitException(int status) {
  35. super("ExitException: status " + status);
  36. this.status = status;
  37. }
  38. /**
  39. * Constructs an exit exception.
  40. * @param msg the message to be displayed.
  41. * @param status the status code returned via System.exit()
  42. */
  43. public ExitException(String msg, int status) {
  44. super(msg);
  45. this.status = status;
  46. }
  47. /**
  48. * The status code returned by System.exit()
  49. *
  50. * @return the status code returned by System.exit()
  51. */
  52. public int getStatus() {
  53. return status;
  54. }
  55. }