Oracle OLAP Java API Reference
10g Release 1 (10.1)

B10994-01

oracle.olapi
Interface HasLocalizedMessage

All Known Implementing Classes:
ErrorStack, ErrorDescription, InvalidMetadataException, MetadataFactoryException, PrepareLockException

public abstract interface HasLocalizedMessage

An interface for an Exception that can provide its message in a language that is appropriate to a specified Locale. This interface is implemented by Exception classes that are generated by the OLAP API client software, not by those generated by the server-side software.

In order to find out if a given Exception implements this interface, use the instanceof operator.

The following code illustrates the use of the getLocalizedMessage method.

Locale mylocale = … // determine Locale to specify
 try
 {
 // some code
 }
 catch ( Exception e )
 {
   String msg = null;
   if ( e instanceof HasLocalizedMessage ) {
      // get localized message
      msg = ((HasLocalizedMessage) e).getLocalizedMessage(mylocale);
   }
   else {
     // use the Locale for the connection
     msg = e.getLocalizedMessage(); // note missing locale parameter
   }
   // handle message
 }

Note that you do not have to use the getLocalizedMessage method in order to obtain a message for an Exception. The following code displays a message in the language of the default Locale for the Java Virtual Machine in which the OLAP API application is running.

System.err.println(e.toString());


Method Summary
 java.lang.String getLocalizedMessage(java.util.Locale locale)
          Gets a message in the language of the specified Locale.

 

Method Detail

getLocalizedMessage

public java.lang.String getLocalizedMessage(java.util.Locale locale)
Gets a message in the language of the specified Locale. See the description of this interface for further information.
Parameters:
locale - A Locale object, which indicates the language in which the message should be rendered.
Returns:
A String that contains the message for this Exception. The message is in the language of the specified Locale.

Oracle OLAP Java API Reference
10g Release 1 (10.1)

B10994-01

Copyright © 2002, 2003, Oracle. All Rights Reserved.