KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > databinding > BindingException


1 /*******************************************************************************
2  * Copyright (c) 2005, 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.databinding;
12
13 import java.io.PrintStream JavaDoc;
14 import java.io.PrintWriter JavaDoc;
15
16 /**
17  * An unchecked exception indicating a binding problem.
18  *
19  * @since 1.0
20  */

21 public class BindingException extends RuntimeException JavaDoc {
22
23     /*
24      * Needed because all Throwables are Serializable.
25      */

26     private static final long serialVersionUID = -4092828452936724217L;
27     private Throwable JavaDoc cause;
28
29     /**
30      * Creates a new BindingException with the given message.
31      *
32      * @param message
33      */

34     public BindingException(String JavaDoc message) {
35         super(message);
36     }
37
38     /**
39      * Creates a new BindingException with the given message and cause.
40      *
41      * @param message
42      * @param cause
43      */

44     public BindingException(String JavaDoc message, Throwable JavaDoc cause) {
45         super(message);
46         this.cause = cause;
47     }
48
49     public void printStackTrace(PrintStream JavaDoc err) {
50         super.printStackTrace(err);
51         if (cause != null) {
52             err.println("caused by:"); //$NON-NLS-1$
53
cause.printStackTrace(err);
54         }
55     }
56
57     public void printStackTrace(PrintWriter JavaDoc err) {
58         super.printStackTrace(err);
59         if (cause != null) {
60             err.println("caused by:"); //$NON-NLS-1$
61
cause.printStackTrace(err);
62         }
63     }
64 }
65
Popular Tags