Description
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:
java.io.IOException: Cannot read encrypted files without a password at org.apache.commons.compress.archivers.sevenz.AES256SHA256Decoder$1.init(AES256SHA256Decoder.java:56) at org.apache.commons.compress.archivers.sevenz.AES256SHA256Decoder$1.read(AES256SHA256Decoder.java:112) at java.io.DataInputStream.readUnsignedByte(DataInputStream.java:288) 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(Coders.java:113) at org.apache.commons.compress.archivers.sevenz.Coders.addDecoder(Coders.java:77) at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecoderStack(SevenZFile.java:853) at org.apache.commons.compress.archivers.sevenz.SevenZFile.buildDecodingStream(SevenZFile.java:820) at org.apache.commons.compress.archivers.sevenz.SevenZFile.getNextEntry(SevenZFile.java:151)
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)