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/05/09 10:42:26 UTC

[6/6] commons-compress git commit: COMPRESS-452 document new constructors

COMPRESS-452 document new constructors


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

Branch: refs/heads/master
Commit: 34cf64fac1218c5112e551e686a1a5f1a7c80c32
Parents: bafc8e7
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed May 9 12:41:55 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed May 9 12:41:55 2018 +0200

----------------------------------------------------------------------
 src/changes/changes.xml    | 10 ++++++++++
 src/site/xdoc/examples.xml | 17 ++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/34cf64fa/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 37da29a..316a074 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -81,6 +81,16 @@ The <action> type attribute can be add,update,fix,remove.
       <action issue="COMPRESS-451" type="fix" date="2018-05-04">
         IOUtils.copy now verifies the buffer size is bigger than 0.
       </action>
+      <action issue="COMPRESS-452" type="add" date="2018-05-09">
+        New constructors have been added to <code>SevenZFile</code>
+        that accept <code>char[]</code>s rather than
+        <code>byte[]</code>s in order to avoid a common error of using
+        the wrong encoding when creating the <code>byte[]</code>.
+        This change may break source compatibility for client code
+        that uses one of the constructors expecting a password and
+        passes in <code>null</code> as password. We recommend to
+        change the code to use a constructor without password argument.
+      </action>
     </release>
     <release version="1.16.1" date="2018-02-10"
              description="Release 1.16.1">

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/34cf64fa/src/site/xdoc/examples.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/examples.xml b/src/site/xdoc/examples.xml
index 2d5bbe8..dc5184d 100644
--- a/src/site/xdoc/examples.xml
+++ b/src/site/xdoc/examples.xml
@@ -391,7 +391,22 @@ LOOP UNTIL entry.getSize() HAS BEEN READ {
     sevenZFile.read(content, offset, content.length - offset);
 }
 ]]></source>
-        </subsection>
+
+        <p>Starting with Compress 1.17 new constructors have been
+        added that accept the password as <code>char[]</code> rather
+        than a <code>byte[]</code>. We recommend you use these in
+        order to avoid the problem above.</p>
+
+<source><![CDATA[
+SevenZFile sevenZFile = new SevenZFile(new File("archive.7z"), "secret".toCharArray());
+SevenZArchiveEntry entry = sevenZFile.getNextEntry();
+byte[] content = new byte[entry.getSize()];
+LOOP UNTIL entry.getSize() HAS BEEN READ {
+    sevenZFile.read(content, offset, content.length - offset);
+}
+]]></source>
+
+      </subsection>
 
       <subsection name="ar">