1.1 --- a/launcher/fx/pom.xml Tue May 28 21:49:11 2013 +0200
1.2 +++ b/launcher/fx/pom.xml Tue May 28 21:49:38 2013 +0200
1.3 @@ -18,8 +18,8 @@
1.4 <artifactId>maven-compiler-plugin</artifactId>
1.5 <version>2.3.2</version>
1.6 <configuration>
1.7 - <source>1.7</source>
1.8 - <target>1.7</target>
1.9 + <source>1.6</source>
1.10 + <target>1.6</target>
1.11 </configuration>
1.12 </plugin>
1.13 <plugin>
2.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java Tue May 28 21:49:11 2013 +0200
2.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/BaseHTTPLauncher.java Tue May 28 21:49:38 2013 +0200
2.3 @@ -61,8 +61,8 @@
2.4 abstract class BaseHTTPLauncher extends Launcher implements Closeable, Callable<HttpServer> {
2.5 static final Logger LOG = Logger.getLogger(BaseHTTPLauncher.class.getName());
2.6 private static final InvocationContext END = new InvocationContext(null, null, null);
2.7 - private final Set<ClassLoader> loaders = new LinkedHashSet<>();
2.8 - private final BlockingQueue<InvocationContext> methods = new LinkedBlockingQueue<>();
2.9 + private final Set<ClassLoader> loaders = new LinkedHashSet<ClassLoader>();
2.10 + private final BlockingQueue<InvocationContext> methods = new LinkedBlockingQueue<InvocationContext>();
2.11 private long timeOut;
2.12 private final Res resources = new Res();
2.13 private final String cmd;
2.14 @@ -112,7 +112,7 @@
2.15 server = s;
2.16 try {
2.17 launchServerAndBrwsr(s, simpleName);
2.18 - } catch (URISyntaxException | InterruptedException ex) {
2.19 + } catch (Exception ex) {
2.20 throw new IOException(ex);
2.21 }
2.22 }
2.23 @@ -124,7 +124,7 @@
2.24 HttpServer s = initServer(dir.getPath(), false);
2.25 try {
2.26 launchServerAndBrwsr(s, startpage);
2.27 - } catch (URISyntaxException | InterruptedException ex) {
2.28 + } catch (Exception ex) {
2.29 throw new IOException(ex);
2.30 }
2.31 }
2.32 @@ -237,7 +237,7 @@
2.33
2.34 conf.addHttpHandler(new HttpHandler() {
2.35 int cnt;
2.36 - List<InvocationContext> cases = new ArrayList<>();
2.37 + List<InvocationContext> cases = new ArrayList<InvocationContext>();
2.38 DynamicResourceHandler prev;
2.39 @Override
2.40 public void service(Request request, Response response) throws Exception {
2.41 @@ -547,7 +547,8 @@
2.42 replace = args;
2.43 }
2.44 OutputStream os = response.getOutputStream();
2.45 - try (InputStream is = res.get(r)) {
2.46 + try {
2.47 + InputStream is = res.get(r);
2.48 copyStream(is, os, request.getRequestURL().toString(), replace);
2.49 } catch (IOException ex) {
2.50 response.setDetailMessage(ex.getLocalizedMessage());
2.51 @@ -603,7 +604,9 @@
2.52 if (res.startsWith("/")) {
2.53 res = res.substring(1);
2.54 }
2.55 - try (InputStream is = loader.get(res)) {
2.56 + InputStream is = null;
2.57 + try {
2.58 + is = loader.get(res);
2.59 response.setContentType("text/javascript");
2.60 Writer w = response.getWriter();
2.61 w.append("[");
2.62 @@ -628,6 +631,10 @@
2.63 response.setStatus(HttpStatus.NOT_FOUND_404);
2.64 response.setError();
2.65 response.setDetailMessage(ex.getMessage());
2.66 + } finally {
2.67 + if (is != null) {
2.68 + is.close();
2.69 + }
2.70 }
2.71 }
2.72 }
3.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/FXBrwsrLauncher.java Tue May 28 21:49:11 2013 +0200
3.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/FXBrwsrLauncher.java Tue May 28 21:49:38 2013 +0200
3.3 @@ -129,8 +129,12 @@
3.4 while (en.hasMoreElements()) {
3.5 URL url = en.nextElement();
3.6 Manifest mf;
3.7 - try (InputStream is = url.openStream()) {
3.8 + InputStream is = null;
3.9 + try {
3.10 + is = url.openStream();
3.11 mf = new Manifest(is);
3.12 + } finally {
3.13 + if (is != null) is.close();
3.14 }
3.15 String sp = mf.getMainAttributes().getValue("StartPage");
3.16 if (sp != null) {
4.1 --- a/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/Console.java Tue May 28 21:49:11 2013 +0200
4.2 +++ b/launcher/fx/src/main/java/org/apidesign/bck2brwsr/launcher/fximpl/Console.java Tue May 28 21:49:38 2013 +0200
4.3 @@ -232,7 +232,9 @@
4.4 if (u == null) {
4.5 throw new IOException("Can't find " + name);
4.6 }
4.7 - try (InputStream is = u.openStream()) {
4.8 + InputStream is = null;
4.9 + try {
4.10 + is = u.openStream();
4.11 byte[] arr;
4.12 arr = new byte[is.available()];
4.13 int offset = 0;
4.14 @@ -244,6 +246,8 @@
4.15 offset += len;
4.16 }
4.17 return arr;
4.18 + } finally {
4.19 + if (is != null) is.close();
4.20 }
4.21 }
4.22