当前位置: 首页>>代码示例>>Java>>正文


Java UnknownHostException.getMessage方法代码示例

本文整理汇总了Java中java.net.UnknownHostException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java UnknownHostException.getMessage方法的具体用法?Java UnknownHostException.getMessage怎么用?Java UnknownHostException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.net.UnknownHostException的用法示例。


在下文中一共展示了UnknownHostException.getMessage方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: submit

import java.net.UnknownHostException; //导入方法依赖的package包/类
@Override
public <T extends Queueable> void submit(T bean, String submitQueue) throws EventException {
	//Prepare the bean for submission
	bean.setStatus(Status.SUBMITTED);
	try {
		if (bean.getHostName() == null) {
			String localhostName = InetAddress.getLocalHost().getHostName();
			logger.trace("Hostname on received bean not set. Now set to '"+localhostName+"'.");
			bean.setHostName(localhostName);
		}
	} catch (UnknownHostException ex) {
		throw new EventException("Failed to set hostname on bean. " + ex.getMessage());
	}

	//Create a submitter and submit the bean
	ISubmitter<T> submitter = eventService.createSubmitter(uri, submitQueue);
	submitter.submit(bean);
	submitter.disconnect();
}
 
开发者ID:eclipse,项目名称:scanning,代码行数:20,代码来源:QueueControllerEventConnector.java

示例2: createMessageChannel

import java.net.UnknownHostException; //导入方法依赖的package包/类
public synchronized MessageChannel createMessageChannel(InetAddress host, int port)
        throws IOException {
    try {
        String key = MessageChannel.getKey(host, port, "TLS");
        if (messageChannels.get(key) != null) {
            return (TLSMessageChannel) this.messageChannels.get(key);
        } else {
            TLSMessageChannel retval = new TLSMessageChannel(host, port, sipStack, this);
            this.messageChannels.put(key, retval);
            retval.isCached = true;
            if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
                logger.logDebug("key " + key);
                logger.logDebug("Creating " + retval);
            }
            return retval;
        }
    } catch (UnknownHostException ex) {
        throw new IOException(ex.getMessage());
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:TLSMessageProcessor.java

示例3: createMessageChannel

import java.net.UnknownHostException; //导入方法依赖的package包/类
public synchronized MessageChannel createMessageChannel(InetAddress host, int port)
        throws IOException {
    try {
        String key = MessageChannel.getKey(host, port, "TCP");
        if (messageChannels.get(key) != null) {
            return (TCPMessageChannel) this.messageChannels.get(key);
        } else {
            TCPMessageChannel retval = new TCPMessageChannel(host, port, sipStack, this);
            this.messageChannels.put(key, retval);
            retval.isCached = true;
            if (logger.isLoggingEnabled(LogWriter.TRACE_DEBUG)) {
                logger.logDebug("key " + key);
                logger.logDebug("Creating " + retval);
            }
            return retval;
        }
    } catch (UnknownHostException ex) {
        throw new IOException(ex.getMessage());
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:21,代码来源:TCPMessageProcessor.java

示例4: getHostFromLocal

import java.net.UnknownHostException; //导入方法依赖的package包/类
/**
 * 从运行机器获取host
 * @return
 */
public static String getHostFromLocal() {
    try {
        return (InetAddress.getLocalHost()).getHostName();
    } catch (UnknownHostException uhe) {
        String host = uhe.getMessage();
        if (host != null) {
            int colon = host.indexOf(Constants.COLON);
            if (colon > 0) {
                return host.substring(0, colon);
            }
        }

    }
    return Constants.UNKNOWN_HOST;
}
 
开发者ID:JThink,项目名称:SkyEye,代码行数:20,代码来源:DockerHostUtil.java

示例5: handleUnknownHostException

import java.net.UnknownHostException; //导入方法依赖的package包/类
private void handleUnknownHostException(UnknownHostException e) {
    //debug log
    Log.e(eTag, "Client UnknownHostException", e);
    //emit event
    String message = e.getMessage();
    WritableMap eventParams = Arguments.createMap();
    eventParams.putString("error", e.getMessage());
    sendEvent(mReactContext, event_error, eventParams);
}
 
开发者ID:davidstoneham,项目名称:react-native-sockets,代码行数:10,代码来源:SocketClient.java

示例6: getRealmFromDNS

import java.net.UnknownHostException; //导入方法依赖的package包/类
/**
 * Locate Kerberos realm using DNS
 *
 * @return the Kerberos realm
 */
private String getRealmFromDNS() throws KrbException {
    // use DNS to locate Kerberos realm
    String realm = null;
    String hostName = null;
    try {
        hostName = InetAddress.getLocalHost().getCanonicalHostName();
    } catch (UnknownHostException e) {
        KrbException ke = new KrbException(Krb5.KRB_ERR_GENERIC,
            "Unable to locate Kerberos realm: " + e.getMessage());
        ke.initCause(e);
        throw (ke);
    }
    // get the domain realm mapping from the configuration
    String mapRealm = PrincipalName.mapHostToRealm(hostName);
    if (mapRealm == null) {
        // No match. Try search and/or domain in /etc/resolv.conf
        List<String> srchlist = ResolverConfiguration.open().searchlist();
        for (String domain: srchlist) {
            realm = checkRealm(domain);
            if (realm != null) {
                break;
            }
        }
    } else {
        realm = checkRealm(mapRealm);
    }
    if (realm == null) {
        throw new KrbException(Krb5.KRB_ERR_GENERIC,
                            "Unable to locate Kerberos realm");
    }
    return realm;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:Config.java

示例7: getLocalAddress

import java.net.UnknownHostException; //导入方法依赖的package包/类
public SocketAddress getLocalAddress() throws FluentdConnectorConfigError {
    try {
        return new InetSocketAddress(InetAddress.getByName(getFluentdBind()), getFluentdPort());
    } catch (UnknownHostException ex) {
        throw new FluentdConnectorConfigError(ex.getMessage());
    }
}
 
开发者ID:fluent,项目名称:kafka-connect-fluentd,代码行数:8,代码来源:FluentdSourceConnectorConfig.java

示例8: CIDR

import java.net.UnknownHostException; //导入方法依赖的package包/类
public CIDR(String cidr) {
    if (isValidFormatCIDR(cidr)) {
        try {
            calculate(cidr);
        } catch (UnknownHostException e) {
            throw new IllegalStateException("Unknown Host" + e.getMessage());
        }
    } else {
        throw new IllegalArgumentException("CIDR format isn't valid");
    }
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:12,代码来源:CIDR.java

示例9: getAddrFromBytes

import java.net.UnknownHostException; //导入方法依赖的package包/类
static InetAddress getAddrFromBytes(byte[] bytes) {
    try {
        return InetAddress.getByAddress(bytes);
    } catch (UnknownHostException e) {
        e.printStackTrace();
        throw new RuntimeException(e.getMessage());
    }
}
 
开发者ID:zhenzou,项目名称:CleanBT,代码行数:9,代码来源:Utils.java

示例10: getServerHost

import java.net.UnknownHostException; //导入方法依赖的package包/类
@Override
public InetAddress getServerHost() {
    String host = getExistingProperty(PROPERTY_TASKWARRIOR_SERVER_HOST);
    try {
        return InetAddress.getByName(host);
    } catch (UnknownHostException e) {
        throw new TaskwarriorConfigurationException(e, "Cannot resolve host address '%s': %s", host, e.getMessage());
    }
}
 
开发者ID:aaschmid,项目名称:taskwarrior-java-client,代码行数:10,代码来源:TaskwarriorPropertiesConfiguration.java

示例11: sendUDPBroadcast

import java.net.UnknownHostException; //导入方法依赖的package包/类
/**
 * Послать сообщение по UDP широковещательно
 *
 * @param message текст посылаемого сообщения
 * @param port порт получателя
 */
public static void sendUDPBroadcast(String message, int port) {
    try {
        sendUDPMessage(message, InetAddress.getByName("255.255.255.255"), port);
    } catch (UnknownHostException ex) {
        throw new ServerException("Address issues " + ex.getMessage());
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:14,代码来源:Uses.java

示例12: getHostNameForLinux

import java.net.UnknownHostException; //导入方法依赖的package包/类
public static String getHostNameForLinux() {
	try {
		return (InetAddress.getLocalHost()).getHostName();
	} catch (UnknownHostException uhe) {
		String host = uhe.getMessage(); // host = "hostname: hostname"
		if (host != null) {
			int colon = host.indexOf(':');
			if (colon > 0) {
				return host.substring(0, colon);
			}
		}
		return "UnknownHost";
	}
}
 
开发者ID:maoyaowu,项目名称:flume-ng_openfalcon_monitor,代码行数:15,代码来源:Utils.java

示例13: toString

import java.net.UnknownHostException; //导入方法依赖的package包/类
@Override
public synchronized String toString() {
	try {
		return "[" + InetAddress.getByAddress(ipAddress) + " (" + visitStates.size() + ")]";
	}
	catch (UnknownHostException e) {
		throw new RuntimeException(e.getMessage(), e);
	}
}
 
开发者ID:LAW-Unimi,项目名称:BUbiNG,代码行数:10,代码来源:WorkbenchEntry.java

示例14: handleHostException

import java.net.UnknownHostException; //导入方法依赖的package包/类
@ResponseStatus(value = HttpStatus.BAD_REQUEST, reason = "MasterUrl is not valid")
@ExceptionHandler(UnknownHostException.class)
public String handleHostException(UnknownHostException e) {
    return e.getMessage();
}
 
开发者ID:redhat-developer,项目名称:che-starter,代码行数:6,代码来源:GlobalExceptionHandler.java


注:本文中的java.net.UnknownHostException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。