1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.channel;
17
18 import static org.jboss.netty.channel.Channels.*;
19
20 import org.jboss.netty.util.internal.StackTraceSimplifier;
21
22
23
24
25 public class DefaultExceptionEvent implements ExceptionEvent {
26
27 private final Channel channel;
28 private final Throwable cause;
29
30
31
32
33 public DefaultExceptionEvent(Channel channel, Throwable cause) {
34 if (channel == null) {
35 throw new NullPointerException("channel");
36 }
37 if (cause == null) {
38 throw new NullPointerException("cause");
39 }
40 this.channel = channel;
41 this.cause = cause;
42 StackTraceSimplifier.simplify(cause);
43 }
44
45 public Channel getChannel() {
46 return channel;
47 }
48
49 public ChannelFuture getFuture() {
50 return succeededFuture(getChannel());
51 }
52
53 public Throwable getCause() {
54 return cause;
55 }
56
57 @Override
58 public String toString() {
59 return getChannel().toString() + " EXCEPTION: " + cause;
60 }
61 }