Java exceptions are handled within IDL through an IDL-Java bridge session object, IDLJavaBridgeSession. This Java object can be queried to determine the status of the bridge, including information on any exceptions. For example, one important Java object available through the session object is the last issued Java exception.
The session object is a proxy to an internal Java object, which is created during the IDL-Java bridge initialization process. You can connect an IDLJavaObject to this object using OBJ_NEW:
oJSession = OBJ_NEW('IDLjavaObject$IDLJAVABRIDGESESSION’)
Note: Only one Java session object needs to be created during an IDL session. Subsequent calls to this object will point to the same internal object.
When an exception occurs, the GetException function method indicates what exception occurred:
oJException = oJSession->GetException()
where oJSession is a reference to the session object and oJException is a proxy object to a java.lang.Throwable object, which is the class used in Java to manage exceptions. The session object also has a ClearException method that clears the session object’s last exception. The GetException method always calls ClearException method.
The IDLJavaBridgeSession object also has the GetVersionObject method, which retrieves the IDLJavaVersion object:
oJVersion = oJSession->GetVersionObject()
where oJSession is a reference to the session object and oJVersion is a proxy object to an IDLJavaVersion object. This object determines version information about the IDL-Java bridge and the underlying Java system.
The IDLJavaVersion object provides the following function methods, which do not require any arguments:
- GetBuildDate() - a java.lang.String object specifying the build date. For example, Apr 1 2003.
- GetJavaVersion() - a java.lang.String object specifying the Java version. For example, 1.3.1_02.
- GetBridgeVersion() - a java.lang.String object specifying the IDL-Java bridge version.
Note: An example of the version object is provided in the bridge_version.pro file, which is in IDL’s resource/bridges/import/java/examples directory. Run the example procedure by entering bridge_version at the IDL command prompt or view the file in an IDL Editor window by entering .EDIT bridge_version.pro.