IDEMPIERE-2864 Alert Processor vs Attachment File system can't send EMails properly

This commit is contained in:
tsvikruha 2015-10-03 08:26:46 -05:00
parent ce07ca20db
commit 383c35dc4a
3 changed files with 16 additions and 1 deletions

View File

@ -93,11 +93,12 @@ public class AttachmentFileSystem implements IAttachmentStore {
in.transferTo(0, in.size(), out); in.transferTo(0, in.size(), out);
in.close(); in.close();
out.close(); out.close();
/* IDEMPIERE-2864
if(entryFile.exists()){ if(entryFile.exists()){
if(!entryFile.delete()){ if(!entryFile.delete()){
entryFile.deleteOnExit(); entryFile.deleteOnExit();
} }
} }*/
entryFile = destFile; entryFile = destFile;
} catch (IOException e) { } catch (IOException e) {

View File

@ -228,6 +228,13 @@ public class AlertProcessor extends AdempiereServer
Collection<Integer> users = alert.getRecipientUsers(); Collection<Integer> users = alert.getRecipientUsers();
int countMail = notifyUsers(users, alert.getAlertSubject(), message.toString(), attachments); int countMail = notifyUsers(users, alert.getAlertSubject(), message.toString(), attachments);
// IDEMPIERE-2864
for(File attachment : attachments)
{
if(attachment.exists() && !attachment.delete())
attachment.deleteOnExit();
}
m_summary.append(alert.getName()).append(" (EMails+Notes=").append(countMail).append(") - "); m_summary.append(alert.getName()).append(" (EMails+Notes=").append(countMail).append(") - ");
return valid; return valid;
} // processAlert } // processAlert

View File

@ -277,6 +277,13 @@ public class Scheduler extends AdempiereServer
} }
} }
// IDEMPIERE-2864
for(File file : fileList)
{
if(file.exists() && !file.delete())
file.deleteOnExit();
}
} }
return pi.getSummary(); return pi.getSummary();