IDL Constructed Types   «Prev 

Exception Example Weather Service

1) IDL Exception NoReportForCity is mapped to a corresponding Java class
1)
 //exception.idl
// 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
2) The user defined exception is mapped to a subclass of org.omg.CORBA.UserException

3) The member closestKnownCity is mapped to a corresponding public field and an argument to the full constructor.
3)
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.