commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <>
Subject [jira] [Resolved] (COMPRESS-298) Cleaner way to catch/detect Seven7 files which are password protected
Date Tue, 20 Jan 2015 14:28:34 GMT


Stefan Bodewig resolved COMPRESS-298.
       Resolution: Fixed
    Fix Version/s: 1.10

The way SevenZFile is coded it is difficult to provide a canReadEntryData method like we've
got for ZipFile, so right now throwing a special exception seems to be the best solution.

svn revision 1653252

> Cleaner way to catch/detect Seven7 files which are password protected
> ---------------------------------------------------------------------
>                 Key: COMPRESS-298
>                 URL:
>             Project: Commons Compress
>          Issue Type: Improvement
>          Components: Archivers
>    Affects Versions: 1.8.1
>            Reporter: Nick Burch
>             Fix For: 1.10
> Currently, if we open a password protected 7z file and call {{getNextEntry()}} on it,
it will blow up with an IOException with a specific string:
> {code}
> Cannot read encrypted files without a password
> 	at org.apache.commons.compress.archivers.sevenz.AES256SHA256Decoder$1.init(
> 	at org.apache.commons.compress.archivers.sevenz.AES256SHA256Decoder$
> 	at
> 	at org.tukaani.xz.rangecoder.RangeDecoderFromStream.<init>(Unknown Source)
> 	at org.tukaani.xz.LZMAInputStream.initialize(Unknown Source)
> 	at org.tukaani.xz.LZMAInputStream.initialize(Unknown Source)
> 	at org.tukaani.xz.LZMAInputStream.<init>(Unknown Source)
> 	at org.apache.commons.compress.archivers.sevenz.Coders$LZMADecoder.decode(
> 	at org.apache.commons.compress.archivers.sevenz.Coders.addDecoder(
> 	at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecoderStack(
> 	at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecodingStream(
> 	at org.apache.commons.compress.archivers.sevenz.SevenZFile.getNextEntry(
> {code}
> It would be good if either a specific subtype of IOException could be thrown (which could
then be caught to differentiate this from other kinds of IO problems), or if a method could
be added to SevenZFile which could be called to see if a password is needed / given password
is correct
> (If implemented, this would help make the code in Tika dealing with 7z files cleaner)

This message was sent by Atlassian JIRA

View raw message