1. /*
  2. * @(#)SystemException.java 1.52 00/02/02
  3. *
  4. * Copyright 1995-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package org.omg.CORBA;
  11. import org.omg.CORBA.portable.InputStream;
  12. import org.omg.CORBA.portable.OutputStream;
  13. import java.util.*;
  14. /**
  15. * The root class for all CORBA standard exceptions. These exceptions
  16. * may be thrown as a result of any CORBA operation invocation and may
  17. * also be returned by many standard CORBA API methods. The standard
  18. * exceptions contain a minor code, allowing more detailed specification, and a
  19. * completion status. This class is subclassed to
  20. * generate each one of the set of standard ORB exceptions.
  21. * <code>SystemException</code> extends
  22. * <code>java.lang.RuntimeException</code> thus none of the
  23. * <code>SystemException</code> exceptions need to be
  24. * declared in signatures of the Java methods mapped from operations in
  25. * IDL interfaces.
  26. *
  27. * @see <A href="../../../../guide/idl/jidlExceptions.html">documentation on
  28. * Java IDL exceptions</A>
  29. */
  30. public abstract class SystemException extends java.lang.RuntimeException {
  31. /**
  32. * Constructs a <code>SystemException</code> exception with the specified detail
  33. * message, minor code, and completion status.
  34. * A detail message is a String that describes this particular exception.
  35. * @param reason the String containing a detail message
  36. * @param minor the minor code
  37. * @param completed the completion status
  38. */
  39. protected SystemException(String reason, int minor, CompletionStatus completed) {
  40. super(reason);
  41. this.minor = minor;
  42. this.completed = completed;
  43. }
  44. /**
  45. * Converts this exception to a representative string.
  46. */
  47. public String toString() {
  48. String completedString;
  49. String superString = super.toString();
  50. String minorString = " minor code: " + minor;
  51. switch (completed.value()) {
  52. case CompletionStatus._COMPLETED_YES:
  53. completedString = " completed: Yes";
  54. break;
  55. case CompletionStatus._COMPLETED_NO:
  56. completedString = " completed: No";
  57. break;
  58. case CompletionStatus._COMPLETED_MAYBE:
  59. default:
  60. completedString = " completed: Maybe";
  61. break;
  62. }
  63. return superString + minorString + completedString;
  64. }
  65. /**
  66. * The CORBA Exception minor code.
  67. * @serial
  68. */
  69. public int minor;
  70. /**
  71. * The status of the operation that threw this exception.
  72. * @serial
  73. */
  74. public CompletionStatus completed;
  75. }