Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74c6e764 authored by cketti's avatar cketti
Browse files

Merge pull request #1210 from k9mail/GH-1164_fix_preview_extraction_failure

Handle preview extraction failures
parents 9bacb2d5 31235ae3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ import com.fsck.k9.message.preview.PreviewResult.PreviewType;
public enum DatabasePreviewType {
    NONE("none", PreviewType.NONE),
    TEXT("text", PreviewType.TEXT),
    ENCRYPTED("encrypted", PreviewType.ENCRYPTED);
    ENCRYPTED("encrypted", PreviewType.ENCRYPTED),
    ERROR("error", PreviewType.ERROR);


    private final String databaseValue;
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ public class LocalStore extends Store implements Serializable {
     */
    private static final int THREAD_FLAG_UPDATE_BATCH_SIZE = 500;

    public static final int DB_VERSION = 54;
    public static final int DB_VERSION = 55;


    public static String getColumnNameForFlag(Flag flag) {
+6 −2
Original line number Diff line number Diff line
@@ -41,8 +41,12 @@ public class MessagePreviewCreator {
            return PreviewResult.none();
        }

        try {
            String previewText = previewTextExtractor.extractPreview(textPart);
            return PreviewResult.text(previewText);
        } catch (PreviewExtractionException e) {
            return PreviewResult.error();
        }
    }

    private boolean hasEmptyBody(Part textPart) {
+8 −0
Original line number Diff line number Diff line
package com.fsck.k9.message.preview;


class PreviewExtractionException extends Exception {
    public PreviewExtractionException(String detailMessage) {
        super(detailMessage);
    }
}
+6 −1
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ public class PreviewResult {
        return new PreviewResult(PreviewType.NONE, null);
    }

    public static PreviewResult error() {
        return new PreviewResult(PreviewType.ERROR, null);
    }

    public PreviewType getPreviewType() {
        return previewType;
    }
@@ -46,6 +50,7 @@ public class PreviewResult {
    public enum PreviewType {
        NONE,
        TEXT,
        ENCRYPTED
        ENCRYPTED,
        ERROR
    }
}
Loading