diff -r bc2319ca9c17 -r 9926996eca2d rt/emul/mini/src/main/java/java/net/URL.java --- a/rt/emul/mini/src/main/java/java/net/URL.java Fri Oct 18 12:29:14 2013 +0200 +++ b/rt/emul/mini/src/main/java/java/net/URL.java Thu Oct 31 11:23:54 2013 +0100 @@ -965,9 +965,9 @@ * @see java.net.URL#URL(java.lang.String, java.lang.String, * int, java.lang.String) */ -// public URLConnection openConnection() throws java.io.IOException { -// return handler.openConnection(this); -// } + public URLConnection openConnection() throws java.io.IOException { + return handler.openConnection(this); + } /** @@ -1058,8 +1058,39 @@ return null; } - static URLStreamHandler getURLStreamHandler(String protocol) { - URLStreamHandler universal = new URLStreamHandler() {}; + static URLStreamHandler getURLStreamHandler(final String protocol) { + URLStreamHandler universal = new URLStreamHandler() { + @Override + protected URLConnection openConnection(URL u) throws IOException { + return new URLConnection(u) { + Object stream = url.is; + + @Override + public void connect() throws IOException { + if (stream == null) { + try { + byte[] arr = (byte[]) url.getContent(new Class[]{byte[].class}); + stream = new ByteArrayInputStream(arr); + } catch (IOException ex) { + stream = ex; + throw ex; + } + } + } + + @Override + public InputStream getInputStream() throws IOException { + connect(); + if (stream instanceof IOException) { + throw (IOException)stream; + } + return (InputStream)stream; + } + + + }; + } + }; return universal; }