From 651b0eb49a271c81a38f99922eb6a7fb7f3a9467 Mon Sep 17 00:00:00 2001 From: Dain Date: Fri, 2 Dec 2011 15:46:36 -0700 Subject: [PATCH 1/3] Add rudimentary support for http/https protocols in URL. --- classpath/java/net/URL.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/classpath/java/net/URL.java b/classpath/java/net/URL.java index eb46c61860..6cd8e92095 100644 --- a/classpath/java/net/URL.java +++ b/classpath/java/net/URL.java @@ -81,7 +81,11 @@ public final class URL { private static URLStreamHandler findHandler(String protocol) throws MalformedURLException { - if ("resource".equals(protocol)) { + if ("http".equals(protocol)) { + return new avian.file.Handler(); + } else if ("https".equals(protocol)) { + return new avian.file.Handler(); + } else if ("resource".equals(protocol)) { return new avian.resource.Handler(); } else if ("file".equals(protocol)) { return new avian.file.Handler(); From 70408ea717f5c1929336d8fd790a735f951f4f96 Mon Sep 17 00:00:00 2001 From: Dain Date: Wed, 4 Jan 2012 12:01:43 -0700 Subject: [PATCH 2/3] Fix a bug in parsing the port value from a URL. --- classpath/java/net/URLStreamHandler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classpath/java/net/URLStreamHandler.java b/classpath/java/net/URLStreamHandler.java index 5c72deada1..7beacae25e 100644 --- a/classpath/java/net/URLStreamHandler.java +++ b/classpath/java/net/URLStreamHandler.java @@ -38,7 +38,7 @@ public abstract class URLStreamHandler { host = s.substring(0, slash); } else { host = s.substring(0, colon); - port = Integer.parseInt(s.substring(colon + 1), slash); + port = Integer.parseInt(s.substring(colon + 1, slash)); } s = s.substring(slash + 1); } From a6753c3dc3fda03dc9948e21911fdb79b0f35881 Mon Sep 17 00:00:00 2001 From: Dain Date: Thu, 19 Jan 2012 15:10:45 -0700 Subject: [PATCH 3/3] Request a share mode of both reading and writing for RandomAccessFile open. This change allows reading and writing to happen concurrently on the file on Windows. --- classpath/java-io.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classpath/java-io.cpp b/classpath/java-io.cpp index 9175c6e978..bd399b46de 100644 --- a/classpath/java-io.cpp +++ b/classpath/java-io.cpp @@ -178,7 +178,8 @@ inline Mapping* map(JNIEnv* e, string_t path) { Mapping* result = 0; - HANDLE file = CreateFileW(path, FILE_READ_DATA, FILE_SHARE_READ, 0, + HANDLE file = CreateFileW(path, FILE_READ_DATA, + FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0); if (file != INVALID_HANDLE_VALUE) { unsigned size = GetFileSize(file, 0);