commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [2/6] commons-compress git commit: Provide information about presence of Unicode name and comment in ZipArchiveEntry
Date Fri, 05 Jan 2018 16:54:43 GMT
Provide information about presence of Unicode name and comment in ZipArchiveEntry


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

Branch: refs/heads/COMPRESS-429
Commit: e83b4d8484cdb3dcef44ce3aede866663b526158
Parents: c36fef5
Author: Damiano Albani <damiano.albani@gmail.com>
Authored: Mon Nov 20 16:46:42 2017 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Fri Jan 5 17:25:27 2018 +0100

----------------------------------------------------------------------
 .../compress/archivers/zip/ZipArchiveEntry.java  | 19 ++++++++++++++++++-
 .../commons/compress/archivers/zip/ZipUtil.java  |  2 ++
 2 files changed, 20 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e83b4d84/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
index d744a04..13eae15 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java
@@ -98,7 +98,8 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
     private long localHeaderOffset = OFFSET_UNKNOWN;
     private long dataOffset = OFFSET_UNKNOWN;
     private boolean isStreamContiguous = false;
-
+    private boolean hasUnicodeName = false;
+    private boolean hasUnicodeComment = false;
 
     /**
      * Creates a new zip entry with the specified name.
@@ -927,4 +928,20 @@ public class ZipArchiveEntry extends java.util.zip.ZipEntry
     public void setRawFlag(final int rawFlag) {
         this.rawFlag = rawFlag;
     }
+
+    public boolean hasUnicodeName() {
+        return hasUnicodeName;
+    }
+
+    public void setHasUnicodeName(boolean hasUnicodeName) {
+        this.hasUnicodeName = hasUnicodeName;
+    }
+
+    public boolean hasUnicodeComment() {
+        return hasUnicodeComment;
+    }
+
+    public void setHasUnicodeComment(boolean hasUnicodeComment) {
+        this.hasUnicodeComment = hasUnicodeComment;
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/e83b4d84/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 97fd341..11f7315 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
@@ -239,6 +239,7 @@ public abstract class ZipUtil {
                                                            originalNameBytes);
         if (newName != null && !originalName.equals(newName)) {
             ze.setName(newName);
+            ze.setHasUnicodeName(true);
         }
 
         if (commentBytes != null && commentBytes.length > 0) {
@@ -248,6 +249,7 @@ public abstract class ZipUtil {
                 getUnicodeStringIfOriginalMatches(cmt, commentBytes);
             if (newComment != null) {
                 ze.setComment(newComment);
+                ze.setHasUnicodeComment(true);
             }
         }
     }


Mime
View raw message