if ( record.isDeleted() ) {
throw new MailboxException( "Mailbox has been deleted", MailboxException.LOCAL_BUT_DELETED );
} else if ( openMailboxes.contains( absoluteName ) ) {
mailbox = openMailboxes.getMailbox( absoluteName );
if ( ! mailbox.hasLookupRights( user ) ) {
throw new AccessControlException( "No lookup rights." );
}
openMailboxes.addReference( absoluteName );
return mailbox;
} else {
String owner = record.getUser();
String key = getPath( absoluteName );
ObjectInputStream in = null;
try {
// SK:UPDATE
in = new ObjectInputStream( new FileInputStream( key + File.separator + FileMailbox.MAILBOX_FILE_NAME ) );
mailbox = (FileMailbox) in.readObject();
setupLogger( mailbox );
mailbox.configure( conf );
mailbox.contextualize( context );
mailbox.compose( compMgr );
mailbox.reinitialize();
} catch ( Exception e ) {
e.printStackTrace();
throw new RuntimeException( "Exception caught while reading FileMailbox: " + e );
} finally {
if ( in != null ) {
try {
in.close();
}
catch ( Exception ignored ) {
}
}
notifyAll();
}
if ( !mailbox.hasLookupRights( user ) ) {
throw new AccessControlException( "No lookup rights." );
}
openMailboxes.addMailbox( absoluteName, mailbox );
return mailbox;
}
}