


Exception handling
When the Java™ APIs encounter a problem, they throw an exception. Throwing an exception creates an exception object of ODException class or one of its subclasses.
When an exception object of ODException class is created, the API saves diagnostic information in to a log file, assuming that logging is enabled.
When a ODException is caught, it helps you to see any
error messages, error codes, and error states that occurred while
running. When an error is caught, an error message is issued along
with the location of where the exception was thrown. The error ID
and exception ID are also given. The following code shows an example
of the throw and catch process:
try
{
odServer = new ODServer(new ODConfig());
odServer.initialize( "TcUpdate.java" );
System.out.println( "Logging on to " + argv[0] + "..." );
odServer.logon( argv[0], argv[1], argv[2] );
odServer.logoff( );
odServer.terminate( );
}
catch ( ODException e )
{
System.out.println( "ODException: " + e );
System.out.println( " id = " + e.getErrorId( ) );
System.out.println( " msg = " + e.getErrorMsg( ) );
e.printStackTrace( );
}