Lucas Werkmeister created COMPRESS-317: ------------------------------------------
Summary: ArrayIndexOutOfBoundsException in ZipArchiveEntry.getMergedFields() Key: COMPRESS-317 URL: https://issues.apache.org/jira/browse/COMPRESS-317 Project: Commons Compress Issue Type: Bug Components: Archivers Reporter: Lucas Werkmeister Priority: Minor {{src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveEntry.java}} contains the following at line 380 in {{getMergedFields()}}: {code:java} zipExtraFields[zipExtraFields.length] = unparseableExtra; {code} This will cause an {{ArrayIndexOutOfBoundsException}} when reached. Note that Apache Ant inherited this bug with commit [{{2c04d7e}}|https://git-wip-us.apache.org/repos/asf?p=ant.git;a=commitdiff;h=2c04d7e833b4e5dab1a3c5ddfe14b572aea8c112], which is where I found it; a fix should be ported there too. (The class is called just {{ZipEntry}} there; full path: {{src/main/org/apache/tools/zip/ZipEntry.java}}) The correct line is probably one of the following: {code:java} zipExtraFields[zipExtraFields.length - 1] = unparseableExtra; zipExtraFields[extraFields.length] = unparseableExtra; {code} They should be equivalent because of the line immediately above line 380, which crease {{zipExtraFields}} as copy of {{extraFields}} that is one element longer. It might be worth noting that line 411 of {{ZipArchiveEntry}} uses {{zipExtraFields.length - 1}}, while line 411 of Ant's {{ZipEntry}} uses {{extraFields.length}}. -- This message was sent by Atlassian JIRA (v6.3.4#6332)