Move forbidden suppression for InetSocketAddress to its own method
This commit is contained in:
parent
5c8a0da1fd
commit
7cbb955d19
|
@ -448,12 +448,12 @@ public class Node implements Releasable {
|
||||||
return this.injector;
|
return this.injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressForbidden(reason = "Need to specify port and pass to formatter")
|
/** Writes a file to the logs dir containing the ports for the given transport type */
|
||||||
private void writePortsFile(String type, BoundTransportAddress boundAddress) {
|
private void writePortsFile(String type, BoundTransportAddress boundAddress) {
|
||||||
Path tmpPortsFile = environment.logsFile().resolve(type + ".ports.tmp");
|
Path tmpPortsFile = environment.logsFile().resolve(type + ".ports.tmp");
|
||||||
try (BufferedWriter writer = Files.newBufferedWriter(tmpPortsFile, Charset.forName("UTF-8"))) {
|
try (BufferedWriter writer = Files.newBufferedWriter(tmpPortsFile, Charset.forName("UTF-8"))) {
|
||||||
for (TransportAddress address : boundAddress.boundAddresses()) {
|
for (TransportAddress address : boundAddress.boundAddresses()) {
|
||||||
InetSocketAddress socketAddress = new InetSocketAddress(address.getAddress(), address.getPort());
|
InetSocketAddress socketAddress = buildAddress(address.getAddress(), address.getPort());
|
||||||
if (socketAddress.getAddress() instanceof Inet6Address &&
|
if (socketAddress.getAddress() instanceof Inet6Address &&
|
||||||
socketAddress.getAddress().isLinkLocalAddress()) {
|
socketAddress.getAddress().isLinkLocalAddress()) {
|
||||||
// no link local, just causes problems
|
// no link local, just causes problems
|
||||||
|
@ -471,4 +471,9 @@ public class Node implements Releasable {
|
||||||
throw new RuntimeException("Failed to rename ports file", e);
|
throw new RuntimeException("Failed to rename ports file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressForbidden(reason = "Need to specify address and port")
|
||||||
|
private static InetSocketAddress buildAddress(String address, int port) {
|
||||||
|
return new InetSocketAddress(address, port);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue