Source:
<code>private Plugin loadPlugin(String name, File srcJar, FileSnapshot snapshot) throws IOException, ClassNotFoundException, InvalidPluginException { File tmp; FileInputStream in = new FileInputStream(srcJar); try { tmp = asTemp(in, tempNameFor(name), ".jar", tmpDir); } finally { in.close(); } JarFile jarFile = new JarFile(tmp); boolean keep = false; try { Manifest manifest = jarFile.getManifest(); Plugin.ApiType type = Plugin.getApiType(manifest); Attributes main = manifest.getMainAttributes(); String sysName = main.getValue("Gerrit-Module"); String sshName = main.getValue("Gerrit-SshModule"); String httpName = main.getValue("Gerrit-HttpModule"); if (!Strings.isNullOrEmpty(sshName) && type != Plugin.ApiType.PLUGIN) { throw new InvalidPluginException(String.format( "Using Gerrit-SshModule requires Gerrit-ApiType: %s", Plugin.ApiType.PLUGIN)); } URL[] urls = {tmp.toURI().toURL()}; ClassLoader parentLoader = parentFor(type); ClassLoader pluginLoader = new URLClassLoader(urls, parentLoader); Class<? extends Module> sysModule = load(sysName, pluginLoader); Class<? extends Module> sshModule = load(sshName, pluginLoader); Class<? extends Module> httpModule = load(httpName, pluginLoader); String url; url = urlProvider.get(); if (!url.endsWith("/")) { url = url + "/"; } <START> url = url + name; <END> Plugin plugin = new JarPlugin(name, url, pluginUserFactory.create(name), srcJar, snapshot, jarFile, manifest, new File(dataDir, name), type, pluginLoader, sysModule, sshModule, httpModule); cleanupHandles.put(plugin, new CleanupHandle(tmp, jarFile)); keep = true; return plugin; } finally { if (!keep) { jarFile.close(); } } }</code><technical_language>nit: done shorter String url = String.format("%s/%s", CharMatcher.is('/').trimTrailingFrom(urlProvider.get()), name); define url var inline statement line 520</technical_language>

Target:
private Plugin loadPlugin(String name, File srcJar, FileSnapshot snapshot) throws IOException, ClassNotFoundException, InvalidPluginException { File tmp; FileInputStream in = new FileInputStream(srcJar); try { tmp = asTemp(in, tempNameFor(name), ".jar", tmpDir); } finally { in.close(); } JarFile jarFile = new JarFile(tmp); boolean keep = false; try { Manifest manifest = jarFile.getManifest(); Plugin.ApiType type = Plugin.getApiType(manifest); Attributes main = manifest.getMainAttributes(); String sysName = main.getValue("Gerrit-Module"); String sshName = main.getValue("Gerrit-SshModule"); String httpName = main.getValue("Gerrit-HttpModule"); if (!Strings.isNullOrEmpty(sshName) && type != Plugin.ApiType.PLUGIN) { throw new InvalidPluginException(String.format( "Using Gerrit-SshModule requires Gerrit-ApiType: %s", Plugin.ApiType.PLUGIN)); } URL[] urls = {tmp.toURI().toURL()}; ClassLoader parentLoader = parentFor(type); ClassLoader pluginLoader = new URLClassLoader(urls, parentLoader); Class<? extends Module> sysModule = load(sysName, pluginLoader); Class<? extends Module> sshModule = load(sshName, pluginLoader); Class<? extends Module> httpModule = load(httpName, pluginLoader); String url = String.format("%s/%s", CharMatcher.is('/').trimTrailingFrom(urlProvider.get()), name); Plugin plugin = new JarPlugin(name, url, pluginUserFactory.create(name), srcJar, snapshot, jarFile, manifest, new File(dataDir, name), type, pluginLoader, sysModule, sshModule, httpModule); cleanupHandles.put(plugin, new CleanupHandle(tmp, jarFile)); keep = true; return plugin; } finally { if (!keep) { jarFile.close(); } } }