类javax.mail.FolderNotFoundException源码实例Demo

下面列出了怎么用javax.mail.FolderNotFoundException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: FairEmail   文件: Core.java
private static void onMove(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message) throws JSONException, FolderNotFoundException {
    // Move message
    DB db = DB.getInstance(context);

    // Get arguments
    long id = jargs.getLong(0);
    boolean seen = jargs.optBoolean(1);
    boolean unflag = jargs.optBoolean(3);

    // Get target folder
    EntityFolder target = db.folder().getFolder(id);
    if (target == null)
        throw new FolderNotFoundException();

    // Move from trash/drafts only
    if (!EntityFolder.TRASH.equals(folder.type) &&
            !EntityFolder.DRAFTS.equals(folder.type))
        throw new IllegalArgumentException("Invalid POP3 folder" +
                " source=" + folder.type + " target=" + target.type);

    message.folder = target.id;
    if (seen)
        message.ui_seen = seen;
    if (unflag)
        message.ui_flagged = false;
    message.ui_hide = false;

    db.message().updateMessage(message);
}
 
源代码2 项目: FairEmail   文件: Core.java
private static void onRaw(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPFolder ifolder) throws MessagingException, IOException, JSONException {
    // Download raw message
    DB db = DB.getInstance(context);

    if (message.raw == null || !message.raw) {
        IMAPMessage imessage = (IMAPMessage) ifolder.getMessageByUID(message.uid);
        if (imessage == null)
            throw new MessageRemovedException();

        File file = message.getRawFile(context);
        try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
            imessage.writeTo(os);
        }

        db.message().setMessageRaw(message.id, true);
    }

    if (jargs.length() > 0) {
        // Cross account move
        long tid = jargs.getLong(0);
        EntityFolder target = db.folder().getFolder(tid);
        if (target == null)
            throw new FolderNotFoundException();

        Log.i(folder.name + " queuing ADD id=" + message.id + ":" + target.id);

        EntityOperation operation = new EntityOperation();
        operation.account = target.account;
        operation.folder = target.id;
        operation.message = message.id;
        operation.name = EntityOperation.ADD;
        operation.args = jargs.toString();
        operation.created = new Date().getTime();
        operation.id = db.operation().insertOperation(operation);
    }
}
 
源代码3 项目: FairEmail   文件: Core.java
void error(Throwable ex) {
    if (ex instanceof MessagingException &&
            ("connection failure".equals(ex.getMessage()) ||
                    "Not connected".equals(ex.getMessage()) || // POP3
                    ex.getCause() instanceof SocketException ||
                    ex.getCause() instanceof ConnectionException))
        recoverable = false;

    if (ex instanceof ConnectionException)
        // failed to create new store connection
        // BYE, Socket is closed
        recoverable = false;

    if (ex instanceof StoreClosedException ||
            ex instanceof FolderClosedException ||
            ex instanceof FolderNotFoundException)
        // Lost folder connection to server
        recoverable = false;

    if (ex instanceof IllegalStateException && (
            "Not connected".equals(ex.getMessage()) ||
                    "This operation is not allowed on a closed folder".equals(ex.getMessage())))
        recoverable = false;

    if (ex instanceof OperationCanceledException)
        recoverable = false;

    thread.interrupt();
    yield();
}
 
源代码4 项目: javamail-mock2   文件: IMAPMockFolder.java
@Override
public synchronized void copyMessages(final Message[] msgs, final Folder folder) throws MessagingException {
    abortIdle();
    checkOpened();
    checkExists();
    if (msgs == null || folder == null || msgs.length == 0) {
        return;
    }

    if (!folder.exists()) {
        throw new FolderNotFoundException(folder.getFullName() + " does not exist", folder);
    }

    folder.appendMessages(msgs);
}
 
源代码5 项目: javamail-mock2   文件: IMAPMockFolder.java
@Override
protected void checkExists() throws MessagingException {
    if (!exists()) {
        throw new FolderNotFoundException(this, getFullName() + " not found");
    }
}
 
 类所在包
 同包方法