Log I/O exceptions before throwing them into Grizzly closure
authorJaroslav Tulach <jaroslav.tulach@apidesign.org>
Sat, 03 May 2014 20:41:35 +0200
branchclosure
changeset 15216c709f05afa5
parent 1520 f14753e81f06
child 1522 0d32bf6b4436
Log I/O exceptions before throwing them into Grizzly
launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java
     1.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java	Sat May 03 20:31:11 2014 +0200
     1.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java	Sat May 03 20:41:35 2014 +0200
     1.3 @@ -730,24 +730,29 @@
     1.4              String skip = request.getParameter("skip");
     1.5              int skipCnt = skip == null ? 0 : Integer.parseInt(skip);
     1.6              URL url = loader.get(res, skipCnt);
     1.7 -            if (url.getProtocol().equals("jar")) {
     1.8 -                JarURLConnection juc = (JarURLConnection) url.openConnection();
     1.9 -                String s = loader.compileJar(juc.getJarFile());
    1.10 -                if (s != null) {
    1.11 -                    Writer w = response.getWriter();
    1.12 -                    w.append(s);
    1.13 -                    w.close();
    1.14 -                    return;
    1.15 +            try {
    1.16 +                if (url.getProtocol().equals("jar")) {
    1.17 +                    JarURLConnection juc = (JarURLConnection) url.openConnection();
    1.18 +                    String s = loader.compileJar(juc.getJarFile());
    1.19 +                    if (s != null) {
    1.20 +                        Writer w = response.getWriter();
    1.21 +                        w.append(s);
    1.22 +                        w.close();
    1.23 +                        return;
    1.24 +                    }
    1.25                  }
    1.26 -            }
    1.27 -            if (url.getProtocol().equals("file")) {
    1.28 -                String s = loader.compileFromClassPath(url);
    1.29 -                if (s != null) {
    1.30 -                    Writer w = response.getWriter();
    1.31 -                    w.append(s);
    1.32 -                    w.close();
    1.33 -                    return;
    1.34 +                if (url.getProtocol().equals("file")) {
    1.35 +                    String s = loader.compileFromClassPath(url);
    1.36 +                    if (s != null) {
    1.37 +                        Writer w = response.getWriter();
    1.38 +                        w.append(s);
    1.39 +                        w.close();
    1.40 +                        return;
    1.41 +                    }
    1.42                  }
    1.43 +            } catch (IOException ex) {
    1.44 +                LOG.log(Level.SEVERE, "Cannot handle " + res, ex);
    1.45 +                throw ex;
    1.46              }
    1.47              Exception ex = new Exception("Won't server bytes of " + url);
    1.48              /*