From e055c0677062fe1888fd992e65fe67a6dbd283a8 Mon Sep 17 00:00:00 2001 From: Michael Koch Date: Tue, 11 Nov 2003 11:34:24 +0000 Subject: URLStreamHandler.java (toExternalForm): Print port only if host is printed too and port was really given to URL. 2003-11-11 Micheal Koch * java/net/URLStreamHandler.java (toExternalForm): Print port only if host is printed too and port was really given to URL. From-SVN: r73445 --- libjava/java/net/URLStreamHandler.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'libjava/java/net') diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java index 9198370..a05e474 100644 --- a/libjava/java/net/URLStreamHandler.java +++ b/libjava/java/net/URLStreamHandler.java @@ -478,11 +478,13 @@ public abstract class URLStreamHandler } if (host.length() != 0) - sb.append("//").append(host); + { + sb.append("//").append(host); - // Append port if port was in URL spec. - if (port != -1) - sb.append(':').append(port); + // Append port if port was in URL spec. + if (port >= 0) + sb.append(':').append(port); + } sb.append(file); -- cgit v1.1