You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Jochen Wiedmann (Jira)" <ji...@apache.org> on 2021/08/10 20:51:00 UTC
[jira] [Created] (EMAIL-198) Performance in ImageHtmlEmail
Jochen Wiedmann created EMAIL-198:
-------------------------------------
Summary: Performance in ImageHtmlEmail
Key: EMAIL-198
URL: https://issues.apache.org/jira/browse/EMAIL-198
Project: Commons Email
Issue Type: Improvement
Affects Versions: 1.5
Reporter: Jochen Wiedmann
Assignee: Jochen Wiedmann
Fix For: 1.6
In the class ImageHtmlEmail, there are two regular expressions (REGEX_SCRIPT_SRC, and
REGEX_IMAGE_SRC), which can behave rather slow in exceptional cases, as evidenced by
the following code snippet:
@Test
public void testSlowRegularExpressions() throws Exception {
ImageHtmlEmail mail = new ImageHtmlEmail();
mail.setHostName("example.com");
mail.setFrom("from@example.com");
mail.addTo("to@example.com");
StringBuilder text = new StringBuilder("<img");
for (int i = 0; i < 3000; i++) {
text.append(" ");
}
mail.setMsg("<html><body><pre>" + text + "</pre></body></html>");
long startTime = System.currentTimeMillis();
mail.buildMimeMessage();
long duration = System.currentTimeMillis() - startTime;
assertTrue("Run time exceeds permitted duration of 50 seconds: " + duration,
duration < 100*1000);
}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)