Package org.ogf.saga.error

Each SAGA API call has an associated list of exceptions it may throw, which are described in this package.

See: Description

Package org.ogf.saga.error Description

Each SAGA API call has an associated list of exceptions it may throw, which are described in this package. These exceptions all extend the SagaException class.

Since Java has excellent exception handling support, the Java language bindings use the Java mechanism instead of the error_handler interface as described in the language-independent SAGA specification. The language-independent SAGA specification specifies that in languages with exception-handling mechanisms, such as Java, C++ and Perl, the language binding may allow exceptions to be thrown. If an exception handling mechanism is included in a language binding, the error_handler must not be included in the same binding.

The SAGA specifications say that in languages bindings where this is appropriate, some API methods return POSIX errno codes for errors. For Java, this is not appropriate. The "usual" Java read and write methods throw an exception when an error occurs. The Java language binding versions of these SAGA API methods throw an SagaIOException when an error occurs. If a specific error code is available, it can be examined through the getPosixErrorCode() method.

The SagaIOException is specific for the Java Language Bindings for SAGA. In the ordering of SAGA exceptions, as discussed in the language-independent SAGA specification, the SagaIOException is considered almost the most specific, inbetween NotImplementedException and IncorrectURLException.

The layout of the result of getMessage() deviates from that as specified in the language-independent SAGA specification. The usual Java convention is followed instead. To obtain a result as required by the language-independent SAGA specification, toString() can be used, again as usual in Java.

The IncorrectType exception as described in the language-independent SAGA specification does not exist in the Java Language Bindings for SAGA, as Java has a ClassCastException for that purpose.

A simple mechanism exists for storing and examining exceptions that may be thrown by adaptors in adaptor-based Saga implementations. In such implementations, the top-level exception (the one highest up in the Saga exception hierarchy) is not always the most informative one, and the implementation is not always capable of selecting the most informative exception. In these cases, the implementation may opt to add the individual exceptions as nested exceptions to the exception thrown.

Copyright © 2016 Open Grid Forum. All rights reserved.