From f502f3f124de37be0615ee08b1bd83b9d33cd9aa Mon Sep 17 00:00:00 2001 From: Hiroshi Miura Date: Sun, 24 Nov 2024 21:46:40 +0900 Subject: [PATCH] fix: OmegaT failed to start when malformed jar in plugin folder (#1196) - Fix BUGS#1276 OmegaT failed to start if there are 'jar' file w/o manifest in plugin folder Signed-off-by: Hiroshi Miura --- src/org/omegat/filters2/master/PluginUtils.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/org/omegat/filters2/master/PluginUtils.java b/src/org/omegat/filters2/master/PluginUtils.java index eef3e66036..a217f1b2d4 100644 --- a/src/org/omegat/filters2/master/PluginUtils.java +++ b/src/org/omegat/filters2/master/PluginUtils.java @@ -328,6 +328,10 @@ protected static List populatePluginUrlList(List pluginsDirs) { for (URL url : urlList) { try (JarInputStream jarStream = new JarInputStream(url.openStream())) { Manifest mf = jarStream.getManifest(); + if (mf == null) { + // mf can be null when a jar file does not have a manifest. + continue; + } String pluginClass = mf.getMainAttributes().getValue(OMEGAT_PLUGINS); String oldPluginClass = mf.getMainAttributes().getValue(OMEGAT_PLUGIN);