MCPcopy Create free account
hub / github.com/M66B/FairEmail / getLocalHost

Method getLocalHost

app/src/main/java/com/sun/mail/pop3/Protocol.java:746–772  ·  view source on GitHub ↗

Get the name of the local host. @return the local host name @since Jakarta Mail 1.6.5

()

Source from the content-addressed store, hash-verified

744 * @since Jakarta Mail 1.6.5
745 */
746 private synchronized String getLocalHost() {
747 // get our hostname and cache it for future use
748 try {
749 if (localHostName == null || localHostName.length() == 0) {
750 InetAddress localHost = InetAddress.getLocalHost();
751 localHostName = localHost.getCanonicalHostName();
752 // if we can't get our name, use local address literal
753 if (localHostName == null)
754 // XXX - not correct for IPv6
755 localHostName = "[" + localHost.getHostAddress() + "]";
756 }
757 } catch (UnknownHostException uhex) {
758 }
759
760 // last chance, try to get our address from our socket
761 if (localHostName == null || localHostName.length() <= 0) {
762 if (socket != null && socket.isBound()) {
763 InetAddress localHost = socket.getLocalAddress();
764 localHostName = localHost.getCanonicalHostName();
765 // if we can't get our name, use local address literal
766 if (localHostName == null)
767 // XXX - not correct for IPv6
768 localHostName = "[" + localHost.getHostAddress() + "]";
769 }
770 }
771 return localHostName;
772 }
773
774 private static char[] digits = {
775 '0', '1', '2', '3', '4', '5', '6', '7',

Callers 1

getInitialResponseMethod · 0.45

Calls 4

getHostAddressMethod · 0.80
lengthMethod · 0.45
isBoundMethod · 0.45
getLocalAddressMethod · 0.45

Tested by

no test coverage detected