Uploaded image for project: 'Runtime'
  1. Runtime
  2. RUNTIME-857

SendMailHelper CSS inlining problems

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.4.2, 2.5
    • 2.4.1
    • None
    • None

      Since RUNTIME-650, CSS is inlined when sending a mail with SendMailHelper. Extract:

      String[] selector = selectors.split(",");
      for (String s : selector)
      {
      	if (StringUtils.isNotEmpty(s) && !s.contains(":"))
      	{
      		Elements selectedElements = doc.select(s); 
      		for (Element selElem : selectedElements) 
      		{ 
      			String oldProperties = selElem.attr("style"); 
      			selElem.attr("style", oldProperties.length() > 0 ? concatenateProperties(oldProperties, properties) : properties); 
      		} 
      		
      	}
      }
      

      Instead of testing if the selector is not empty, we should test if it's not blank
      Additionally, the doc.select(s) statement can throw RuntimeExceptions. We should either:

      • throw Exception specifically in SendMailHelper functions to enforce the callers catch these exceptions
      • explain this in the javadoc
      • catch RuntimeException in the block and ignore it or copy the css "as-is".

            raphael Raphaƫl Franchet
            lperier Laurence Perier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: