Skip to content

Commit

Permalink
Inline single-use local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Oct 29, 2024
1 parent dbb3cd4 commit 42e61fe
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,7 @@ public static void formatAddress(
*/
public static String getCanonicalLocalHostName() {
try {
final InetAddress localHost = InetAddress.getLocalHost();
return localHost.getCanonicalHostName();
return InetAddress.getLocalHost().getCanonicalHostName();
} catch (final UnknownHostException ex) {
return "localhost";
}
Expand Down

0 comments on commit 42e61fe

Please sign in to comment.