commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgoes...@apache.org
Subject svn commit: r963657 - in /commons/proper/email/trunk/src: java/org/apache/commons/mail/ImageHtmlEmail.java test/org/apache/commons/mail/ImageHtmlEmailTest.java
Date Tue, 13 Jul 2010 10:13:17 GMT
Author: sgoeschl
Date: Tue Jul 13 10:13:17 2010
New Revision: 963657

URL: http://svn.apache.org/viewvc?rev=963657&view=rev
Log:
[EMAIL-92] Updated the regular expression which also fixed a broken test

Modified:
    commons/proper/email/trunk/src/java/org/apache/commons/mail/ImageHtmlEmail.java
    commons/proper/email/trunk/src/test/org/apache/commons/mail/ImageHtmlEmailTest.java

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/ImageHtmlEmail.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/ImageHtmlEmail.java?rev=963657&r1=963656&r2=963657&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/ImageHtmlEmail.java (original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/ImageHtmlEmail.java Tue Jul
13 10:13:17 2010
@@ -54,11 +54,11 @@ public class ImageHtmlEmail extends Html
      * newlines on any place, HTML is not case sensitive and there can be
      * arbitrary text between "IMG" and "SRC" like IDs and other things.
      */
-    public static final String REGEX_IMG_SRC = "(<[Ii][Mm][Gg]\\s*[^>]*?\\s+[Ss][Rr][Cc]\\s*=s*[\"'])([^\"']+?)([\"'])";
+    public static final String REGEX_IMG_SRC = "(<[Ii][Mm][Gg]\\s*[^>]*?\\s+[Ss][Rr][Cc]\\s*=\\s*[\"'])([^\"']+?)([\"'])";
 
     public static final String REGEX_SCRIPT_SRC = "(<[Ss][Cc][Rr][Ii][Pp][Tt]\\s*.*?\\s+[Ss][Rr][Cc]\\s*=\\s*[\"'])([^\"']+?)([\"'])";
 
-    // this pattern looks for the HTML imgage tag which indicates embedded images,
+    // this pattern looks for the HTML image tag which indicates embedded images,
     // the grouping is necessary to allow to replace the element with the CID
     protected static final Pattern pattern = Pattern.compile(REGEX_IMG_SRC);
 
@@ -164,7 +164,7 @@ public class ImageHtmlEmail extends Html
             {
                 String name = imageDataSource.getName();
                 String cid = (String) cidCache.get(name);
-                
+
                 if(cid == null)
                 {
                     cid = embed(imageDataSource, imageDataSource.getName());    

Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/ImageHtmlEmailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/ImageHtmlEmailTest.java?rev=963657&r1=963656&r2=963657&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/org/apache/commons/mail/ImageHtmlEmailTest.java (original)
+++ commons/proper/email/trunk/src/test/org/apache/commons/mail/ImageHtmlEmailTest.java Tue
Jul 13 10:13:17 2010
@@ -253,14 +253,12 @@ public class ImageHtmlEmailTest extends 
 		assertEquals("http://dstadler2.org/", matcher.group(2));
 
 		// what about newlines and other whitespaces
-		/*
 		matcher = pattern
 				.matcher("<html><body><img\n \t\rid=\"laskdasdkj\"\n \rsrc \n =\r  \"http://dstadler1.org/\"/><img
 \r  id=\" laskdasdkj\"    src    =   \"http://dstadler2.org/\"/></body></html>");
 		assertTrue(matcher.find());
 		assertEquals("http://dstadler1.org/", matcher.group(2));
 		assertTrue(matcher.find());
 		assertEquals("http://dstadler2.org/", matcher.group(2));
-		 */
 		
         // what about some real markup
         matcher = pattern.matcher("<img alt=\"Chart?ck=xradar&amp;w=120&amp;h=120&amp;c=7fff00|7fff00&amp;m=4&amp;g=0\"
src=\"/chart?ck=xradar&amp;w=120&amp;h=120&amp;c=7fff00|7fff00&amp;m=4&amp;g=0.2&amp;l=A,C,S,T&amp;v=3.0,3.0,2.0,2.0\"");



Mime
View raw message