Java Reference
In-Depth Information
To keep the number of JDMException and RuntimeException
subclasses relatively small, yet provide meaningful feedback to
applications and developers, JDM defines standard exception mes-
sages and error codes to support code portability. Vendors can
embed their specific error codes within the JDM exception-related
classes, as well as wrap other Java exceptions, as appropriate.
Figure 8-18 depicts the exceptions defined in the JDM API. Here
you can see JDM defines several specialized checked exceptions and
unchecked exceptions, also known as Runtime exceptions . All
checked exceptions inherit from the generic JDMException to enable
applications to catch either a generic exception or a specialized
exception. Table 8-1 details when these exceptions will be thrown in
the JDM API.
Table 8-1
JDM exceptions
Thrown when the API client fails to connect to the DME. For
example, it is thrown either by the getConnection method of
ConnectionFactory or any method in Connection that is used for
communicating with the DME.
Thrown when the user-supplied URI does not conform to the
vendor-supported format or the dataset specified by the URI is
not accessible.
Thrown when a method receives incompatible attributes. For
example, LogicalAttribute.setCategorySet method throws this
exception when a CategorySet object with string values is speci-
fied for a numerical type attribute.
Thrown when the given object is invalid. This exception
is a common superclass for further specialized exceptions,
such as ObjectExistsException that is thrown by the Connec-
tion.saveObject method when the specified object name already
exists in the DME. The ObjectNotFoundException is thrown
when the specified object does not exist in the DME. The
DuplicateEntryException is thrown when a duplicate entry is
added to an object; for example, a LogicalData object must
have unique names for its attribute. If a user adds a duplicate
named logical attribute, this exception is thrown. The
EntryNotFoundException is thrown by a method invocation
for the entry that does not exist in the object; for example,
LogicalData.getAttribute (attrName) throws this exception when
the specified attributeName does not exist in the LogicalData
Search WWH ::

Custom Search