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