1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.resolver.dns;
17
18 import io.netty.handler.codec.dns.DnsQuestion;
19 import io.netty.util.internal.EmptyArrays;
20 import io.netty.util.internal.ObjectUtil;
21
22 import java.net.InetSocketAddress;
23
24
25
26
27 public class DnsNameResolverException extends RuntimeException {
28
29 private static final long serialVersionUID = -8826717909627131850L;
30
31 private final InetSocketAddress remoteAddress;
32 private final DnsQuestion question;
33
34 public DnsNameResolverException(InetSocketAddress remoteAddress, DnsQuestion question, String message) {
35 super(message);
36 this.remoteAddress = validateRemoteAddress(remoteAddress);
37 this.question = validateQuestion(question);
38 }
39
40 public DnsNameResolverException(
41 InetSocketAddress remoteAddress, DnsQuestion question, String message, Throwable cause) {
42 super(message, cause);
43 this.remoteAddress = validateRemoteAddress(remoteAddress);
44 this.question = validateQuestion(question);
45 }
46
47 private static InetSocketAddress validateRemoteAddress(InetSocketAddress remoteAddress) {
48 return ObjectUtil.checkNotNull(remoteAddress, "remoteAddress");
49 }
50
51 private static DnsQuestion validateQuestion(DnsQuestion question) {
52 return ObjectUtil.checkNotNull(question, "question");
53 }
54
55
56
57
58 public InetSocketAddress remoteAddress() {
59 return remoteAddress;
60 }
61
62
63
64
65 public DnsQuestion question() {
66 return question;
67 }
68
69
70 @Override
71 public Throwable fillInStackTrace() {
72 setStackTrace(EmptyArrays.EMPTY_STACK_TRACE);
73 return this;
74 }
75 }