O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

More About IDL

So far, you've seen how to declare methods and attributes in IDL. You can also declare exceptions, structures, and alternate data types.

Exceptions

You declare an IDL exception using the following form:

exception exceptionName
{
   member declarations
}

As you can see, an exception can have member variables. When you declare member variables for an exception, the IDL-to-Java compiler generates two constructors for the exception, one that takes no parameters and one that takes values for each member variable in the same order that you declared them in the IDL file.

Listing 17.4 shows an example exception declaration.

Code Listing 17.4. Example Exception Declaration
 exception InvalidDataException { string reason; long errorCode; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required