out.close();
// increase the message count for the current mailbox
mailboxes.incrementColumnValue(mailboxRowKey(mailbox.getMailboxId()), MAILBOX_CF, MAILBOX_MESSAGE_COUNT, 1);
return new SimpleMessageMetaData(message);
} catch (IOException ex) {
throw new MailboxException("Error setting flags for messages in " + mailbox, ex);
} finally {
if (messages != null) {
try {
messages.close();
} catch (IOException ex) {
throw new MailboxException("Error closing table " + messages, ex);
}
}
if (mailboxes != null) {
try {
mailboxes.close();
} catch (IOException ex) {
throw new MailboxException("Error closing table " + mailboxes, ex);
}
}
if (in != null) {
try {
in.close();
} catch (IOException ex) {
throw new MailboxException("Error closing Inputtream", ex);
}
}
if (out != null) {
try {
out.close();
} catch (IOException ex) {
throw new MailboxException("Error closing OutputStream", ex);
}
}
}
}