# HG changeset patch # User Jaroslav Tulach # Date 1426016120 -3600 # Node ID 68c0229e193e1a2b59dd625da708cafb818e715b # Parent 6083160bfccff0074903cb41b7c8e6c346b6a8e4 More defensive type-checks. diff -r 6083160bfccf -r 68c0229e193e launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java --- a/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java Tue Mar 10 20:18:55 2015 +0100 +++ b/launcher/http/src/main/java/org/apidesign/bck2brwsr/launcher/CompileCP.java Tue Mar 10 20:35:20 2015 +0100 @@ -18,12 +18,14 @@ package org.apidesign.bck2brwsr.launcher; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.StringWriter; import java.net.JarURLConnection; import java.net.URISyntaxException; import java.net.URL; +import java.net.URLConnection; import java.util.Set; import java.util.logging.Logger; import org.apidesign.bck2brwsr.aot.Bck2BrwsrJars; @@ -95,8 +97,13 @@ if (u == null) { throw new IOException("Cannot find InterruptedException class on classpath: " + System.getProperty("java.class.path")); } - JarURLConnection juc = (JarURLConnection)u.openConnection(); - rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI())); + final URLConnection conn = u.openConnection(); + if (conn instanceof JarURLConnection) { + JarURLConnection juc = (JarURLConnection)conn; + rt = Bck2BrwsrJars.configureFrom(null, new File(juc.getJarFileURL().toURI())); + } else { + throw new FileNotFoundException("Not a JAR URL: " + u); + } } catch (URISyntaxException ex) { throw new IOException(ex); }