Skip to content

Commit ec4c248

Browse files
ShawnMcKeemksahakyan
authored andcommitted
firefly: address latest PR 8044 inline feedback
Signed-off-by: Shawn McKee <smckee@umich.edu> (cherry picked from commit d0be764) Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
1 parent a660c4e commit ec4c248

4 files changed

Lines changed: 13 additions & 9 deletions

File tree

modules/dcache-xrootd/src/main/java/org/dcache/xrootd/door/XrootdTransfer.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.dcache.xrootd.door;
22

3+
import static com.google.common.net.InetAddresses.toUriString;
34
import static java.util.Objects.requireNonNull;
45

56
import diskCacheV111.util.FsPath;
@@ -107,9 +108,10 @@ private String formatAddress(InetSocketAddress address) {
107108
return "-";
108109
}
109110

110-
return address.getAddress() == null
111+
var inetAddress = address.getAddress();
112+
return inetAddress == null
111113
? address.getHostString()
112-
: address.getAddress().getHostAddress();
114+
: toUriString(inetAddress);
113115
}
114116

115117
@Override

modules/dcache/src/main/java/org/dcache/pool/classic/AbstractMoverProtocolTransferService.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,9 @@ private String transferTag() {
230230
}
231231

232232
private String formatError(Throwable t) {
233-
String message = t.getMessage();
234-
return message == null || message.isEmpty()
235-
? t.getClass().getSimpleName()
236-
: t.getClass().getSimpleName() + ':' + message;
233+
return t instanceof Exception
234+
? Exceptions.messageOrClassName((Exception) t)
235+
: t.getClass().getName();
237236
}
238237

239238
private synchronized void setThread() throws InterruptedException {

modules/dcache/src/main/java/org/dcache/pool/classic/DefaultPostTransferService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818
package org.dcache.pool.classic;
1919

20+
import static com.google.common.net.InetAddresses.toUriString;
2021
import static org.dcache.util.Exceptions.messageOrClassName;
2122

2223
import com.google.common.base.Throwables;
@@ -342,8 +343,9 @@ private String formatEndpoint(InetSocketAddress endpoint) {
342343
return "-";
343344
}
344345

345-
if (endpoint.getAddress() != null) {
346-
return endpoint.getAddress().getHostAddress() + ":" + endpoint.getPort();
346+
InetAddress endpointAddress = endpoint.getAddress();
347+
if (endpointAddress != null) {
348+
return toUriString(endpointAddress) + ":" + endpoint.getPort();
347349
}
348350

349351
return endpoint.getHostString() + ":" + endpoint.getPort();

modules/dcache/src/main/java/org/dcache/pool/movers/TransferLifeCycle.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import static com.google.common.base.Preconditions.checkArgument;
2121
import static com.google.common.net.InetAddresses.forString;
22+
import static com.google.common.net.InetAddresses.toUriString;
2223

2324
import com.google.common.base.Splitter;
2425
import com.google.common.net.HostAndPort;
@@ -447,7 +448,7 @@ private String formatAddress(InetSocketAddress address) {
447448
}
448449

449450
InetAddress inetAddress = address.getAddress();
450-
return inetAddress == null ? address.getHostString() : inetAddress.getHostAddress();
451+
return inetAddress == null ? address.getHostString() : toUriString(inetAddress);
451452
}
452453

453454
private String formatPort(InetSocketAddress address) {

0 commit comments

Comments
 (0)