IDL Constructed Types   «Prev 

Exception Example Weather Service

// Exception example - Weather Service
module Module4{

IDL Exception NoReportForCity is mapped to a corresponding Java class

2) The user defined exception is mapped to a subclass of org.omg.CORBA.UserException

package Module4;
public final class NoReportForCity extends org.omg.CORBA.UserException{ String closestKnownCity;
  public NoReportForCity(){}
  public NoReportForCity(java.lang.String closestKnownCity){
    this.closestKnownCity = closestKnownCity;
The member closestKnownCity is mapped to a corresponding public field and an argument to the full constructor.