use Arrays.copyOf
Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/3eeb22cd Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/3eeb22cd Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/3eeb22cd Branch: refs/heads/COMPRESS-452 Commit: 3eeb22cd6d890067c86cac12608ef7177cb3d1b5 Parents: 81398f6 Author: Stefan Bodewig <bode...@apache.org> Authored: Mon May 7 07:47:21 2018 +0200 Committer: Stefan Bodewig <bode...@apache.org> Committed: Mon May 7 16:25:46 2018 +0200 ---------------------------------------------------------------------- .../org/apache/commons/compress/archivers/sevenz/SevenZFile.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-compress/blob/3eeb22cd/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java index 14d33d4..6690847 100644 --- a/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java +++ b/src/main/java/org/apache/commons/compress/archivers/sevenz/SevenZFile.java @@ -169,8 +169,7 @@ public class SevenZFile implements Closeable { try { archive = readHeaders(password); if (password != null) { - this.password = new byte[password.length]; - System.arraycopy(password, 0, this.password, 0, password.length); + this.password = Arrays.copyOf(password, password.length); } else { this.password = null; }