Has anyone done any work with IPv6 and the Java API?

I am getting an error from ServiceURL when it tries to parse an IPv6 
address, this happens because IPv6 uses colon (":") as a separator and 
ServiceURL looks for the first ":" after the scheme, looking to see if 
there is a port specified. For example an IPv6 URL might be

https://[fe80:0:0:0:2999:2222:9602:1e69%12]:5989

I have a "fix" which utilizes the Java URL class but I'm not 100% sure 
that is valid for SLP

18a19,20
 > import java.net.MalformedURLException;
 > import java.net.URL;
61c63,64
<               _type = new ServiceType(_url.substring(0, 
transportSlash1++));
---
 >               String serviceTypeStr = _url.substring(0, 
transportSlash1++);
 >               _type = new ServiceType(serviceTypeStr);
70a74,84
 >               String tURL = 
_url.substring(serviceTypeStr.lastIndexOf(":") + 1);
 >               URL jURL;
 >               try {
 >                       jURL = new URL(tURL);
 >               } catch (MalformedURLException e) {
 >                       throw new RuntimeException(e);
 >               }
 >               _port = jURL.getPort();
 >               _host = jURL.getHost();
 >               _path = jURL.getPath();
 >               /*
95a110
 >               */


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Openslp-devel mailing list
Openslp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openslp-devel

Reply via email to