@Test public void testWithNotGlowrootJar() throws Exception { File glowrootJar = new File("x/classes"); CodeSource codeSource = new CodeSource(glowrootJar.toURI().toURL(), new Certificate[0]); assertThat(ToolMain.getGlowrootJarFile(codeSource)).isNull(); }
@VisibleForTesting static @Nullable File getGlowrootJarFile(@Nullable CodeSource codeSource) throws URISyntaxException { if (codeSource == null) { return null; } File codeSourceFile = new File(codeSource.getLocation().toURI()); if (codeSourceFile.getName().endsWith(".jar")) { return codeSourceFile; } return null; }
ToolMain { @VisibleForTesting static @Nullable File getGlowrootJarFile(@Nullable CodeSource codeSource) throws URISyntaxException { if (codeSource == null) { return null; } File codeSourceFile = new File(codeSource.getLocation().toURI()); if (codeSourceFile.getName().endsWith(".jar")) { return codeSourceFile; } return null; } }
ToolMain { @VisibleForTesting static @Nullable File getGlowrootJarFile(@Nullable CodeSource codeSource) throws URISyntaxException { if (codeSource == null) { return null; } File codeSourceFile = new File(codeSource.getLocation().toURI()); if (codeSourceFile.getName().endsWith(".jar")) { return codeSourceFile; } return null; } private  ToolMain(); }
ToolMain { @VisibleForTesting static @Nullable File getGlowrootJarFile(@Nullable CodeSource codeSource) throws URISyntaxException { if (codeSource == null) { return null; } File codeSourceFile = new File(codeSource.getLocation().toURI()); if (codeSourceFile.getName().endsWith(".jar")) { return codeSourceFile; } return null; } private  ToolMain(); static void main(String[] args, @Nullable File glowrootJarFile); }
ToolMain { @VisibleForTesting static @Nullable File getGlowrootJarFile(@Nullable CodeSource codeSource) throws URISyntaxException { if (codeSource == null) { return null; } File codeSourceFile = new File(codeSource.getLocation().toURI()); if (codeSourceFile.getName().endsWith(".jar")) { return codeSourceFile; } return null; } private  ToolMain(); static void main(String[] args, @Nullable File glowrootJarFile);  }