diff -r 63714859ea5d -r a6c71e376889 launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/impl/Console.java --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/impl/Console.java Wed Oct 09 23:09:55 2013 +0200 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/impl/Console.java Sun Oct 20 20:36:03 2013 +0200 @@ -220,11 +220,15 @@ * @return the array of bytes in the given resource * @throws IOException I/O in case something goes wrong */ - public static byte[] read(String name) throws IOException { + public static byte[] read(String name, int skip) throws IOException { URL u = null; - Enumeration en = Console.class.getClassLoader().getResources(name); - while (en.hasMoreElements()) { - u = en.nextElement(); + if (!name.endsWith(".class")) { + u = getResource(name, skip); + } else { + Enumeration en = Console.class.getClassLoader().getResources(name); + while (en.hasMoreElements()) { + u = en.nextElement(); + } } if (u == null) { if (name.endsWith(".class")) { @@ -248,6 +252,19 @@ } } + private static URL getResource(String resource, int skip) throws IOException { + URL u = null; + Enumeration en = Console.class.getClassLoader().getResources(resource); + while (en.hasMoreElements()) { + final URL now = en.nextElement(); + if (--skip < 0) { + u = now; + break; + } + } + return u; + } + @JavaScriptBody(args = {}, body = "vm.desiredAssertionStatus = true;") private static void turnAssetionStatusOn() { }