Remove plugin entry .jar suffix when manifest is not found

When the MANIFEST.MF cannot be found in the release.war, assume
the entry name without the .jar suffix as plugin name.

Change-Id: I0db39f42c33d87f739ce94cf2ce5e4d2372ab0f2
diff --git a/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java b/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
index 8e96e6a..d766281 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/manager/repository/CorePluginsRepository.java
@@ -82,7 +82,11 @@
                 pluginUrl.toString());
           }
           return new PluginInfo(
-              entryName.getFileName().toString(), "", "", "", pluginUrl.toString());
+              dropSuffix(entryName.getFileName().toString(), ".jar"),
+              "",
+              "",
+              "",
+              pluginUrl.toString());
         } catch (IOException e) {
           log.error("Unable to open plugin " + pluginUrl, e);
           return null;
@@ -93,6 +97,12 @@
       }
     }
 
+    private String dropSuffix(String string, String suffix) {
+      return string.endsWith(suffix)
+          ? string.substring(0, string.length() - suffix.length())
+          : string;
+    }
+
     private Manifest getManifestEntry(JarInputStream pluginJar) throws IOException {
       for (JarEntry entry = pluginJar.getNextJarEntry();
           entry != null;