{
throw new FolderNotFoundException(this);
}
if( this.mode == Folder.READ_ONLY)
{
throw new IllegalWriteException();
}
Message[] expunged;
synchronized( this)
{
List elist = new ArrayList();
try
{
// delete in new
if( this.newdir.messages != null)
{
int len = this.newdir.messages.length;
for( int i = 0; i < len; i++)
{
MaildirMessage message = this.newdir.messages[i];
if( message.getFlags().contains(Flags.Flag.DELETED))
{
message.file.delete();
elist.add(message);
}
}
}
// delete in cur
if( this.curdir.messages != null)
{
int len = this.curdir.messages.length;
for( int i = 0; i < len; i++)
{
MaildirMessage message = this.curdir.messages[i];
if( message.getFlags().contains(Flags.Flag.DELETED))
{
message.file.delete();
elist.add(message);
}
}
}
}
catch( SecurityException e)
{
throw new IllegalWriteException(e.getMessage());
}
expunged = new Message[elist.size()];
elist.toArray(expunged);
}
if( expunged.length > 0)