mx4j/src/core/javax/management/remote JMXServiceURL.java,1.8,1.9
Simone Bordet <[email protected]>
| Newsgroups | gmane.comp.java.mx4j.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/mx4j/mx4j/src/core/javax/management/remote
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27119/core/javax/management/remote
Modified Files:
JMXServiceURL.java
Log Message:
Fixed bugs in case of the several parameters constructor when arguments are null
Index: JMXServiceURL.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/javax/management/remote/JMXServiceURL.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** JMXServiceURL.java 26 Oct 2003 03:14:30 -0000 1.8
--- JMXServiceURL.java 18 Jul 2004 21:18:59 -0000 1.9
***************
*** 21,27 ****
public class JMXServiceURL implements Serializable
{
-
private static final long serialVersionUID = 8173364409860779292l;
!
/** @serial The protocol */
private String protocol;
--- 21,26 ----
public class JMXServiceURL implements Serializable
{
private static final long serialVersionUID = 8173364409860779292l;
!
/** @serial The protocol */
private String protocol;
***************
*** 50,68 ****
if (port < 0) throw new MalformedURLException("Port number cannot be less than zero");
- if (protocol == null) protocol = "jmxmp";
- if (urlPath == null) urlPath = "";
-
- if (host == null)
- {
- try
- {
- host = InetAddress.getLocalHost().getHostName();
- }
- catch (UnknownHostException x)
- {
- throw new MalformedURLException("Cannot resolve local host name");
- }
- }
-
setProtocol(protocol);
setHost(host);
--- 49,52 ----
***************
*** 71,74 ****
--- 55,72 ----
}
+ private String resolveHost() throws MalformedURLException
+ {
+ String host;
+ try
+ {
+ host = InetAddress.getLocalHost().getHostName();
+ }
+ catch (UnknownHostException x)
+ {
+ throw new MalformedURLException("Cannot resolve local host name");
+ }
+ return host;
+ }
+
public String getProtocol()
{
***************
*** 81,85 ****
this.protocol = protocol.toLowerCase();
else
! this.protocol = null;
}
--- 79,83 ----
this.protocol = protocol.toLowerCase();
else
! this.protocol = "jmxmp"; // Default required by the spec
}
***************
*** 89,98 ****
}
! private void setHost(String host)
{
if (host != null)
this.host = host.toLowerCase();
else
! this.host = null;
}
--- 87,96 ----
}
! private void setHost(String host) throws MalformedURLException
{
if (host != null)
this.host = host.toLowerCase();
else
! this.host = resolveHost(); // Default required by the spec
}
***************
*** 114,118 ****
private void setURLPath(String urlPath)
{
! this.urlPath = urlPath;
}
--- 112,124 ----
private void setURLPath(String urlPath)
{
! if (urlPath != null)
! {
! if (urlPath.length() > 0 && !urlPath.startsWith("/")) urlPath = "/" + urlPath;
! this.urlPath = urlPath;
! }
! else
! {
! this.urlPath = ""; // Default required by the spec
! }
}
***************
*** 201,205 ****
{
checkURLPath(url, pathAndMore);
! setURLPath(pathAndMore);
}
}
--- 207,212 ----
{
checkURLPath(url, pathAndMore);
! String path = "/".equals(pathAndMore) ? "" : pathAndMore; // Special case
! setURLPath(path);
}
}
***************
*** 208,212 ****
private void parseHostAndPort(String url, String hostAndPort) throws MalformedURLException
{
! if (hostAndPort.length() == 0) return;
int colon = hostAndPort.indexOf(':');
--- 215,224 ----
private void parseHostAndPort(String url, String hostAndPort) throws MalformedURLException
{
! if (hostAndPort.length() == 0)
! {
! setHost(null);
! setPort(0);
! return;
! }
int colon = hostAndPort.indexOf(':');
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click