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/436a2ce3 Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/436a2ce3 Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/436a2ce3 Branch: refs/heads/master Commit: 436a2ce3111d019a98a8615bb83dd93091b3a0a5 Parents: 763c383 Author: Stefan Bodewig <bode...@apache.org> Authored: Mon May 7 07:47:21 2018 +0200 Committer: Stefan Bodewig <bode...@apache.org> Committed: Wed May 9 12:35:49 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/436a2ce3/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; }