1.1 --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/impl/Console.java Wed Oct 09 23:09:55 2013 +0200
1.2 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/impl/Console.java Sun Oct 20 20:36:03 2013 +0200
1.3 @@ -220,11 +220,15 @@
1.4 * @return the array of bytes in the given resource
1.5 * @throws IOException I/O in case something goes wrong
1.6 */
1.7 - public static byte[] read(String name) throws IOException {
1.8 + public static byte[] read(String name, int skip) throws IOException {
1.9 URL u = null;
1.10 - Enumeration<URL> en = Console.class.getClassLoader().getResources(name);
1.11 - while (en.hasMoreElements()) {
1.12 - u = en.nextElement();
1.13 + if (!name.endsWith(".class")) {
1.14 + u = getResource(name, skip);
1.15 + } else {
1.16 + Enumeration<URL> en = Console.class.getClassLoader().getResources(name);
1.17 + while (en.hasMoreElements()) {
1.18 + u = en.nextElement();
1.19 + }
1.20 }
1.21 if (u == null) {
1.22 if (name.endsWith(".class")) {
1.23 @@ -248,6 +252,19 @@
1.24 }
1.25 }
1.26
1.27 + private static URL getResource(String resource, int skip) throws IOException {
1.28 + URL u = null;
1.29 + Enumeration<URL> en = Console.class.getClassLoader().getResources(resource);
1.30 + while (en.hasMoreElements()) {
1.31 + final URL now = en.nextElement();
1.32 + if (--skip < 0) {
1.33 + u = now;
1.34 + break;
1.35 + }
1.36 + }
1.37 + return u;
1.38 + }
1.39 +
1.40 @JavaScriptBody(args = {}, body = "vm.desiredAssertionStatus = true;")
1.41 private static void turnAssetionStatusOn() {
1.42 }