From eeb32988362bb6942c88f173c2062aa23ec7684e Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 11 Jul 2004 16:48:29 +0000 Subject: [PATCH] Reported by Roman Kennke (bug #9331) Reported by Roman Kennke (bug #9331) * java/net/URLStreamHandler.java (parseURL): When url file part doesn't contain a '/' just ignore context. From-SVN: r84518 --- libjava/ChangeLog | 6 ++++++ libjava/java/net/URLStreamHandler.java | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 01952d6a5d5..c7f5dec4705 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2004-07-11 Mark Wielaard + + Reported by Roman Kennke (bug #9331) + * java/net/URLStreamHandler.java (parseURL): When url file part + doesn't contain a '/' just ignore context. + 2004-07-11 Ulrich Weigand * include/s390-signal.c (SIGNAL_HANDLER): Use SIGINFO-style prototype. diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java index 5fef7ea909e..aca62612f66 100644 --- a/libjava/java/net/URLStreamHandler.java +++ b/libjava/java/net/URLStreamHandler.java @@ -208,9 +208,11 @@ public abstract class URLStreamHandler { // Context is available, but only override it if there is a new file. int lastSlash = file.lastIndexOf('/'); - - file = - file.substring(0, lastSlash) + '/' + spec.substring(start, end); + if (lastSlash < 0) + file = spec.substring(start, end); + else + file = (file.substring(0, lastSlash) + + '/' + spec.substring(start, end)); if (url.getProtocol().equals("file")) { -- 2.30.2