Examples of MailboxException


Examples of org.apache.james.mailbox.MailboxException

                 messages.add(new MaildirMessage(mailbox, uid, messageName));
             }
             return messages;

        } catch (IOException e) {
            throw new MailboxException("Failure while search for Message with uid " + uid + " in Mailbox " + mailbox, e );
        }
    }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

            for (Entry<Long, MaildirMessageName> entry : uidMap.entrySet()) {
                messages.add(new MaildirMessage(mailbox, entry.getKey(), entry.getValue()));
            }
            return messages;
        } catch (IOException e) {
            throw new MailboxException("Failure while search for Messages in Mailbox " + mailbox, e );
        }
      
    }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

            ArrayList<Message<Integer>> filtered = new ArrayList<Message<Integer>>(uidMap.size());
            for (Entry<Long, MaildirMessageName> entry : uidMap.entrySet())
                filtered.add(new MaildirMessage(mailbox, entry.getKey(), entry.getValue()));
            return filtered;
        } catch (IOException e) {
            throw new MailboxException("Failure while search for Messages in Mailbox " + mailbox, e );
        }
      
    }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

                 messages.add(new MaildirMessage(mailbox, uid, messageName));
             }
             return messages;

        } catch (IOException e) {
            throw new MailboxException("Failure while search for Messages in Mailbox " + mailbox, e );
        }
      
    }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

            byte[] b = new byte[BUF_SIZE];
            int len = 0;
            while ((len = input.read(b)) != -1)
                fos.write(b, 0, len);
        } catch (IOException ioe) {
            throw new MailboxException("Failure while save Message " + message + " in Mailbox " + mailbox, ioe);
        } finally {
            try {
                if (fos != null)
                    fos.close();
            } catch (IOException e) {
            }
            try {
                if (input != null)
                    input.close();
            } catch (IOException e) {
            }
        }
        File newMessageFile = null;
        // delivered via SMTP, goes to ./new without flags
        if (message.isRecent()) {
            messageName.setFlags(message.createFlags());
            newMessageFile = new File(folder.getNewFolder(), messageName.getFullName());
            // System.out.println("save new recent " + message + " as " +
            // newMessageFile.getName());
        }
        // appended via IMAP (might already have flags etc, goes to ./cur
        // directly)
        else {
            messageName.setFlags(message.createFlags());
            newMessageFile = new File(folder.getCurFolder(), messageName.getFullName());
            // System.out.println("save new not recent " + message + " as "
            // + newMessageFile.getName());
        }
        try {
            FileUtils.moveFile(messageFile, newMessageFile);
        } catch (IOException e) {
            // TODO: Try copy and delete
            throw new MailboxException("Failure while save Message " + message + " in Mailbox " + mailbox, e);
        }
        try {
            uid = folder.appendMessage(mailboxSession, newMessageFile.getName());
            message.setUid(uid);
            message.setModSeq(newMessageFile.lastModified());
            return new SimpleMessageMetaData(message);
        } catch (MailboxException e) {
            throw new MailboxException("Failure while save Message " + message + " in Mailbox " + mailbox, e);
        }

    }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

                        updatedFlags.add(new UpdatedFlags(member.getUid(), modSeq, originalFlags, newFlags));

                        long uid = member.getUid();
                        folder.update(mailboxSession, uid, newMessageName);
                    } catch (IOException e) {
                        throw new MailboxException("Failure while save Message " + member + " in Mailbox " + mailbox, e);
                    }

                }

            }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

        try {
            Session s = repository.login(mailboxSession);
            Node node = s.getNodeByIdentifier(mailbox.getMailboxId());
            return node.getProperty(JCRMailbox.LASTUID_PROPERTY).getLong();
        } catch (RepositoryException e) {
            throw new MailboxException("Unable to get last uid for mailbox " + mailbox, e);
        }
       
    }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

            uid++;
            node.setProperty(JCRMailbox.LASTUID_PROPERTY, uid);
            s.save();
            return uid;
        } catch (RepositoryException e) {
            throw new MailboxException("Unable to consume next uid for mailbox " + mailbox, e);
        }
    }
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

            Map<Long, MessageMetaData> uids = new HashMap<Long, MessageMetaData>();
            uids.put(data.getUid(), data);
            dispatcher.added(mailboxSession, uids, getMailboxEntity());
            return data.getUid();
        } catch (IOException e) {
            throw new MailboxException("Unable to parse message", e);
        } catch (MimeException e) {
            throw new MailboxException("Unable to parse message", e);
        } catch (MailboxException e) {
            throw new MailboxException("Unable to parse message", e);
        } finally {
            IOUtils.closeQuietly(bIn);
            IOUtils.closeQuietly(tmpMsgIn);
            IOUtils.closeQuietly(out);
            IOUtils.closeQuietly(contentIn);
View Full Code Here

Examples of org.apache.james.mailbox.MailboxException

            Map<Long, MessageMetaData> copiedUids = copy(set, toMailbox, session);
            dispatcher.added(session, copiedUids, toMailbox.getMailboxEntity());

            return MessageRange.toRanges(new ArrayList<Long>(copiedUids.keySet()));
        } catch (MailboxException e) {
            throw new MailboxException("Unable to parse message", e);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.