WarDistribution: Don't bail out when scanning corrupted jar file
Instead of bailing out when corrupted jar file is scanned during gerrit init or startup step, log error message and proceed with other plugins. Change-Id: I91a9beb24c52750d09f81a1256166d681ec83b5e Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
This commit is contained in:
parent
4bb459957c
commit
5e9622a6d4
|
@ -28,12 +28,15 @@ import java.util.Enumeration;
|
|||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Singleton
|
||||
public class WarDistribution implements PluginsDistribution {
|
||||
private static final Logger log = LoggerFactory.getLogger(WarDistribution.class);
|
||||
|
||||
@Override
|
||||
public void foreach(Processor processor) throws FileNotFoundException, IOException {
|
||||
public void foreach(Processor processor) throws IOException {
|
||||
File myWar = GerritLauncher.getDistributionArchive();
|
||||
if (myWar.isFile()) {
|
||||
try (ZipFile zf = new ZipFile(myWar)) {
|
||||
|
@ -49,6 +52,9 @@ public class WarDistribution implements PluginsDistribution {
|
|||
String pluginName = pluginJarName.substring(0, pluginJarName.length() - JAR.length());
|
||||
try (InputStream in = zf.getInputStream(ze)) {
|
||||
processor.process(pluginName, in);
|
||||
} catch (IOException ioe) {
|
||||
log.error(
|
||||
String.format("Error opening plugin %s: %s", ze.getName(), ioe.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue