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


Java UnknownHostException.printStackTrace方法代码示例

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


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

示例1: initialize

import java.net.UnknownHostException; //导入方法依赖的package包/类
@Override
public ElasticsearchAddonImpl initialize(ServiceConfig serviceConfig) {

    Settings settings = Settings.builder()
            .put("cluster.name", clustername)
            .put("node.name", clientname)
            .build();

    InetAddress address = null;
    try {
        address = InetAddress.getByName(coordinatorUrl);
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    return this.withClient(new PreBuiltTransportClient(settings).addTransportAddress(new InetSocketTransportAddress(address, coordinatorPort)));
}
 
开发者ID:code-obos,项目名称:servicebuilder,代码行数:18,代码来源:ElasticsearchAddonImpl.java

示例2: Blowfish

import java.net.UnknownHostException; //导入方法依赖的package包/类
public Blowfish(String csKey, boolean bMixWithIpAdress)
{
	try
	{
		if(bMixWithIpAdress)
		{
			InetAddress adr = InetAddress.getLocalHost();
			byte ipAdress[] = adr.getAddress();
			int nVal = 0;
			for(int n=0; n<ipAdress.length; n++)
			{
				nVal *= 256;
				nVal += ipAdress[n];
			}
			csKey += nVal;
		}
	}
	catch (UnknownHostException e)
	{
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	m_csKey = csKey;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:25,代码来源:Blowfish.java

示例3: getDeviceIpAddress

import java.net.UnknownHostException; //导入方法依赖的package包/类
private InetAddress getDeviceIpAddress(WifiManager wifi) {
	InetAddress result = null;
	try {
		// default to Android localhost
		result = InetAddress.getByName("10.0.0.2");

		// figure out our wifi address, otherwise bail
		WifiInfo wifiinfo = wifi.getConnectionInfo();
		int intaddr = wifiinfo.getIpAddress();
		byte[] byteaddr = new byte[] { (byte) (intaddr & 0xff), (byte) (intaddr >> 8 & 0xff), (byte) (intaddr >> 16 & 0xff), (byte) (intaddr >> 24 & 0xff) };
		result = InetAddress.getByAddress(byteaddr);
	} catch (UnknownHostException e) {
		e.printStackTrace();
		Log.e(TAG, "getDeviceIpAddress Error: " + e.getMessage());
	}

	return result;
}
 
开发者ID:hoanglm4,项目名称:RxAndroidTBP,代码行数:19,代码来源:MDnsHelper.java

示例4: checkConnectImpl

import java.net.UnknownHostException; //导入方法依赖的package包/类
final void checkConnectImpl(String host, int port) {
    Class insecure = getInsecureClass();
    if (insecure != null) {  
        URL ctx = getClassURL(insecure);
        if (ctx != null) {
            try {
                String fromHost = ctx.getHost();
                InetAddress ia2 = InetAddress.getByName(host);
                InetAddress ia3 = InetAddress.getByName(fromHost);
                if (ia2.equals(ia3)) {
                    return;
                }
            } catch (UnknownHostException e) { // ignore
                e.printStackTrace();
            }
        }
        throw new SecurityException();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TopSecurityManager.java

示例5: onConfigChanged

import java.net.UnknownHostException; //导入方法依赖的package包/类
@Override
public void onConfigChanged(OnConfigChangedEvent ev)
{
    if (ev.configID.equals(MalmoMod.SOCKET_CONFIGS))
    {
        AddressHelper.update(MalmoMod.instance.getModSessionConfigFile());
        try
        {
            ClientStateMachine.this.initialiseComms();
        }
        catch (UnknownHostException e)
        {
            // TODO What to do here?
            e.printStackTrace();
        }
        ScreenHelper.update(MalmoMod.instance.getModPermanentConfigFile());
    }
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:19,代码来源:ClientStateMachine.java

示例6: init

import java.net.UnknownHostException; //导入方法依赖的package包/类
/**
 * Initialization of the servlet. <br>
 *
 * @throws ServletException if an error occurs
 */
public void init() throws ServletException {
	String file = this.getServletContext().getRealPath(this.getInitParameter("log4j"));
	//从web.xml配置读取,名字一定要和web.xml配置一致
	  if(file != null){
	     PropertyConfigurator.configure(file);
	  }
	// Put your code here
	new CrawlerServer(DefaultConfig.serverPort).start();
	try {
		new WebSocket(DefaultConfig.socketPort).start();
	} catch (UnknownHostException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:zrtzrt,项目名称:CrawlerSYS,代码行数:21,代码来源:CrawlerServlet.java

示例7: localHostName

import java.net.UnknownHostException; //导入方法依赖的package包/类
public static String localHostName() {
    try {
        return InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }

    return "DEFAULT_BROKER";
}
 
开发者ID:lyy4j,项目名称:rmq4note,代码行数:10,代码来源:BrokerConfig.java

示例8: getHost

import java.net.UnknownHostException; //导入方法依赖的package包/类
public static String getHost() {
	try {
		InetAddress a = InetAddress.getLocalHost();
		return a.getHostAddress().toUpperCase();
	} catch (UnknownHostException e) {
		e.printStackTrace();
		return "N/A";
	}

}
 
开发者ID:jiangzongyao,项目名称:kettle_support_kettle8.0,代码行数:11,代码来源:ServerUtils.java

示例9: getDomainAddress

import java.net.UnknownHostException; //导入方法依赖的package包/类
/**
 * 获取域名ip地址
 * <p>需添加权限 {@code <uses-permission android:name="android.permission.INTERNET"/>}</p>
 *
 * @param domain 域名
 * @return ip地址
 */
public static String getDomainAddress(final String domain) {
    InetAddress inetAddress;
    try {
        inetAddress = InetAddress.getByName(domain);
        return inetAddress.getHostAddress();
    } catch (UnknownHostException e) {
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:NetworkUtils.java

示例10: initClient

import java.net.UnknownHostException; //导入方法依赖的package包/类
private static void initClient() {
    try {
        client = TransportClient.builder().settings(Settings.EMPTY).build()
                .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(IP), PORT));
    } catch (UnknownHostException e) {
        e.printStackTrace();
    }
}
 
开发者ID:HongChutang,项目名称:NTPaprEng,代码行数:9,代码来源:ESClient.java

示例11: init

import java.net.UnknownHostException; //导入方法依赖的package包/类
@Override
public void init()
{
                   
                   try{
                System.setProperty("java.net.preferIPv4Stack", "true");
                             ip = InetAddress.getLocalHost();
                ipadd = ip.getHostAddress();
          }catch (UnknownHostException e)
	{
	       e.printStackTrace();
	}
}
 
开发者ID:Tejas07PSK,项目名称:EBwn2_ForOpenShift,代码行数:14,代码来源:SchUtil.java

示例12: getLocalHost

import java.net.UnknownHostException; //导入方法依赖的package包/类
public String getLocalHost() {
	// TODO Auto-generated method stub
	String addr="";
	try {
		addr= InetAddress.getLocalHost().getHostAddress();
	} catch (UnknownHostException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return addr;
}
 
开发者ID:cyberheartmi9,项目名称:Mona-Secure-Multi-Owner-Data-Sharing-for-Dynamic-Group-in-the-Cloud,代码行数:12,代码来源:Action.java

示例13: ipIntToInet4Address

import java.net.UnknownHostException; //导入方法依赖的package包/类
public static InetAddress ipIntToInet4Address(int ip) {
    byte[] ipAddress = new byte[4];
    writeInt(ipAddress, 0, ip);
    try {
        return Inet4Address.getByAddress(ipAddress);
    } catch (UnknownHostException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
        return null;
    }
}
 
开发者ID:IronMan001,项目名称:ss-android,代码行数:12,代码来源:CommonMethods.java

示例14: detectIPAddress

import java.net.UnknownHostException; //导入方法依赖的package包/类
private static String detectIPAddress() {
	String ipAddress = null;
	try {
		if (InetAddress.getLocalHost().isAnyLocalAddress() || InetAddress.getLocalHost().isLoopbackAddress() || InetAddress.getLocalHost().isSiteLocalAddress()) {
			ipAddress = InetAddress.getLoopbackAddress().getHostAddress();
		} else {
			ipAddress = InetAddress.getLocalHost().getHostAddress();
		}
	} catch (final UnknownHostException e) {
		e.printStackTrace();
	}
	return ipAddress;
}
 
开发者ID:ad-tech-group,项目名称:openssp,代码行数:14,代码来源:CatalinaUtil.java

示例15: init

import java.net.UnknownHostException; //导入方法依赖的package包/类
@Override
public void init()
{
                   System.setProperty("java.net.preferIPv4Stack", "true");
                   try{
                ip = InetAddress.getLocalHost();
                ipadd = ip.getHostAddress();
          }catch (UnknownHostException e)
	{
	       e.printStackTrace();
	}
}
 
开发者ID:Tejas07PSK,项目名称:EBwn2_ForOpenShift,代码行数:13,代码来源:AndroServlet.java


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