This is an automated email from the ASF dual-hosted git repository.

pjfanning pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d0d23e1c80 Optimize getEntry performance in 
ZipInputStreamZipEntrySource using O(1) case-insensitive lookups (#1144)
d0d23e1c80 is described below

commit d0d23e1c8033f25a1999c5f31c5e81d6a1fb2ce5
Author: KALI 834X <[email protected]>
AuthorDate: Mon Jun 15 14:30:55 2026 +0530

    Optimize getEntry performance in ZipInputStreamZipEntrySource using O(1) 
case-insensitive lookups (#1144)
    
    Fixes inconsistent entry lookup behavior in ZipInputStreamZipEntrySource 
and eliminates an unnecessary O(N) fallback scan
    
    Co-authored-by: “sahvx655-wq” <“[email protected]”>
---
 .../poi/openxml4j/util/ZipInputStreamZipEntrySource.java    | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git 
a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
 
b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
index d036906ad2..71be7d3868 100644
--- 
a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
+++ 
b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/util/ZipInputStreamZipEntrySource.java
@@ -164,17 +164,6 @@ public class ZipInputStreamZipEntrySource implements 
ZipEntrySource {
     @Override
     public ZipArchiveEntry getEntry(final String path) {
         final String normalizedPath = IOUtils.normalizePath(path);
-        final ZipArchiveEntry ze = zipEntries.get(normalizedPath);
-        if (ze != null) {
-            return ze;
-        }
-
-        for (final Map.Entry<String, ZipArchiveFakeEntry> fze : 
zipEntries.entrySet()) {
-            if (StringUtil.equalsIgnoreCase(normalizedPath, 
IOUtils.normalizePath(fze.getKey()))) {
-                return fze.getValue();
-            }
-        }
-
-        return null;
+        return zipEntries.get(normalizedPath.toLowerCase(Locale.ROOT));
     }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to