OOPortal OOPortal


IDL Constructed Types   «Prev 

Exception Example Weather Service

IDL Exception NoReportForCity is mapped to a corresponding Java class
//exception.idl
// Exception example - Weather Service
module Module4{

IDL Exception NoReportForCity is mapped to a corresponding Java class

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

The member closestKnownCity is mapped to a corresponding public field and an argument to the full constructor.
package Module4;
public final class NoReportForCity extends org.omg.CORBA.UserException{
  public.java.lang 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.