This is an automated email from the git hooks/post-receive script. New commit to branch develop-1.1.x in repository faxtomail. See http://git.codelutin.com/faxtomail.git commit 2b210bf6594d1abeb51ecab74505d9377bfef72d Author: Kevin Morin <morin@codelutin.com> Date: Mon Nov 16 15:09:26 2015 +0100 fixes #7724 Erreur à l'ouverture d'un élément quand l'email n'a pas de texte fixes #7725 Erreur quand on veut répondre à un email qui n'a pas de texte fixes #7726 Erreur à l'ouverture d'un email dont le code html n'est pas valide --- .../ui/swing/content/reply/ReplyFormUIHandler.java | 2 +- .../faxtomail/ui/swing/util/FaxToMailUIUtil.java | 43 +++++++++++++++++----- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java index f05b4ea..6a86726 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/content/reply/ReplyFormUIHandler.java @@ -134,7 +134,7 @@ public class ReplyFormUIHandler extends AbstractFaxToMailUIHandler<ReplyFormUIMo String quotedReply = t("faxtomail.reply.message", decorate(demand.getReceptionDate()), demand.getSender(), - plainContent.replaceAll("\n", "\n> ")); + plainContent != null ? plainContent.replaceAll("\n", "\n> ") : ""); model.setMessage(quotedReply); String recipient = demand.getRecipient(); diff --git a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java index 16ed24a..7db170f 100644 --- a/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java +++ b/faxtomail-ui-swing/src/main/java/com/franciaflex/faxtomail/ui/swing/util/FaxToMailUIUtil.java @@ -39,6 +39,7 @@ import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIHandler; import com.franciaflex.faxtomail.ui.swing.content.demande.DemandeUIModel; import com.franciaflex.faxtomail.ui.swing.content.demande.RangeRowModel; import com.google.common.base.Function; +import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Ordering; import com.itextpdf.text.Document; @@ -347,18 +348,31 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { List<String> contents = demandeUIModel.getHtmlContent(); if (contents != null) { + for (String content : contents) { - addHtmlTextPane(handler, demandeUIModel, textPanePanel, content); + if (content != null) { + addHtmlTextPane(handler, demandeUIModel, textPanePanel, content); + } } - } else { + } + + // if there is no html content or if no html content can be correctly displayed (ie throws an exception) + if (textPanePanel.getComponentCount() == 0) { + contents = demandeUIModel.getPlainContent(); - for (String content : contents) { - JTextPane textPane = new JTextPane(); - textPane.setText(content); - textPanePanel.add(textPane); - textPanePanel.add(Box.createVerticalStrut(3)); + if (contents != null) { + + for (String content : contents) { + + if (content != null) { + JTextPane textPane = new JTextPane(); + textPane.setText(content); + textPanePanel.add(textPane); + textPanePanel.add(Box.createVerticalStrut(3)); + } + } } } } @@ -782,6 +796,8 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { JPanel textPanePanel, String content) { + Preconditions.checkNotNull(content); + JTextPane textPane = createHtmlTextPane(); // the meta tag makes the content is not displayed @@ -818,11 +834,18 @@ public final class FaxToMailUIUtil extends ApplicationUIUtil { log.trace("Content after mail = " + content); } - textPane.setText(content); + try { + textPane.setText(content); + + textPanePanel.add(textPane); - textPanePanel.add(textPane); + textPanePanel.add(Box.createVerticalStrut(3)); - textPanePanel.add(Box.createVerticalStrut(3)); + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Error when displaying email content", e); + } + } } protected static JTextPane createHtmlTextPane() { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.