Fix core plugin name extractions without MANIFEST.MF

When MANIFEST.MF is missing or is incomplete, extract the
plugin name by dropping the extension of the .jar file of
the plugin contained in release.war.

Change-Id: I2f89e4d3d674602e15c4e1bc281c61c9345df8c7
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..6e18bee 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
@@ -17,6 +17,7 @@
 import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 import com.google.common.collect.FluentIterable;
+import com.google.common.io.Files;
 import com.google.gerrit.common.Version;
 import com.google.gerrit.server.config.SitePaths;
 import com.google.inject.Inject;
@@ -82,7 +83,11 @@
                 pluginUrl.toString());
           }
           return new PluginInfo(
-              entryName.getFileName().toString(), "", "", "", pluginUrl.toString());
+              dropFileExtension(entryName.getFileName().toString()),
+              "",
+              "",
+              "",
+              pluginUrl.toString());
         } catch (IOException e) {
           log.error("Unable to open plugin " + pluginUrl, e);
           return null;
@@ -93,6 +98,11 @@
       }
     }
 
+    private String dropFileExtension(String fileName) {
+      String extension = Files.getFileExtension(fileName);
+      return fileName.substring(0, fileName.length() - extension.length() - 1);
+    }
+
     private Manifest getManifestEntry(JarInputStream pluginJar) throws IOException {
       for (JarEntry entry = pluginJar.getNextJarEntry();
           entry != null;