Improved unzip error message

pull/207/head
M66B 3 years ago
parent 4b6e8dda2f
commit a75335e67d

@ -51,6 +51,7 @@ import com.sun.mail.util.FolderClosedIOException;
import com.sun.mail.util.MessageRemovedIOException; import com.sun.mail.util.MessageRemovedIOException;
import org.apache.commons.compress.archivers.ArchiveEntry; import org.apache.commons.compress.archivers.ArchiveEntry;
import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.archivers.ArchiveInputStream; import org.apache.commons.compress.archivers.ArchiveInputStream;
import org.apache.commons.compress.archivers.ArchiveStreamFactory; import org.apache.commons.compress.archivers.ArchiveStreamFactory;
import org.apache.commons.compress.archivers.zip.UnsupportedZipFeatureException; import org.apache.commons.compress.archivers.zip.UnsupportedZipFeatureException;
@ -3383,7 +3384,10 @@ public class MessageHelper {
} }
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
db.attachment().setWarning(local.id, Log.formatThrowable(ex)); if (ex instanceof ArchiveException)
db.attachment().setWarning(local.id, ex.getMessage());
else
db.attachment().setWarning(local.id, Log.formatThrowable(ex));
} }
else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && local.isCompressed()) { else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && local.isCompressed()) {
@ -3531,8 +3535,10 @@ public class MessageHelper {
} }
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
// Unsupported feature encryption used in entry ... // ArchiveException: Unsupported feature encryption used in entry ...
if (ex instanceof UnsupportedZipFeatureException) // UnsupportedZipFeatureException: No Archiver found for the stream signature
if (ex instanceof ArchiveException ||
ex instanceof UnsupportedZipFeatureException)
db.attachment().setWarning(local.id, ex.getMessage()); db.attachment().setWarning(local.id, ex.getMessage());
else else
db.attachment().setWarning(local.id, Log.formatThrowable(ex)); db.attachment().setWarning(local.id, Log.formatThrowable(ex));

Loading…
Cancel
Save