This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 2ccf5e3e345957d76cb3e9a29eb0160b66a206e3 Author: Kevin Morin <morin@codelutin.com> Date: Fri Jan 23 11:04:09 2015 +0100 fixes #6346 Erreur à l'archivage suppression du fichier EDI en cours de création quand il y a une erreur et qu'il n'est pas complet --- .../services/service/EmailServiceImpl.java | 2 ++ .../faxtomail/ui/swing/actions/ArchiveAction.java | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java index dda7c27..c782dd0 100644 --- a/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java +++ b/faxtomail-service/src/main/java/com/franciaflex/faxtomail/services/service/EmailServiceImpl.java @@ -689,6 +689,8 @@ public class EmailServiceImpl extends FaxToMailServiceSupport implements EmailSe ediWriter.write("%END_ENTETE_QUOTE\n"); } catch (IOException ex) { + //delete file if error, to avoid having unusable files + FileUtils.deleteQuietly(ediFile); throw new RuntimeException("Can't generate EDI file"); } diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java index 5d84fee..ee811b1 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/actions/ArchiveAction.java @@ -47,6 +47,8 @@ import static org.nuiton.i18n.I18n.t; */ public class ArchiveAction extends SaveDemandeAndExitAction { + protected DemandeUIModel previousState; + public ArchiveAction(DemandeUIHandler handler) { super(handler); setActionDescription(t("faxtomail.action.archive.tip")); @@ -69,6 +71,12 @@ public class ArchiveAction extends SaveDemandeAndExitAction { public void doAction() throws Exception { DemandeUIModel model = getModel(); + //copy state to revert in case of error + previousState = new DemandeUIModel(); + previousState.setDemandStatus(model.getDemandStatus()); + previousState.setTakenBy(model.getTakenBy()); + previousState.setMailFolder(model.getMailFolder()); + // déplacement du mail dans le dossier d'archive le plus proche // cela permet de déplacer les archives dans d'autre dossier pour leur appliquer // des droits différents @@ -114,4 +122,18 @@ public class ArchiveAction extends SaveDemandeAndExitAction { } super.postSuccessAction(); } + + @Override + public void postFailedAction(Throwable error) { + super.postFailedAction(error); + + //revert modifications made in the action + DemandeUIModel model = getModel(); + model.setMailFolder(previousState.getMailFolder()); + model.setArchiveDate(null); + model.setDemandStatus(previousState.getDemandStatus()); + model.setTakenBy(previousState.getTakenBy()); + previousState = null; + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.