By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown:
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by
String hostName = "localhost";
try
{
URL requestUrl = new URL(httpRequest.getRequestURL().toString());
hostName = requestUrl.getHost();
} catch (MalformedURLException mfException) {}
SOURCE_SERVLET_URL = "http://" +
hostName +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
ICE-8340 is not related to this issue but the improvement for
ICE-8340 happens in the same code block.
was:
It was found that httpRequest.getLocalName() in the SourceCodeLoaderConnection.java was returning an 0:0.0:0.0:0.0:1 for the device's IP address in environment, which have 2 nic interfaces and one of them is not bound to any ip. so that the contructed URL is a malformated one.
By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown:
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by
String hostName = "localhost";
try {
URL requestUrl = new URL(httpRequest.getRequestURL().toString());
hostName = requestUrl.getHost();
}
catch (MalformedURLException mfException) {}
SOURCE_SERVLET_URL = "http://" +
hostName +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown:
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by
String hostName = "localhost";
{ URL requestUrl = new URL(httpRequest.getRequestURL().toString()); hostName = requestUrl.getHost(); } catch (MalformedURLException mfException) {}try
SOURCE_SERVLET_URL = "http://" +
hostName +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
ICE-8340is not related to this issue but the improvement forICE-8340happens in the same code block.was:
It was found that httpRequest.getLocalName() in the SourceCodeLoaderConnection.java was returning an 0:0.0:0.0:0.0:1 for the device's IP address in environment, which have 2 nic interfaces and one of them is not bound to any ip. so that the contructed URL is a malformated one.
By looking the source and noticed the url SOURCE_SERVLET_URL is constructed by httpRequest.getLocalName() as shown:
SOURCE_SERVLET_URL = "http://" +
httpRequest.getLocalName() +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";
This is not reliable as getLocalName() may not return something url friendly. due to various native layer variations. It should be replaced by
String hostName = "localhost";
try { URL requestUrl = new URL(httpRequest.getRequestURL().toString()); hostName = requestUrl.getHost(); }
catch (MalformedURLException mfException) {}
SOURCE_SERVLET_URL = "http://" +
hostName +
":" +
httpRequest.getLocalPort() +
httpRequest.getContextPath() +
"/";