W3C home > Mailing lists > Public > www-validator-cvs@w3.org > July 2007

2002/css-validator/org/w3c/css/css StyleSheetParser.java,1.10,1.11

From: Julien Grand-Mourcel via cvs-syncmail <cvsmail@w3.org>
Date: Tue, 31 Jul 2007 12:50:58 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1IFrBi-0002ub-6h@lionel-hutz.w3.org>

Update of /sources/public/2002/css-validator/org/w3c/css/css
In directory hutz:/tmp/cvs-serv11175/org/w3c/css/css

Modified Files:
	StyleSheetParser.java 
Log Message:
Correcting the bug n°697
spliting media with comas for <style> (already done) and <link> using a function to avoid duplication of the code.

Index: StyleSheetParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetParser.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- StyleSheetParser.java	16 Dec 2006 20:22:27 -0000	1.10
+++ StyleSheetParser.java	31 Jul 2007 12:50:54 -0000	1.11
@@ -211,10 +211,7 @@
 	    }
 	    AtRuleMedia m = new AtRuleMedia();
 	    try {
-		StringTokenizer tokens = new StringTokenizer(media, ",");
-		while (tokens.hasMoreTokens()) {
-		    m.addMedia(tokens.nextToken().trim(), ac);
-		}
+	    addMedias(m, media, ac);
 		cssFouffa.setAtRule(m);
 	    } catch (org.w3c.css.util.InvalidParamException e) {
 		Errors er = new Errors();
@@ -231,6 +228,13 @@
 	    notifyErrors(er);
 	}
     }
+    
+    private void addMedias(AtRuleMedia m, String medias, ApplContext ac) throws InvalidParamException {
+    	StringTokenizer tokens = new StringTokenizer(medias, ",");
+		while (tokens.hasMoreTokens()) {
+	        m.addMedia(tokens.nextToken().trim(), ac);
+		}
+    }
 
     /**
      * Parse a style element. The Style element always comes from the user
@@ -267,7 +271,7 @@
 
 	    AtRuleMedia m = new AtRuleMedia();
 	    try {
-		m.addMedia(media, ac);
+	    	addMedias(m, media, ac);
 		cssFouffa.setAtRule(m);
 	    } catch (org.w3c.css.util.InvalidParamException e) {
 		Errors er = new Errors();
Received on Tuesday, 31 July 2007 12:51:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:58 GMT