From 0885d16ac22a0ecd2267bf3c8818a3a8a5a9dadb Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Fri, 31 Jul 2026 07:48:54 +0000
Subject: [PATCH] Fix CodeQL warning-severity alerts: missed wakeups, resource leaks, escaping threads (#790)
---
opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
index fe3542d..883f3fb 100644
--- a/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/quicksetup/util/ZipExtractor.java
@@ -100,15 +100,22 @@
Application app)
throws FileNotFoundException, IllegalArgumentException
{
- this(new FileInputStream(zipFile),
+ // The name is validated before the stream is opened, otherwise the stream would leak when the
+ // validation fails.
+ this(openZipFile(zipFile),
minRatio,
maxRatio,
numberZipEntries,
zipFile.getName(),
app);
+ }
+
+ private static FileInputStream openZipFile(File zipFile) throws FileNotFoundException
+ {
if (!zipFile.getName().endsWith(".zip")) {
throw new IllegalArgumentException("File must have extension .zip");
}
+ return new FileInputStream(zipFile);
}
/**
--
Gitblit v1.10.0