NonQuotedCommentHandler broken when replying to html emails from outlook

XMLWordPrintable

    • 3.02

      This issue relates to JRA-5238. When replying to the html version of jira emails from outlook, outlook adds a ruled line between messages. Below is the code that I currently use to test for the different outlook reply email formats (using java 1.4's regex matching).

      private static final Pattern OUTLOOK_HTML_COMMENT = Pattern.compile("\\s\\r\\n+_

      {33,}

      \\s\\r\\n+From:.*", Pattern.DOTALL);
      private static final Pattern OUTLOOK_TEXT_COMMENT = Pattern.compile("\\s\\r\\n
      s+(Original Message|Ursprüngliche Nachricht|Original Message Follows)
      s++\\r\\n+From:.*", Pattern.DOTALL);

      ....

      public String stripQuotedLines(String body)
      {
      ....
      String nonQuotedMsg = result.toString();
      Matcher matcher = OUTLOOK_HTML_COMMENT.matcher(nonQuotedMsg);
      if (matcher.find()) nonQuotedMsg = matcher.replaceFirst("");

      matcher = OUTLOOK_TEXT_COMMENT.matcher(nonQuotedMsg);
      if (matcher.find()) nonQuotedMsg = matcher.replaceFirst("");
      return nonQuotedMsg;
      }

      In fact, IMHO, the entire code of the stripQuotedLines() method could very easily be refactored using a few regular expressions - it would make the code much tighter.

            Assignee:
            Dylan Etkin [Atlassian]
            Reporter:
            Colin Bendell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: