Author: darran.lofthouse(a)jboss.com
Date: 2010-01-07 12:32:01 -0500 (Thu, 07 Jan 2010)
New Revision: 11367
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
Log:
[JBWS-2883] WSException: Malformed URL when deploying to AS bound to IPv6 address.
Modified:
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java
===================================================================
---
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2010-01-04
11:27:11 UTC (rev 11366)
+++
stack/native/trunk/modules/core/src/main/java/org/jboss/ws/metadata/builder/MetaDataBuilder.java 2010-01-07
17:32:01 UTC (rev 11367)
@@ -236,40 +236,42 @@
ServerConfig config =
spiProvider.getSPI(ServerConfigFactory.class).getServerConfig();
String host = config.getWebServiceHost();
- String port = "";
- if (servicePort != -1)
+
+ int port = servicePort;
+ if (servicePort == -1)
{
- port = ":" + servicePort;
- }
- else
- {
if ("https".equals(uriScheme))
{
- int portNo = config.getWebServiceSecurePort();
- if (portNo != 443)
- {
- port = ":" + portNo;
- }
-
+ port = config.getWebServiceSecurePort();
}
else
{
- int portNo = config.getWebServicePort();
- if (portNo != 80)
- {
- port = ":" + portNo;
- }
+ port = config.getWebServicePort();
}
}
- String urlStr = uriScheme + "://" + host + port + servicePath;
+ // Reset port if using the default for the scheme.
+ if (("http".equals(uriScheme) && port == 80) ||
("https".equals(uriScheme) && port == 443))
+ {
+ port = -1;
+ }
+
+ URL url = null;
try
{
- return new URL(urlStr).toExternalForm();
+ if (port > -1)
+ {
+ url = new URL(uriScheme, host, port, servicePath);
+ }
+ else
+ {
+ url = new URL(uriScheme, host, servicePath);
+ }
+ return url.toExternalForm();
}
catch (MalformedURLException e)
{
- throw new WSException("Malformed URL: " + urlStr);
+ throw new WSException("Malformed URL: uriScheme={" + uriScheme +
"} host={" + host + "} port={" + port + "} servicePath={" +
servicePath + "}", e);
}
}