aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/net/URL.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java
index 37ddc0f..bc891f4 100644
--- a/libjava/java/net/URL.java
+++ b/libjava/java/net/URL.java
@@ -284,7 +284,7 @@ public final class URL implements Serializable
this.host = host;
this.port = port;
this.authority = (host != null) ? host : "";
- if (port >= 0)
+ if (port >= 0 && host != null)
this.authority += ":" + port;
int hashAt = file.indexOf('#');
@@ -427,6 +427,8 @@ public final class URL implements Serializable
throw new MalformedURLException("Absolute URL required with null context");
+ protocol = protocol.trim();
+
if (ph != null)
{
SecurityManager s = System.getSecurityManager();