Commit 716e499
authored
Avoid masking the cause of availability failures for the Mac DNS provider (netty#12039)
Motivation:
If the MacOSDnsServerAddressStreamProvider is unavailable, we'd the root cause of it to show up.
Modification:
Move the initialisation of the `MacOSDnsServerAddressStreamProvider.currentMappings` field to the constructor.
Object initialisers run before the constructor does, so since `MacOSDnsServerAddressStreamProvider.retrieveCurrentMappings` relies on the native code, it would throw an `UnsatisfiedLinkError` before `ensureAvailability` would get to run.
This way, it was masking the root cause of the unavailability.
Now, the `currentMappings` is initialised *after* we've called `ensureAvailability`, so we don't lose the root cause if we cannot use native DNS on Mac.
Result:
Easier to debug problems with initialising native MacOS DNS.1 parent 13fd022 commit 716e499
File tree
1 file changed
+5
-3
lines changed- resolver-dns-classes-macos/src/main/java/io/netty/resolver/dns/macos
1 file changed
+5
-3
lines changedLines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
121 | 123 | | |
122 | 124 | | |
123 | | - | |
124 | | - | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
| |||
0 commit comments