You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2018/01/07 09:34:22 UTC

[8/9] commons-compress git commit: COMPRESS-429 set namesource to extra field even if names match

COMPRESS-429 set namesource to extra field even if names match


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/c2906092
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/c2906092
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/c2906092

Branch: refs/heads/master
Commit: c2906092f9fab7bb718ba177d521ae152d4d9f1c
Parents: eb32d62
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Jan 7 10:22:25 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Jan 7 10:22:25 2018 +0100

----------------------------------------------------------------------
 .../org/apache/commons/compress/archivers/zip/ZipUtil.java     | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c2906092/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
index 6342cd1..783835c 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipUtil.java
@@ -237,8 +237,10 @@ public abstract class ZipUtil {
         final String originalName = ze.getName();
         final String newName = getUnicodeStringIfOriginalMatches(name,
                                                            originalNameBytes);
-        if (newName != null && !originalName.equals(newName)) {
-            ze.setName(newName);
+        if (newName != null) {
+            if (!originalName.equals(newName)) {
+                ze.setName(newName);
+            }
             ze.setNameSource(ZipArchiveEntry.NameSource.UNICODE_EXTRA_FIELD);
         }