Skip navigation links

Oracle® OLAP Java API Reference
11g Release 2 (11.2)


Interface HasLocalizedMessage

All Known Implementing Classes:
ActiveSubtransactionsException, BatchedException, BuildWarningsException, CommitException, CommitWarningsException, CursorLockException, DataProviderMismatchException, DeploymentException, DuplicateMetadataIDException, ErrorDescription, ErrorStack, ExpressServerException, IncorrectDataValueException, IncrementalChangeException, InvalidMetadataException, MetadataFactoryException, MetadataModificationException, MetadataRenameNotSupportedException, MetadataUpdateNotSupportedException, NotCommittableException, NotPreparedException, ObjectClosedException, OLAPIException, OLAPIIllegalStateException, OLAPIRuntimeException, ServerVersionException, SyntaxException, TaskInterruptedException, TransactionalObjectInvalidException, TransactionInactiveException, TransactionTypeUnavailableException, UnexpectedException, UnmatchedInputsException, UnsupportedOperationException, WriteLockException

public 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.

To find out if an Exception implements this interface, use the instanceof operator.

The following code illustrates the use of the getLocalizedMessage method. The example creates a Locale object, and then tries to create an MdmValueHierarchy. The mdmDim object is an MdmPrimaryDimension that has mdmLevelHier as one of its MdmLevelHierarchy components. If mdmLevelHier is mapped to a solved level hierarchy, then the operation succeeds. If it is mapped to an unsolved level hierarchy, then the createValueHierarchy method throws a MetadataFactoryException.

  // Specify a Locale.
 Locale myLocale = new Locale("fr", "CA");
   MdmValueHierarchy mdmValHier = mdmDim.createValueHierarchy("ValueHier",
 catch (Exception e)
   String msg = null;
   if (e instanceof HasLocalizedMessage) 
      // Get the localized message.
      msg = ((HasLocalizedMessage) e).getLocalizedMessage(myLocale);
     // Use the default Locale.
     msg = e.getLocalizedMessage(); 
   // Handle the exception.

You can also use the toString method, instead of the getLocalizedMessage method, to get the message from an Exception in the language of the default Locale for the Java Virtual Machine in which the OLAP API application is running, as in the following.


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


Method Detail


java.lang.String getLocalizedMessage(java.util.Locale locale)
Gets a message in the language of the specified Locale.
locale - A Locale object, which indicates the language in which the message should be rendered.
A String that contains the message for this Exception. The message is in the language of the specified Locale.

Skip navigation links

Copyright © 2002, 2010, Oracle. All rights reserved.