aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/net/URL.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/java/net/URL.java')
-rw-r--r--libjava/java/net/URL.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/libjava/java/net/URL.java b/libjava/java/net/URL.java
index f80a52f..5931eef 100644
--- a/libjava/java/net/URL.java
+++ b/libjava/java/net/URL.java
@@ -329,6 +329,20 @@ public final class URL implements Serializable
// If a non-default factory has been set, use it to find the protocol.
if (factory != null)
handler = factory.createURLStreamHandler(protocol);
+ else if (protocol.equals ("file"))
+ {
+ // This is an interesting case. It's tempting to think that we
+ // could call Class.forName ("gnu.gcj.protocol.file.Handler") to
+ // get the appropriate class. Unfortunately, if we do that the
+ // program will never terminate, because setURLStreamHandler is
+ // eventually called by Class.forName.
+ //
+ // Treating "file" as a special case is the minimum that will
+ // fix this problem. If other protocols are required in a
+ // statically linked application they will need to be handled in
+ // the same way as "file".
+ handler = new gnu.gcj.protocol.file.Handler ();
+ }
// Non-default factory may have returned null or a factory wasn't set.
// Use the default search algorithm to find a handler for this protocol.