2 Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; version 2 of the License.
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 package com.mysql.clusterj;
21 * ClusterJException is the base for all ClusterJ exceptions.
22 * Applications can catch ClusterJException to be notified of
23 * all ClusterJ reported issues.
25 * Exceptions are in three general categories: User exceptions,
26 * Datastore exceptions, and Internal exceptions.
27 * <ul><li>User exceptions are caused by user error, for example
28 * providing a connect string that refers to an unavailable
30 * <ul><li>If a user exception is detected during bootstrapping
31 * (acquiring a SessionFactory), it is thrown as a fatal exception.
32 * {@link ClusterJFatalUserException}
33 * </li><li>If an exception is detected during initialization of a
34 * persistent interface, for example annotating a column that
35 * doesn't exist in the mapped table, it is reported as a user
36 * exception. {@link ClusterJUserException}
38 * </li><li>Datastore exceptions report conditions that result
39 * from datastore operations after bootstrapping. For example,
40 * duplicate keys on insert, or record does not exist on delete.
41 * {@link ClusterJDatastoreException}
42 * </li><li>Internal exceptions report conditions that are caused
43 * by errors in implementation. These exceptions should be reported
44 * as bugs. {@link ClusterJFatalInternalException}
47 public class ClusterJException extends RuntimeException {
49 private static final long serialVersionUID = 3803389948396170712L;
51 public ClusterJException(String message) {
55 public ClusterJException(String message, Throwable t) {
56 super(message + " Caused by " + t.getClass().getName() + ":" + t.getMessage(), t);
59 public ClusterJException(Throwable t) {
64 public synchronized void printStackTrace(java.io.PrintStream s) {
66 super.printStackTrace(s);
67 Throwable cause = getCause();
69 getCause().printStackTrace(s);