Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 26796 Details for
Bug 108656
org.eclipse.wst.server.core.util.SocketUtil uses Sun's proprietary classes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Workaround
SocketUtil.patch (text/plain), 1.94 KB, created by
Sébastien Le Ray
on 2005-09-02 05:59:14 EDT
(
hide
)
Description:
Workaround
Filename:
MIME Type:
Creator:
Sébastien Le Ray
Created:
2005-09-02 05:59:14 EDT
Size:
1.94 KB
patch
obsolete
>*** org/eclipse/wst/server/core/util/SocketUtil.java (original) Fri Sep 02 11:12:07 2005 >--- org/eclipse/wst/server/core/util/SocketUtil.java Fri Sep 02 11:18:19 2005 >*************** >*** 11,16 **** >--- 11,17 ---- > package org.eclipse.wst.server.core.util; > > import java.io.IOException; >+ import java.lang.reflect.Method; > import java.net.InetAddress; > import java.net.ServerSocket; > import java.net.SocketException; >*************** import java.util.Random; >*** 18,24 **** > > import org.eclipse.wst.server.core.internal.Trace; > >- import sun.net.spi.nameservice.dns.DNSNameService; > /** > * A utility class for socket-related function. It's main purposes are to find > * unused ports, check whether a port is in use, and check whether a given >--- 19,24 ---- >*************** public class SocketUtil { >*** 31,36 **** >--- 31,37 ---- > > private static String dnsHostname; > >+ private static final String DNSNAMESERVICE_CLASS = "sun.net.spi.nameservice.dns.DNSNameService"; > /** > * Static utility class - cannot create an instance. > */ >*************** public class SocketUtil { >*** 157,164 **** > > if (dnsHostname == null) > try { >! DNSNameService dns = new DNSNameService(); >! dnsHostname = dns.getHostByAddr(localHostaddr.getAddress()); > } catch (Throwable t) { > dnsHostname = "*****************"; > } >--- 158,171 ---- > > if (dnsHostname == null) > try { >! // Workaround to break dependency with Sun's classes >! Class DNSNameServiceClass = Class.forName(DNSNAMESERVICE_CLASS); >! Method getHostByAddrMeth = DNSNameServiceClass.getMethod("getHostByAddr", >! new Class[] {byte[].class}); >! Object dns = DNSNameServiceClass.newInstance(); >! >! dnsHostname = (String)getHostByAddrMeth.invoke(dns, >! new Object[]{localHostaddr.getAddress()}); > } catch (Throwable t) { > dnsHostname = "*****************"; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 108656
: 26796