KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com4j > tlbimp > BindingException


1 package com4j.tlbimp;
2
3 import java.util.List JavaDoc;
4 import java.util.ArrayList JavaDoc;
5
6 /**
7  * Signals a failure in the binding process.
8  *
9  * @author Kohsuke Kawaguchi (kk@kohsuke.org)
10  */

11 public class BindingException extends Exception JavaDoc {
12     public BindingException(String JavaDoc message) {
13         super(message);
14     }
15
16     public BindingException(String JavaDoc message, Throwable JavaDoc cause) {
17         super(message, cause);
18     }
19
20     public BindingException(Throwable JavaDoc cause) {
21         super(cause);
22     }
23
24     private final List JavaDoc<String JavaDoc> contexts = new ArrayList JavaDoc<String JavaDoc>();
25
26     void addContext( String JavaDoc ctxt ) {
27         contexts.add(ctxt);
28     }
29
30     public String JavaDoc getMessage() {
31         StringBuilder JavaDoc buf = new StringBuilder JavaDoc();
32         buf.append(super.getMessage());
33         for( String JavaDoc s : contexts )
34             buf.append("\n ").append(s);
35         return buf.toString();
36     }
37 }
38
Popular Tags