W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2011

2002/css-validator/org/w3c/css/css CssRuleList.java,1.19,1.20 CssStyleRule.java,1.19,1.20 CssValidator.java,1.9,1.10 DocumentParser.java,1.6,1.7 StyleSheet.java,1.18,1.19 StyleSheetGenerator.java,1.29,1.30 StyleSheetParser.java,1.17,1.18 XMLStyleSheetHandler.java,1.30,1.31

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Mon, 29 Aug 2011 07:21:02 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Qxw9W-0004n2-HE@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/css
In directory hutz:/tmp/cvs-serv18238/css/css

Modified Files:
	CssRuleList.java CssStyleRule.java CssValidator.java 
	DocumentParser.java StyleSheet.java StyleSheetGenerator.java 
	StyleSheetParser.java XMLStyleSheetHandler.java 
Log Message:
genericity + updated code to 5.0 stds

Index: XMLStyleSheetHandler.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/XMLStyleSheetHandler.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- XMLStyleSheetHandler.java	13 Feb 2009 21:50:15 -0000	1.30
+++ XMLStyleSheetHandler.java	29 Aug 2011 07:21:00 -0000	1.31
@@ -13,23 +13,14 @@
  */
 package org.w3c.css.css;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringBufferInputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.HashMap;
[...1251 lines suppressed...]
+                                value.append('"');
+                            } else if ("apos".equals(entity)) {
+                                value.append('\'');
+                            } else {
+                                return table;
+                            }
+                            state -= 10;
+                            break;
+                        default:
+                            return table;
+                    }
+            }
+            current++;
+        }
+        if (name.length() != 0 && value.length() != 0) {
+            table.put(name.toString(), value.toString());
+        }
+        return table;
     }
 }

Index: StyleSheet.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheet.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- StyleSheet.java	14 Aug 2011 09:02:19 -0000	1.18
+++ StyleSheet.java	29 Aug 2011 07:21:00 -0000	1.19
@@ -17,9 +17,9 @@
 import org.w3c.css.util.Warnings;
 
 import java.io.PrintWriter;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
-import java.util.Vector;
 
 /**
  * This class contains a style sheet with all rules, errors and warnings.
@@ -33,7 +33,7 @@
     private Errors errors;
     private Warnings warnings;
     private String type;
-    private Vector atRuleList;
+    private ArrayList<CssRuleList> atRuleList;
     private boolean doNotAddRule;
     private boolean doNotAddAtRule;
     private static final boolean debug = false;
@@ -46,7 +46,7 @@
         errors = new Errors();
         warnings = new Warnings();
         cascading = new CssCascadingOrder();
-        atRuleList = new Vector();
+        atRuleList = new ArrayList<CssRuleList>();
     }
 
     public void setWarningLevel(int warningLevel) {
@@ -219,14 +219,14 @@
     public void newAtRule(AtRule atRule) {
         CssRuleList rulelist = new CssRuleList();
         rulelist.addAtRule(atRule);
-        atRuleList.addElement(rulelist);
+        atRuleList.add(rulelist);
         indent = "   ";
     }
 
     public void endOfAtRule() {
         if (!doNotAddAtRule) {
             CssRuleList rulelist = new CssRuleList();
-            atRuleList.addElement(rulelist); //for the new set of rules
+            atRuleList.add(rulelist); //for the new set of rules
         }
         important = false;
         selectortext = "";
@@ -238,30 +238,33 @@
         this.important = important;
     }
 
-    public void setSelectorList(Vector selectors) {
-        String slave = selectors.toString();
-        selectortext = slave.substring(slave.indexOf("[") + 1,
-                slave.lastIndexOf("]"));
+    public void setSelectorList(ArrayList<CssSelectors> selectors) {
+        StringBuilder sb = new StringBuilder();
+        for (CssSelectors s : selectors) {
+            if (sb.length() > 0) {
+                sb.append(", ");
+            }
+            sb.append(s.toString());
+        }
+        selectortext = sb.toString();
     }
 
-    public void setProperty(Vector properties) {
+    public void setProperty(ArrayList<CssProperty> properties) {
         this.properties = properties;
     }
 
     public void endOfRule() {
         CssRuleList rulelist;
-        boolean useless;
         if (!doNotAddRule) {
             CssStyleRule stylerule = new CssStyleRule(indent, selectortext,
                     properties, important);
             if (!atRuleList.isEmpty()) {
-                rulelist = (CssRuleList) atRuleList.lastElement();
-                useless = atRuleList.removeElement(rulelist);
+                rulelist = atRuleList.remove(atRuleList.size()-1);
             } else {
                 rulelist = new CssRuleList();
             }
             rulelist.addStyleRule(stylerule);
-            atRuleList.addElement(rulelist);
+            atRuleList.add(rulelist);
         }
         selectortext = "";
         doNotAddRule = false;
@@ -275,13 +278,13 @@
         doNotAddAtRule = true;
     }
 
-    public Vector newGetRules() {
+    public ArrayList<CssRuleList> newGetRules() {
         return atRuleList;
     }
 
     String selectortext;
     boolean important;
-    Vector properties;
+    ArrayList<CssProperty> properties;
     String indent = new String();
     public String charset;
 }

Index: DocumentParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/DocumentParser.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- DocumentParser.java	14 May 2011 18:13:25 -0000	1.6
+++ DocumentParser.java	29 Aug 2011 07:21:00 -0000	1.7
@@ -17,13 +17,6 @@
 import java.net.URL;
 import java.net.URLConnection;
 
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLSession;
-
 /**
  * @version $Revision$
  */
@@ -33,7 +26,7 @@
 
     static {
         try {
-        wap = new MimeType("application/vnd.wap.xhtml+xml");
+            wap = new MimeType("application/vnd.wap.xhtml+xml");
         } catch (MimeTypeFormatException mex) {
             wap = null;
         }
@@ -46,116 +39,117 @@
 
     /**
      * Create a new DocumentParser
-     * 
-     * @exception Exception
-     *                An error
+     *
+     * @throws Exception An error
      */
     public DocumentParser(ApplContext ac, String urlString) throws Exception {
-	this.htmlURL = HTTPURL.getURL(urlString);
-	this.ac = ac;
-	urlString = htmlURL.toString();
-	String urlLower = urlString.toLowerCase();
-	String media = ac.getMedium();
-	String urlProtocol = htmlURL.getProtocol();
+        this.htmlURL = HTTPURL.getURL(urlString);
+        this.ac = ac;
+        urlString = htmlURL.toString();
+        String urlLower = urlString.toLowerCase();
+        String media = ac.getMedium();
+        String urlProtocol = htmlURL.getProtocol();
 
-	if (!"http".equals(urlProtocol) && !"https".equals(urlProtocol)) {
-	    if (urlLower.endsWith(".css")) {
-		StyleSheetParser parser = new StyleSheetParser();
-		parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR);
-		style = parser.getStyleSheet();
-	    } else if (urlLower.endsWith(".html") || urlLower.endsWith(".shtml") || urlLower.endsWith("/")) {
-		TagSoupStyleSheetHandler handler = new TagSoupStyleSheetHandler(htmlURL, ac);
-		handler.parse(htmlURL);
-		style = handler.getStyleSheet();
-		if (style != null) {
-		    style.setType("text/html");
-		}
-	    } else if (urlLower.endsWith(".xhtml") || urlLower.endsWith(".xml")) {
-		// Seems like we need to use tagsout in this case as well
-		XMLStyleSheetHandler handler = new XMLStyleSheetHandler(htmlURL, ac);
-		handler.parse(htmlURL);
-		style = handler.getStyleSheet();
-		if (style != null) {
-		    style.setType("text/xml");
-		}
-	    } else {
-		throw new Exception("Unknown file");
-	    }
-	} else {
-	    URLConnection connection = null;
+        if (!"http".equals(urlProtocol) && !"https".equals(urlProtocol)) {
+            if (urlLower.endsWith(".css")) {
+                StyleSheetParser parser = new StyleSheetParser();
+                parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR);
+                style = parser.getStyleSheet();
+            } else if (urlLower.endsWith(".html") || urlLower.endsWith(".shtml") || urlLower.endsWith("/")) {
+                TagSoupStyleSheetHandler handler = new TagSoupStyleSheetHandler(htmlURL, ac);
+                handler.parse(htmlURL);
+                style = handler.getStyleSheet();
+                if (style != null) {
+                    style.setType("text/html");
+                }
+            } else if (urlLower.endsWith(".xhtml") || urlLower.endsWith(".xml")) {
+                // Seems like we need to use tagsout in this case as well
+                XMLStyleSheetHandler handler = new XMLStyleSheetHandler(htmlURL, ac);
+                handler.parse(htmlURL);
+                style = handler.getStyleSheet();
+                if (style != null) {
+                    style.setType("text/xml");
+                }
+            } else {
+                throw new Exception("Unknown file");
+            }
+        } else {
+            URLConnection connection = null;
 
-	    try {
-		boolean isXML = false;
-		String cType;
+            try {
+                boolean isXML = false;
+                String cType;
 
-		// @@ hum, maybe? (plh, yes probably :-) )
-		String credential = ac.getCredential();
+                // @@ hum, maybe? (plh, yes probably :-) )
+                String credential = ac.getCredential();
 
-		connection = HTTPURL.getConnection(htmlURL, ac);
-		htmlURL = connection.getURL();
+                connection = HTTPURL.getConnection(htmlURL, ac);
+                htmlURL = connection.getURL();
 
-		String httpCL = connection.getHeaderField("Content-Location");
-		if (httpCL != null) {
-		    htmlURL = HTTPURL.getURL(htmlURL, httpCL);
-		}
+                String httpCL = connection.getHeaderField("Content-Location");
+                if (httpCL != null) {
+                    htmlURL = HTTPURL.getURL(htmlURL, httpCL);
+                }
 
-		cType = connection.getContentType();
-		if (cType == null) {
-		    cType = "unknown/unknown";
-		}
-		MimeType contentType = null;
-		try {
-		    contentType = new MimeType(cType);
-		} catch (MimeTypeFormatException ex) {
-		}
+                cType = connection.getContentType();
+                if (cType == null) {
+                    cType = "unknown/unknown";
+                }
+                MimeType contentType = null;
+                try {
+                    contentType = new MimeType(cType);
+                } catch (MimeTypeFormatException ex) {
+                    // an error, let's try to parse it as HTML
+                    contentType = MimeType.TEXT_HTML;
+                }
 
-		if (Util.onDebug) {
-		    System.err.println("[DEBUG] content type is [" + contentType + ']');
-		}
+                if (Util.onDebug) {
+                    System.err.println("[DEBUG] content type is [" + contentType + ']');
+                }
 
-		if (contentType.match(MimeType.TEXT_HTML) == MimeType.MATCH_SPECIFIC_SUBTYPE) {
-		    TagSoupStyleSheetHandler handler;
-		    handler = new TagSoupStyleSheetHandler(htmlURL, ac);
-		    handler.parse(urlString, connection);
-		    style = handler.getStyleSheet();
+                if (contentType.match(MimeType.TEXT_HTML) == MimeType.MATCH_SPECIFIC_SUBTYPE) {
+                    TagSoupStyleSheetHandler handler;
+                    handler = new TagSoupStyleSheetHandler(htmlURL, ac);
+                    handler.parse(urlString, connection);
+                    style = handler.getStyleSheet();
 
-		    if (style != null) {
-			style.setType("text/html");
-		    }
-		} else if (contentType.match(MimeType.TEXT_CSS) == MimeType.MATCH_SPECIFIC_SUBTYPE) {
-		    StyleSheetParser parser = new StyleSheetParser();
-		    parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR);
-		    style = parser.getStyleSheet();
-		} else if ((contentType.match(MimeType.TEXT_XML) == MimeType.MATCH_SPECIFIC_SUBTYPE)
-			   || (contentType.match(MimeType.APPLICATION_XHTML_XML) == MimeType.MATCH_SPECIFIC_SUBTYPE)
-                || (contentType.match(wap) == MimeType.MATCH_SPECIFIC_SUBTYPE)) {
-		    // TagSoup ?
-		    XMLStyleSheetHandler handler = new XMLStyleSheetHandler(htmlURL, ac);
-		    handler.parse(urlString, connection);
-		    style = handler.getStyleSheet();
+                    if (style != null) {
+                        style.setType("text/html");
+                    }
+                } else if (contentType.match(MimeType.TEXT_CSS) == MimeType.MATCH_SPECIFIC_SUBTYPE) {
+                    StyleSheetParser parser = new StyleSheetParser();
+                    parser.parseURL(ac, htmlURL, null, null, media, StyleSheetOrigin.AUTHOR);
+                    style = parser.getStyleSheet();
+                } else if ((contentType.match(MimeType.TEXT_XML) == MimeType.MATCH_SPECIFIC_SUBTYPE)
+                        || (contentType.match(MimeType.APPLICATION_XHTML_XML) == MimeType.MATCH_SPECIFIC_SUBTYPE)
+                        || (contentType.match(wap) == MimeType.MATCH_SPECIFIC_SUBTYPE)) {
+                    // TagSoup ?
+                    XMLStyleSheetHandler handler = new XMLStyleSheetHandler(htmlURL, ac);
+                    handler.parse(urlString, connection);
+                    style = handler.getStyleSheet();
 
-		    if (style != null) {
-			style.setType("text/xml");
-		    }
-		} else {
-		    throw new IOException("Unknown mime type : " + contentType);
-		}
-	    } finally {
-		try {
-		    connection.getInputStream().close();
-		} catch (Exception e) {
-		}
-	    }
-	}
+                    if (style != null) {
+                        style.setType("text/xml");
+                    }
+                } else {
+                    throw new IOException("Unknown mime type : " + contentType);
+                }
+            } finally {
+                try {
+                    connection.getInputStream().close();
+                } catch (Exception e) {
+                }
+            }
+        }
     }
 
     /**
      * Returns the recognized style sheet.
-     * 
+     *
      * @return A style sheet.
      */
     public StyleSheet getStyleSheet() {
-	return style;
+        return style;
     }
 
 } // HTMLStyleSheetParser

Index: CssRuleList.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssRuleList.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- CssRuleList.java	25 Feb 2009 20:44:49 -0000	1.19
+++ CssRuleList.java	29 Aug 2011 07:21:00 -0000	1.20
@@ -5,72 +5,71 @@
 
 package org.w3c.css.css;
 
-import java.util.Vector;
-
 import org.w3c.css.parser.AtRule;
 import org.w3c.css.util.Messages;
 
+import java.util.ArrayList;
+
 public class CssRuleList {
 
     AtRule atRule;
     String atRuleString;
-    Vector rulelist;
+    ArrayList<CssStyleRule> rulelist;
     public String pseudopage;
     String indent;
 
     public CssRuleList() {
-	atRule = null;
-	atRuleString = new String();
-	rulelist = new Vector();
-	indent = new String();
+        atRule = null;
+        atRuleString = new String();
+        rulelist = new ArrayList<CssStyleRule>();
+        indent = new String();
     }
 
     public void addStyleRule(CssStyleRule stylerule) {
-	rulelist.addElement(stylerule);
+        rulelist.add(stylerule);
     }
 
-    public Vector getStyleRules() {
-	return rulelist;
+    public ArrayList<CssStyleRule> getStyleRules() {
+        return rulelist;
     }
 
     public void addAtRule(AtRule atRule) {
-	this.atRule = atRule;
-	atRuleString = atRule.toString();
+        this.atRule = atRule;
+        atRuleString = atRule.toString();
     }
 
     public String getAtRule() {
-	return atRuleString;
+        return atRuleString;
     }
-    
+
     public String getAtRuleEscaped() {
-	return Messages.escapeString(atRuleString);
+        return Messages.escapeString(atRuleString);
     }
-	
+
     public boolean isEmpty() {
-	return rulelist.isEmpty();
+        return rulelist.isEmpty();
     }
 
     public String toString() {
-	StringBuilder ret = new StringBuilder();
-	if (null != atRule && atRule.isEmpty()) {
-	    if (!atRuleString.equals("")) {
-		ret.append(atRuleString);
-		ret.append("\n\n");
-	    }
-	} else {
-	    if (!atRuleString.equals("")) {
-		ret.append(atRuleString);
-		ret.append(" {\n\n");
-	    }
-	    for (int i = 0; i < rulelist.size(); i++) {
-		ret.append((CssStyleRule) rulelist.elementAt(i));
-	    }
-
-	    if (!atRuleString.equals("")) {
-		ret.append("}\n");
-	    }
-	}
-	return ret.toString();
+        StringBuilder ret = new StringBuilder();
+        if (null != atRule && atRule.isEmpty()) {
+            if (atRuleString.length() != 0) {
+                ret.append(atRuleString);
+                ret.append("\n\n");
+            }
+        } else {
+            if (atRuleString.length() != 0) {
+                ret.append(atRuleString);
+                ret.append(" {\n\n");
+            }
+            for (CssStyleRule styleRule : rulelist) {
+                ret.append(styleRule);
+            }
+            if (atRuleString.length() != 0) {
+                ret.append("}\n");
+            }
+        }
+        return ret.toString();
     }
 
 }

Index: CssStyleRule.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssStyleRule.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- CssStyleRule.java	5 Jan 2010 13:49:33 -0000	1.19
+++ CssStyleRule.java	29 Aug 2011 07:21:00 -0000	1.20
@@ -5,73 +5,74 @@
 
 package org.w3c.css.css;
 
-import java.util.Vector;
-
 import org.w3c.css.properties.css.CssProperty;
 import org.w3c.css.util.Messages;
 
+import java.util.ArrayList;
+
 public class CssStyleRule {
 
-    public CssStyleRule(String indent, String selectors, 
-			Vector properties, boolean important) 
-    {
-	this.selectors = selectors;
-	this.properties = properties;
-	this.indent = indent;
+    public CssStyleRule(String indent, String selectors,
+                        ArrayList<CssProperty> properties, boolean important) {
+        this.selectors = selectors;
+        this.properties = properties;
+        this.indent = indent;
     }
+
     /**
      * This function is only used inside the velocity template
+     *
      * @return the list of selectors in a string
      */
     public String getSelectors() {
-	return selectors;
+        return selectors;
     }
-    
+
     public String getSelectorsEscaped() {
-	return Messages.escapeString(selectors);
+        return Messages.escapeString(selectors);
     }
 
     /**
      * This function is only used inside the velocity template
+     *
      * @return the list of properties in a Vector
      */
-    public Vector getProperties() {
-	return properties;
+    public ArrayList<CssProperty> getProperties() {
+        return properties;
     }
 
     public String toString() {
-	StringBuilder ret = new StringBuilder();
-	if (selectors != null) {
-	    ret.append(selectors);
-	    ret.append(' ');
-	    ret.append('{');
-	    ret.append('\n');
-	}
+        StringBuilder ret = new StringBuilder();
+        if (selectors != null) {
+            ret.append(selectors);
+            ret.append(' ');
+            ret.append('{');
+            ret.append('\n');
+        }
 
-	for (int i = 0; i < properties.size(); i++) {
-	    CssProperty property = (CssProperty) properties.elementAt(i);
-	    ret.append(indent);
-	    ret.append("   ");
-	    ret.append(property.getPropertyName());
-	    ret.append(" : ");
-	    ret.append(property.toString());
-	    if (property.getImportant()) {
-		ret.append(" important");
-	    }
-	    ret.append(';');
-	    ret.append('\n');
-	}
-	if (selectors != null) {
-	    ret.append(indent);
-	    ret.append('}');
-	    ret.append('\n');
-	    ret.append('\n');
-	}
-	return ret.toString();
+        for (CssProperty property : properties) {
+            ret.append(indent);
+            ret.append("   ");
+            ret.append(property.getPropertyName());
+            ret.append(" : ");
+            ret.append(property.toString());
+            if (property.getImportant()) {
+                ret.append(" important");
+            }
+            ret.append(';');
+            ret.append('\n');
+        }
+        if (selectors != null) {
+            ret.append(indent);
+            ret.append('}');
+            ret.append('\n');
+            ret.append('\n');
+        }
+        return ret.toString();
     }
 
     public String toStringEscaped() {
-	return Messages.escapeString(toString());
+        return Messages.escapeString(toString());
     }
 
     /*
@@ -88,7 +89,7 @@
      * ret.append(";</li>\n"); }
      * ret.append("</ul>}</li>\n\n"); return ret.toString(); }
      */
-	
+
     /**
      * This method returns a part of the style sheet to be displayed
      * Some identation (\t) was necessary to maintain the correct formatting
@@ -97,6 +98,6 @@
 
     private String indent;
     private String selectors;
-    private Vector properties;
+    private ArrayList<CssProperty> properties;
 
 }

Index: CssValidator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/CssValidator.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- CssValidator.java	24 Apr 2008 06:41:04 -0000	1.9
+++ CssValidator.java	29 Aug 2011 07:21:00 -0000	1.10
@@ -1,5 +1,5 @@
 /*
- * CssValidatoralidator.java
+ * CssValidator.java
  *
  * Created on April 19, 2006, 2:50 PM
  *
@@ -9,241 +9,234 @@
 
 package org.w3c.css.css;
 
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-import org.w3c.css.error.ErrorReport;
-import org.w3c.css.error.ErrorReportFactory;
 import org.w3c.css.parser.CssSelectors;
 import org.w3c.css.properties.PropertiesLoader;
 import org.w3c.css.util.ApplContext;
 import org.w3c.css.util.HTTPURL;
-import org.w3c.css.util.Utf8Properties;
 import org.w3c.css.util.Util;
 import org.w3c.tools.resources.ProtocolException;
 
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+
 /**
- *
  * @author jean
  */
 public class CssValidator {
-    
+
     ApplContext ac;
     PrintWriter out;
-    Vector uris = new Vector();
-    Hashtable params;
-    
+    ArrayList<String> uris = new ArrayList<String>();
+    HashMap<String, String> params;
+
     // @@ HACK
     static boolean showCSS = false;
-    
+
     private Exception exception;
-        
- /**	
-		 * 
-	 * Creates a new instance of CssValidator with the following default values:
-	 * <ul>
-	 *   <li>profile = css21</li>
-	 *   <li>medium = all</li>
-	 *   <li>output = text</li>
-	 *   <li>lang = en</li>
-	 *   <li>warning = 2</li>
-	 *   <li>showCSS = false</li>
-	 * </ul>
-	 */
-    public CssValidator() {	
-	params = new Hashtable();
-	params.put("profile", PropertiesLoader.config.getProperty("defaultProfile"));
-	params.put("medium", "all");
-	params.put("output", "text");
-	params.put("lang", "en");
-	params.put("warning", "2");	
+
+    /**
+     * Creates a new instance of CssValidator with the following default values:
+     * <ul>
+     * <li>profile = css21</li>
+     * <li>medium = all</li>
+     * <li>output = text</li>
+     * <li>lang = en</li>
+     * <li>warning = 2</li>
+     * <li>showCSS = false</li>
+     * </ul>
+     */
+    public CssValidator() {
+        params = new HashMap<String, String>();
+        params.put("profile", PropertiesLoader.config.getProperty("defaultProfile"));
+        params.put("medium", "all");
+        params.put("output", "text");
+        params.put("lang", "en");
+        params.put("warning", "2");
     }
-    
+
     public static void main(String args[])
-	throws IOException, MalformedURLException {
-	
-	CssSelectors selector = null;
-	
-	CssValidator style = new CssValidator();
-	
-	// first, we get the parameters and create an application context
-	try {    
-	    style.getParams(args); 
-	    style.ac = new ApplContext((String)style.params.get("lang"));	    	    
-	    System.out.println(style.params);
-	} catch (Exception e) {
-	    System.out.println( "Usage: java org.w3c.css.css.CssValidator " +
-		    " [OPTIONS] | [URL]*");
-	    System.out.println("OPTIONS");
-	    System.out.println("\t-p, --printCSS");
-	    System.out.println("\t\tPrints the validated CSS (only with text " +
-		    "output, the CSS is printed with other outputs)");
-	    System.out.println("\t-profile PROFILE, --profile=PROFILE");
-	    System.out.println("\t\tChecks the Stylesheet against PROFILE");
-	    System.out.println("\t\tPossible values for PROFILE are css1, " +
-		    "css2, css21 (default), css3, svg, svgbasic, svgtiny, " +
-		    "atsc-tv, mobile, tv");
-	    System.out.println("\t-medium MEDIUM, --medium=MEDIUM");
-	    System.out.println("\t\tChecks the Stylesheet using the medium MEDIUM");
-	    System.out.println("\t\tPossible values for MEDIUM are all " +
-		    "(default), aural, braille, embossed, handheld, print, " +
-		    "projection, screen, tty, tv, presentation");
-	    System.out.println("\t-output OUTPUT, --output=OUTPUT");
-	    System.out.println("\t\tPrints the result in the selected format");
-	    System.out.println("\t\tPossible values for OUTPUT are text (default), xhtml, " +
-		    "html (same result as xhtml), soap12");
-	    System.out.println("\t-lang LANG, --lang=LANG");
-	    System.out.println("\t\tPrints the result in the specified language");
-	    System.out.println("\t\tPossible values for LANG are " +
-		    "de, en (default), es, fr, ja, ko, nl, zh-cn, pl, it");
-	    System.out.println("\t-warning WARN, --warning=WARN");
-	    System.out.println("\t\tWarnings verbosity level");
-	    System.out.println("\t\tPossible values for WARN are -1 (no " +
-		    "warning), 0, 1, 2 (default, all the warnings");
-	    System.out.println();
-	    System.out.println("URL");
-	    System.out.println("\tURL can either represent a distant " +
-		    "web resource (http://) or a local file (file:/)");
-	    System.exit(1);
-	}
-	
-	// CSS version to use
-	String profile = (String) style.params.get("profile");
-	if (profile != null && !"none".equals(profile)) {
-	    if ("css1".equals(profile) || "css2".equals(profile) || "css21".equals(profile)
-	    || "css3".equals(profile) || "svg".equals(profile)
-	    || "svgbasic".equals(profile) || "svgtiny".equals(profile)) {
-		style.ac.setCssVersion(profile);
-	    } else {
-		style.ac.setProfile(profile);
-		style.ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
-	    }
-	} else {
-		style.ac.setProfile(profile);
-	    style.ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
-	}
-	
-	// medium to use
-	style.ac.setMedium((String) style.params.get("medium"));
-	
-	String encoding = style.ac.getMsg().getString("output-encoding-name");
-	if(encoding != null) style.out = new PrintWriter(new OutputStreamWriter(System.out, encoding));
-	else style.out = new PrintWriter(new OutputStreamWriter(System.out));
-	
-	for(int i = 0; i < style.uris.size(); i++) {
-	    String uri = (String) style.uris.get(i);	    	    
-	    	    	    
-	    if (uri != null) {
-		// HTML document
-		try {
-		    uri = HTTPURL.getURL(uri).toString(); // needed to be sure
-		    // that it is a valid
-		    // url
-		    DocumentParser URLparser = new DocumentParser(style.ac,
-			    uri);
-		    
-		    style.handleRequest(style.ac, uri, URLparser.getStyleSheet(), 
-			    (String)style.params.get("output"),
-			    Integer.parseInt((String)style.params.get("warning")), 
-			    true);		    
-		} catch (ProtocolException pex) {
-		    if (Util.onDebug) {
-			pex.printStackTrace();
-		    }
-		} catch (Exception e) {
-		    e.printStackTrace();		    
-		}
-	    }
-	}
+            throws IOException, MalformedURLException {
+
+        CssSelectors selector = null;
+
+        CssValidator style = new CssValidator();
+
+        // first, we get the parameters and create an application context
+        try {
+            style.getParams(args);
+            style.ac = new ApplContext((String) style.params.get("lang"));
+            System.out.println(style.params);
+        } catch (Exception e) {
+            System.out.println("Usage: java org.w3c.css.css.CssValidator " +
+                    " [OPTIONS] | [URL]*");
+            System.out.println("OPTIONS");
+            System.out.println("\t-p, --printCSS");
+            System.out.println("\t\tPrints the validated CSS (only with text " +
+                    "output, the CSS is printed with other outputs)");
+            System.out.println("\t-profile PROFILE, --profile=PROFILE");
+            System.out.println("\t\tChecks the Stylesheet against PROFILE");
+            System.out.println("\t\tPossible values for PROFILE are css1, " +
+                    "css2, css21 (default), css3, svg, svgbasic, svgtiny, " +
+                    "atsc-tv, mobile, tv");
+            System.out.println("\t-medium MEDIUM, --medium=MEDIUM");
+            System.out.println("\t\tChecks the Stylesheet using the medium MEDIUM");
+            System.out.println("\t\tPossible values for MEDIUM are all " +
+                    "(default), aural, braille, embossed, handheld, print, " +
+                    "projection, screen, tty, tv, presentation");
+            System.out.println("\t-output OUTPUT, --output=OUTPUT");
+            System.out.println("\t\tPrints the result in the selected format");
+            System.out.println("\t\tPossible values for OUTPUT are text (default), xhtml, " +
+                    "html (same result as xhtml), soap12");
+            System.out.println("\t-lang LANG, --lang=LANG");
+            System.out.println("\t\tPrints the result in the specified language");
+            System.out.println("\t\tPossible values for LANG are " +
+                    "de, en (default), es, fr, ja, ko, nl, zh-cn, pl, it");
+            System.out.println("\t-warning WARN, --warning=WARN");
+            System.out.println("\t\tWarnings verbosity level");
+            System.out.println("\t\tPossible values for WARN are -1 (no " +
+                    "warning), 0, 1, 2 (default, all the warnings");
+            System.out.println();
+            System.out.println("URL");
+            System.out.println("\tURL can either represent a distant " +
+                    "web resource (http://) or a local file (file:/)");
+            System.exit(1);
+        }
+
+        // CSS version to use
+        String profile = (String) style.params.get("profile");
+        if (profile != null && !"none".equals(profile)) {
+            if ("css1".equals(profile) || "css2".equals(profile) || "css21".equals(profile)
+                    || "css3".equals(profile) || "svg".equals(profile)
+                    || "svgbasic".equals(profile) || "svgtiny".equals(profile)) {
+                style.ac.setCssVersion(profile);
+            } else {
+                style.ac.setProfile(profile);
+                style.ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
+            }
+        } else {
+            style.ac.setProfile(profile);
+            style.ac.setCssVersion(PropertiesLoader.config.getProperty("defaultProfile"));
+        }
+
+        // medium to use
+        style.ac.setMedium((String) style.params.get("medium"));
+
+        String encoding = style.ac.getMsg().getString("output-encoding-name");
+        if (encoding != null) {
+            style.out = new PrintWriter(new OutputStreamWriter(System.out, encoding));
+        } else {
+            style.out = new PrintWriter(new OutputStreamWriter(System.out));
+        }
+
+        for (int i = 0; i < style.uris.size(); i++) {
+            String uri = (String) style.uris.get(i);
+
+            if (uri != null) {
+                // HTML document
+                try {
+                    uri = HTTPURL.getURL(uri).toString(); // needed to be sure
+                    // that it is a valid
+                    // url
+                    DocumentParser URLparser = new DocumentParser(style.ac,
+                            uri);
+
+                    style.handleRequest(style.ac, uri, URLparser.getStyleSheet(),
+                            (String) style.params.get("output"),
+                            Integer.parseInt((String) style.params.get("warning")),
+                            true);
+                } catch (ProtocolException pex) {
+                    if (Util.onDebug) {
+                        pex.printStackTrace();
+                    }
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
     }
-    
+
     private void handleRequest(ApplContext ac,
-			       String title, StyleSheet styleSheet,
-			       String output, int warningLevel,
-			       boolean errorReport) throws Exception {
+                               String title, StyleSheet styleSheet,
+                               String output, int warningLevel,
+                               boolean errorReport) throws Exception {
 
-	if (styleSheet == null) {
-	    throw new IOException(ac.getMsg().getServletString("process") + " "
-				  + title);
-	}
+        if (styleSheet == null) {
+            throw new IOException(ac.getMsg().getServletString("process") + " "
+                    + title);
+        }
 
-	styleSheet.findConflicts(ac);
+        styleSheet.findConflicts(ac);
+
+        StyleReport style = StyleReportFactory.getStyleReport(ac, title,
+                styleSheet,
+                output,
+                warningLevel);
+
+        if (!errorReport) {
+            style.desactivateError();
+        }
+
+        style.print(out);
+
+    }
 
-	StyleReport style = StyleReportFactory.getStyleReport(ac, title,
-							     styleSheet, 
-							     output, 
-							     warningLevel);
-		
-	if (!errorReport) {
-	    style.desactivateError();
-	}
-	    
-	    style.print(out);	    
-	
-    }                
-        
     /**
      * Analyses the command-line parameters
+     *
      * @param args the parameters list
-     **/
+     */
     private void getParams(String[] args) throws Exception {
-	
-	// first, we get an enumeration from the array, because it's easier to
-	// manage
-	Vector v = new Vector(java.util.Arrays.asList(args));
-	Enumeration e = v.elements();
-	
-	while(e.hasMoreElements()) {
-	    
-	    String paramName = "";
-	    String paramValue = "";
-	    
-	    // the current command-line argument
-	    String param = (String) e.nextElement();
-	    
-	    if(param.equals("--printCSS") || param.equals("-p")) {
-		// special case
-		showCSS = true;
-	    }
-	    // all the parameters have the form --param=PARAM...    
-	    else if(param.startsWith("--")) {
-		int separator = param.indexOf("=");
-		paramName = param.substring(2, separator);
-		paramValue = param.substring(separator+1);			
-	    }
-	    // ... or -param PARAM
-	    else if(param.startsWith("-")) {
-		paramName = param.substring(1);
-		if(e.hasMoreElements()) {
-		    paramValue = (String) e.nextElement();
-		}
-		else {
-		    paramValue = "";
-		}
-	    }
-	    // this is not a parameter, so it's probably a URL
-	    else {
-		uris.add(param);
-	    }
-	    
-	    if(!paramName.equals("") && params.containsKey(paramName)) {		
-		if(paramValue.equals("")) {
-		    // empty value
-		    throw new Exception("You must specify a value for the " 
-				+ "parameter " + paramName);
-		}
-		else {
-		    // update the params table
-		    params.put(paramName, paramValue);
-		}
-	    }    
-	}
-    }	
-    
+
+        // first, we get an enumeration from the array, because it's easier to
+        // manage
+        Iterator<String> iterator = Arrays.asList(args).iterator();
+        while (iterator.hasNext()) {
+            String paramName = "";
+            String paramValue = "";
+
+            // the current command-line argument
+            String param = iterator.next();
+
+            if (param.equals("--printCSS") || param.equals("-p")) {
+                // special case
+                showCSS = true;
+            }
+            // all the parameters have the form --param=PARAM...
+            else if (param.startsWith("--")) {
+                int separator = param.indexOf("=");
+                paramName = param.substring(2, separator);
+                paramValue = param.substring(separator + 1);
+            }
+            // ... or -param PARAM
+            else if (param.startsWith("-")) {
+                paramName = param.substring(1);
+                if (iterator.hasNext()) {
+                    paramValue = iterator.next();
+                } else {
+                    paramValue = "";
+                }
+            }
+            // this is not a parameter, so it's probably a URL
+            else {
+                uris.add(param);
+            }
+
+            if (paramName.length() != 0 && params.containsKey(paramName)) {
+                if (paramValue.length() == 0) {
+                    // empty value
+                    throw new Exception("You must specify a value for the "
+                            + "parameter " + paramName);
+                } else {
+                    // update the params table
+                    params.put(paramName, paramValue);
+                }
+            }
+        }
+    }
 }

Index: StyleSheetGenerator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetGenerator.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- StyleSheetGenerator.java	5 Jan 2010 13:49:33 -0000	1.29
+++ StyleSheetGenerator.java	29 Aug 2011 07:21:00 -0000	1.30
@@ -29,55 +29,52 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.TimeZone;
-import java.util.Vector;
 
 /**
  * @author Julien Grand-Mourcel
  * @author Maria Kaceriakova
  * @date 2007-06-29
  * This class uses Velocity to output the validator results
- * 
  */
 public class StyleSheetGenerator extends StyleReport {
 
     private PrintWriter out;
     private Template template;
     private String template_file;
-    private String default_lang = "en"; 
+    private String default_lang = "en";
     private ApplContext ac;
     private StyleSheet style;
     private String title;
     private VelocityContext context;
     private Warnings warnings;
     private Errors errors;
-    private Vector items;
-    private static Utf8Properties availableFormat;
-    private static Utf8Properties availablePropertiesURL;
+    private static final Utf8Properties availableFormat;
+    private static final Utf8Properties availablePropertiesURL;
 
     static {
         availableFormat = new Utf8Properties();
         try {
             java.io.InputStream f;
-	    f = StyleSheetGenerator.class.getResourceAsStream(
-							   "format.properties");
+            f = StyleSheetGenerator.class.getResourceAsStream(
+                    "format.properties");
             availableFormat.load(f);
             f.close();
         } catch (Exception e) {
-            System.err.println("org.w3c.css.css.StyleSheetGeneratorHTML: "+
-			       "couldn't load format properties ");
+            System.err.println("org.w3c.css.css.StyleSheetGeneratorHTML: " +
+                    "couldn't load format properties ");
             System.err.println("  " + e.toString());
         }
 
         availablePropertiesURL = new Utf8Properties();
         try {
             java.io.InputStream f;
-	    f = StyleSheetGenerator.class.getResourceAsStream(
-							     "urls.properties");
+            f = StyleSheetGenerator.class.getResourceAsStream(
+                    "urls.properties");
             availablePropertiesURL.load(f);
             f.close();
         } catch (Exception e) {
-            System.err.println("org.w3c.css.css.StyleSheetGeneratorHTML: "+
-			       "couldn't load URLs properties ");
+            System.err.println("org.w3c.css.css.StyleSheetGeneratorHTML: " +
+                    "couldn't load URLs properties ");
             System.err.println("  " + e.toString());
         }
 
@@ -85,41 +82,42 @@
             Velocity.setProperty(Velocity.RESOURCE_LOADER, "file");
             Velocity.addProperty(Velocity.RESOURCE_LOADER, "jar");
             Velocity.setProperty("jar." + Velocity.RESOURCE_LOADER + ".class",
-	       "org.apache.velocity.runtime.resource.loader.JarResourceLoader");
+                    "org.apache.velocity.runtime.resource.loader.JarResourceLoader");
             URL path = StyleSheetGenerator.class.getResource("/");
-            if(path != null) {
+            if (path != null) {
                 Velocity.addProperty("file." + Velocity.RESOURCE_LOADER +
-				     ".path", path.getFile());
-                Velocity.setProperty( "jar." + Velocity.RESOURCE_LOADER+".path",
-				      "jar:" + path + "css-validator.jar");
+                        ".path", path.getFile());
+                Velocity.setProperty("jar." + Velocity.RESOURCE_LOADER + ".path",
+                        "jar:" + path + "css-validator.jar");
             }
             Velocity.init();
-        } catch(Exception e) {
-            System.err.println("Failed to initialize Velocity. "+
-			       "Validator might not work as expected.");
+        } catch (Exception e) {
+            System.err.println("Failed to initialize Velocity. " +
+                    "Validator might not work as expected.");
         }
     }
-	
+
     public StyleSheetGenerator(String title, StyleSheet style, String document,
-			       int warningLevel)
-    {
+                               int warningLevel) {
         this(null, title, style, document, warningLevel);
     }
 
     public StyleSheetGenerator(ApplContext ac, String title, StyleSheet style,
-			       String document, int warningLevel) {
+                               String document, int warningLevel) {
+        ArrayList<CssRuleList> items;
+
         this.ac = ac;
         this.style = style;
         this.title = title;
         this.template_file = availableFormat.getProperty(document);
 
         context = new VelocityContext();
-	// adjust the source name if needed
-	if (ac.isInputFake()) {
-	    title = title.substring(title.lastIndexOf('/')+1);
-	}
-	context.put("file_title", queryReplace(title));
-	        
+        // adjust the source name if needed
+        if (ac.isInputFake()) {
+            title = title.substring(title.lastIndexOf('/') + 1);
+        }
+        context.put("file_title", queryReplace(title));
+
         // W3C_validator_result
         warnings = style.getWarnings();
         errors = style.getErrors();
@@ -144,35 +142,35 @@
                     context.put(k, ac.getMsg().getString(k));
             }
         }
-		
+
         if (ac.getLink() != null) {
-	    int arraysize = Messages.languages_name.size();
-	    ArrayList<HashMap<String,String>> languages;
-	    languages = new ArrayList<HashMap<String,String>>(arraysize);
+            int arraysize = Messages.languages_name.size();
+            ArrayList<HashMap<String, String>> languages;
+            languages = new ArrayList<HashMap<String, String>>(arraysize);
             String name;
             for (int i = 0; i < arraysize; ++i) {
                 name = String.valueOf(Messages.languages_name.get(i));
-                HashMap<String,String> l = new HashMap<String,String>();
+                HashMap<String, String> l = new HashMap<String, String>();
                 l.put("name", name);
                 l.put("real", ((Utf8Properties) Messages.languages.get(name)).getProperty("language_name"));
-		languages.add(i, l);
+                languages.add(i, l);
             }
             context.put("languages", languages.toArray());
             String link = ac.getLink().replaceAll("&lang=.*&", "&");
             link = link.replaceAll("&lang=.*$", "");
             context.put("link", "?" + link.replaceAll("&", "&amp;"));
         }
-		
+
         // generated values
         SimpleDateFormat formatter;
-	formatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");
+        formatter = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss'Z'");
         formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
         context.put("currentdate", formatter.format(new Date()));
         context.put("lang", ac.getContentLanguage());
         context.put("errors_count", new Integer(errors.getErrorCount()));
         context.put("warnings_count", new Integer(warnings.getWarningCount()));
-        context.put("ignored-warnings_count", 
-		               new Integer(warnings.getIgnoredWarningCount()));
+        context.put("ignored-warnings_count",
+                new Integer(warnings.getIgnoredWarningCount()));
         context.put("warning_level", new Integer(warningLevel));
         context.put("rules_count", new Integer(items.size()));
         context.put("no_errors_report", Boolean.FALSE);
@@ -180,9 +178,9 @@
         context.put("cssversion", ac.getCssVersion());
         context.put("css_profile", ac.getProfile());
         context.put("css", ac.getMsg().getString(ac.getCssVersion()));
-        context.put("css_link",getURLProperty("@url-base_"+ac.getCssVersion()));
-        context.put("is_valid", (errors.getErrorCount() == 0)?"true":"false");
-	    context.put("fake_input", Boolean.valueOf(ac.isInputFake()));
+        context.put("css_link", getURLProperty("@url-base_" + ac.getCssVersion()));
+        context.put("is_valid", (errors.getErrorCount() == 0) ? "true" : "false");
+        context.put("fake_input", Boolean.valueOf(ac.isInputFake()));
         context.put("author", "www-validator-css");
         context.put("author-email", "Email.html");
         if (style.charset != null)
@@ -194,7 +192,7 @@
 
         try {
             template = Velocity.getTemplate("org/w3c/css/css/" + template_file);
-	    template.setEncoding("utf-8");
+            template.setEncoding("utf-8");
         } catch (ResourceNotFoundException rnfe) {
             System.err.println(rnfe.getMessage());
             rnfe.printStackTrace();
@@ -210,7 +208,7 @@
     private final static String getURLProperty(String name) {
         return availablePropertiesURL.getProperty(name);
     }
-	
+
     public final static void printAvailableFormat(PrintWriter out) {
         Enumeration e = availableFormat.propertyNames();
         out.println(" -- listing available output format --");
@@ -221,30 +219,31 @@
         }
         out.flush();
     }
-	
+
 
     /**
      * Test if <tt>document</tt> is an available output
+     *
      * @param document, the desired output
      * @return <tt>true</tt> if the desired output is available
      */
     public static boolean isAvailableFormat(String document) {
         return availableFormat.containsKey(document);
     }
-	
+
 
     private final static String getDocumentName(String documentName) {
         String document = availableFormat.getProperty(documentName
-                                                      .toLowerCase());
+                .toLowerCase());
         if (document == null) {
             System.err.println("Unable to find " + documentName.toLowerCase()
-                               + " output format");
+                    + " output format");
             return documentName;
         } else {
             return document;
         }
     }
-	
+
     /**
      * Add the style information to the context
      */
@@ -268,22 +267,22 @@
             if (errors.getErrorCount() != 0) {
                 CssError[] error = errors.getErrors();
                 int nbError = error.length;
-                for (int i=0; i < nbError; i++) {
+                for (int i = 0; i < nbError; i++) {
                     CssError csserror = error[i];
                     Throwable ex = csserror.getException();
-                    Hashtable<String,Object> h = new Hashtable<String,Object>();
+                    Hashtable<String, Object> h = new Hashtable<String, Object>();
                     errors_content[i] = h;
                     h.put("Error", csserror);
                     h.put("CtxName", "nocontext");
                     h.put("CtxMsg", "");
                     h.put("ErrorMsg", ((ex.getMessage() == null) ? "" :
-				                             ex.getMessage()));
+                            ex.getMessage()));
                     h.put("ClassName", "unkownerror");
                     if (ex instanceof FileNotFoundException) {
                         h.put("ClassName", "notfound");
-                        h.put("ErrorMsg", 
-			      ac.getMsg().getGeneratorString("not-found") + 
-			      ": " + ex.getMessage());
+                        h.put("ErrorMsg",
+                                ac.getMsg().getGeneratorString("not-found") +
+                                        ": " + ex.getMessage());
                     } else if (ex instanceof CssParseException) {
                         produceParseException((CssParseException) ex, h);
                     } else if (ex instanceof InvalidParamException) {
@@ -308,11 +307,11 @@
                         CssErrorToken terror = (CssErrorToken) csserror;
                         h.put("ClassName", "errortoken");
                         h.put("ErrorMsg", terror.getErrorDescription() + " : "
-                              + terror.getSkippedString());
+                                + terror.getSkippedString());
                     } else {
                         h.put("ClassName", "unkownerror");
                         h.put("ErrorMsg", ac.getMsg().getErrorString("unknown")
-			                  + " " + ex);
+                                + " " + ex);
                         if (ex instanceof NullPointerException) {
                             // ohoh, a bug
                             ex.printStackTrace();
@@ -331,7 +330,6 @@
 
     /**
      * Add an array of warnings to the context so it c an be displayed
-     * 
      */
     private void produceWarning() {
         try {
@@ -348,59 +346,61 @@
     /**
      * Some error need more details
      * We can add a link or information of this kind
-     * @param error, the error to check
+     *
+     * @param error,    the error to check
      * @param ht_error, the Hastable with information about this error
      */
-    private void produceParseException(CssParseException error, 
-				       Hashtable<String,Object> ht_error) {
+    private void produceParseException(CssParseException error,
+                                       Hashtable<String, Object> ht_error) {
         if (error.getContexts() != null && error.getContexts().size() != 0) {
             ht_error.put("CtxName", "codeContext");
             StringBuilder buf = new StringBuilder();
             // Loop on the list of contexts for errors
-	    Enumeration e;
-            for (e = error.getContexts().elements(); e.hasMoreElements();) {
-                Object t = e.nextElement();
+            Enumeration e;
+            Iterator li = error.getContexts().iterator();
+            while (li.hasNext()) {
+                Object t = li.next();
                 // if the list is not null, add a comma
                 if (t != null) {
                     buf.append(t);
-                    if (e.hasMoreElements()) {
+                    if (li.hasNext()) {
                         buf.append(", ");
                     }
                 }
             }
             if (buf.length() != 0) {
                 ht_error.put("CtxMsg", String.valueOf(buf));
-	    }
+            }
         } else {
             ht_error.put("CtxName", "nocontext");
         }
         ht_error.put("ClassName", "parse-error");
         String name = error.getProperty();
         String ret;
-        if ((name != null) && (getURLProperty(name) != null) && 
-	    PropertiesLoader.getProfile(ac.getCssVersion()).containsKey(name)) {
+        if ((name != null) && (getURLProperty(name) != null) &&
+                PropertiesLoader.getProfile(ac.getCssVersion()).containsKey(name)) {
             //we add a link information
             // we check if the property doesn't exist in this css version
             ht_error.put("link_before_parse_error",
-			 ac.getMsg().getGeneratorString("property"));
+                    ac.getMsg().getGeneratorString("property"));
             // Since CSS3 is only a working draft, the links don't exist yet
-	    // in CSS3...
+            // in CSS3...
             // And this is the same with CSS1 because the links are not working
-	    // the same way...
+            // the same way...
             // This can be removed as soon as the CSS3 specifications are made
-	    // and CSS1 use the links
+            // and CSS1 use the links
             // and the link is changed in urls.properties
             String lnk;
             if (ac.getCssVersion().equals("css3")) {
                 lnk = getURLProperty("@url-base_css2.1");
             } else if (ac.getCssVersion().equals("css1")) {
-                lnk = getURLProperty("@url-base_css2"); 
+                lnk = getURLProperty("@url-base_css2");
             } else {
                 lnk = context.get("css_link").toString();
-	    }
+            }
             // this would be replaced by :
             // ht_error.put("link_value_parse_error",
-	    //              context.get("css_link") + getURLProperty(name));
+            //              context.get("css_link") + getURLProperty(name));
             ht_error.put("link_value_parse_error", lnk + getURLProperty(name));
             ht_error.put("link_name_parse_error", name);
         }
@@ -417,42 +417,52 @@
             }
             if (error.getSkippedString() != null) {
                 ht_error.put("span_class_parse_error", "skippedString");
-                ht_error.put("span_value_parse_error", 
-			     queryReplace(error.getSkippedString()));
+                ht_error.put("span_value_parse_error",
+                        queryReplace(error.getSkippedString()));
             } else if (error.getExp() != null) {
                 ret += " : " + queryReplace(error.getExp().toStringFromStart());
                 ht_error.put("span_class_parse_error", "exp");
-                ht_error.put("span_value_parse_error", 
-			     queryReplace(error.getExp().toString()));
+                ht_error.put("span_value_parse_error",
+                        queryReplace(error.getExp().toString()));
             }
         } else {
             ret = ac.getMsg().getGeneratorString("unrecognize");
             ht_error.put("span_class_parse_error", "unrecognized");
-            ht_error.put("span_value_parse_error", 
-			 queryReplace(error.getSkippedString()));
+            ht_error.put("span_value_parse_error",
+                    queryReplace(error.getSkippedString()));
         }
         ht_error.put("ErrorMsg", ret);
     }
 
     /**
-     * 
      * @param s, the string to convert
      * @return the string s with html character escaped
      */
     private String queryReplace(String s) {
         if (s != null) {
             int len = s.length();
-            StringBuilder ret = new StringBuilder(len+16);
+            StringBuilder ret = new StringBuilder(len + 16);
             char c;
 
             for (int i = 0; i < len; i++) {
                 switch (c = s.charAt(i)) {
-                case '&'  : ret.append("&amp;"); break;
-                case '\'' : ret.append("&#39;"); break;
-                case '"'  : ret.append("&quot;"); break;
-                case '<'  : ret.append("&lt;"); break;
-                case '>'  : ret.append("&gt;"); break;
-                default   : ret.append(c);
+                    case '&':
+                        ret.append("&amp;");
+                        break;
+                    case '\'':
+                        ret.append("&#39;");
+                        break;
+                    case '"':
+                        ret.append("&quot;");
+                        break;
+                    case '<':
+                        ret.append("&lt;");
+                        break;
+                    case '>':
+                        ret.append("&gt;");
+                        break;
+                    default:
+                        ret.append(c);
                 }
             }
             return ret.toString();
@@ -461,7 +471,8 @@
     }
 
     /**
-     * Display the output 
+     * Display the output
+     *
      * @require VelocityContext to be set and init()
      */
     public void print(PrintWriter out) {
@@ -476,12 +487,12 @@
     }
 
     /**
-     * The user doesn't want to see the error report when this function 
+     * The user doesn't want to see the error report when this function
      * is called
      */
     public void desactivateError() {
         context.put("no_errors_report", Boolean.TRUE);
-	// activate the no errors report
+        // activate the no errors report
     }
 
 }

Index: StyleSheetParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetParser.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- StyleSheetParser.java	5 Jan 2010 13:49:33 -0000	1.17
+++ StyleSheetParser.java	29 Aug 2011 07:21:00 -0000	1.18
@@ -7,16 +7,6 @@
 
 package org.w3c.css.css;
 
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import java.lang.reflect.Constructor;
-
 import org.w3c.css.parser.AtRule;
 import org.w3c.css.parser.AtRuleMedia;
 import org.w3c.css.parser.AtRulePage;
@@ -35,109 +25,115 @@
 import org.w3c.css.util.Warning;
 import org.w3c.css.util.Warnings;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.StringTokenizer;
+
 /**
  * @version $Revision$
  */
 public final class StyleSheetParser
-    implements CssValidatorListener, CssParser {
+        implements CssValidatorListener, CssParser {
 
     private static Constructor co = null;
 
     static {
-	try {
-	    Class c = java.lang.Exception.class;
-	    Class cp[] = { java.lang.Exception.class };
-	    co = c.getDeclaredConstructor(cp);
-	} catch (NoSuchMethodException ex) {
-	    co = null;
-	}
+        try {
+            Class c = java.lang.Exception.class;
+            Class cp[] = {java.lang.Exception.class};
+            co = c.getDeclaredConstructor(cp);
+        } catch (NoSuchMethodException ex) {
+            co = null;
+        }
     }
 
-    CssFouffa  cssFouffa;
+    CssFouffa cssFouffa;
     StyleSheet style = new StyleSheet();
 
     public void reInit() {
-    	style = new StyleSheet();
+        style = new StyleSheet();
     }
 
     public StyleSheet getStyleSheet() {
-	return style;
+        return style;
     }
 
     public void setWarningLevel(int warningLevel) {
-    	style.setWarningLevel(warningLevel);
+        style.setWarningLevel(warningLevel);
     }
-    
+
     public void notifyErrors(Errors errors) {
-    	style.addErrors(errors);
+        style.addErrors(errors);
     }
 
     public void notifyWarnings(Warnings warnings) {
-    	style.addWarnings(warnings);
+        style.addWarnings(warnings);
     }
 
     /**
      * Adds a vector of properties to a selector.
      *
      * @param selector     the selector
-     * @param declarations Properties to associate with contexts
+     * @param properties Properties to associate with contexts
      */
     public void handleRule(ApplContext ac, CssSelectors selector,
-			   Vector properties)
-    {
-	if (selector.getAtRule() instanceof AtRulePage) {
-	    style.remove(selector);
-	}
-	for (Enumeration e2 = properties.elements();e2.hasMoreElements();) {
-	    CssProperty property = (CssProperty) e2.nextElement();
-	    property.setSelectors(selector);
-	    style.addProperty(selector, property);
-	}
+                           ArrayList<CssProperty> properties) {
+        if (selector.getAtRule() instanceof AtRulePage) {
+            style.remove(selector);
+        }
+        for (CssProperty property : properties) {
+            property.setSelectors(selector);
+            style.addProperty(selector, property);
+        }
     }
 
     // part added by Sijtsche de Jong
 
     public void addCharSet(String charset) {
-	style.addCharSet(charset);
+        style.addCharSet(charset);
     }
 
     public void newAtRule(AtRule atRule) {
-	style.newAtRule(atRule);
+        style.newAtRule(atRule);
     }
 
     public void endOfAtRule() {
-	style.endOfAtRule();
+        style.endOfAtRule();
     }
 
     public void setImportant(boolean important) {
-	style.setImportant(important);
+        style.setImportant(important);
     }
 
-    public void setSelectorList(Vector selectors) {
-	style.setSelectorList(selectors);
+    public void setSelectorList(ArrayList<CssSelectors> selectors) {
+        style.setSelectorList(selectors);
     }
 
-    public void setProperty(Vector properties) {
-	style.setProperty(properties);
+    public void setProperty(ArrayList<CssProperty> properties) {
+        style.setProperty(properties);
     }
 
     public void endOfRule() {
-	style.endOfRule();
+        style.endOfRule();
     }
 
     public void removeThisRule() {
-	style.removeThisRule();
+        style.removeThisRule();
     }
 
     public void removeThisAtRule() {
-	style.removeThisAtRule();
+        style.removeThisAtRule();
     }
 
     //end of part added by Sijtsche de Jong
 
     /**
      * Handles an at-rule.
-     *
+     * <p/>
      * <p>The parameter <code>value</code> can be :
      * <DL>
      * <DT>CssString
@@ -146,252 +142,253 @@
      * <DD>The value coming from an URL.
      * <DT>Vector
      * <DD>The value is a vector of declarations (it contains properties).
-     *     This feature is not legal, so be careful.
+     * This feature is not legal, so be careful.
      * </DL>
      *
-     * @param ident The ident for this at-rule (for example: 'font-face')
+     * @param ident  The ident for this at-rule (for example: 'font-face')
      * @param string The string representation if this at-rule
      */
     public void handleAtRule(ApplContext ac, String ident, String string) {
-	style.getWarnings().addWarning(new Warning(cssFouffa.getSourceFile(),
-						   cssFouffa.getLine(),
-						   "at-rule",
-						   2,
-						   new String[] { ident, string },
-						   ac));
-	//stylesheet.addAtRule(atRule);
+        style.getWarnings().addWarning(new Warning(cssFouffa.getSourceFile(),
+                cssFouffa.getLine(),
+                "at-rule",
+                2,
+                new String[]{ident, string},
+                ac));
+        //stylesheet.addAtRule(atRule);
     }
 
     /**
-     * @param url the URL containing the style sheet
-     * @param title the title of the stylesheet
-     * @param kind may be a stylesheet or an alternate stylesheet
-     * @param media the media to apply this
+     * @param url    the URL containing the style sheet
+     * @param title  the title of the stylesheet
+     * @param kind   may be a stylesheet or an alternate stylesheet
+     * @param media  the media to apply this
      * @param origin the origin of the style sheet
-     * @exception IOException an IO error
+     * @throws IOException an IO error
      */
     public void parseURL(ApplContext ac, URL url, String title,
-			 String kind, String media,
-			 int origin) {
-    	setWarningLevel(ac.getWarningLevel());
-	if (Util.onDebug) {
-	    System.err.println( "StyleSheet.parseURL(" + url + ", "
-				+ title + ", "
-				+ kind + ", " + media + ", "
-				+ origin + ")" );
-	}
-	if (kind != null) {
-	    kind = kind.trim().toLowerCase();
-	    if (!kind.equals("stylesheet") && !kind.equals("alternate stylesheet")) {
-		return;
-	    }
-	}
+                         String kind, String media,
+                         int origin) {
+        setWarningLevel(ac.getWarningLevel());
+        if (Util.onDebug) {
+            System.err.println("StyleSheet.parseURL(" + url + ", "
+                    + title + ", "
+                    + kind + ", " + media + ", "
+                    + origin + ")");
+        }
+        if (kind != null) {
+            kind = kind.trim().toLowerCase();
+            if (!kind.equals("stylesheet") && !kind.equals("alternate stylesheet")) {
+                return;
+            }
+        }
 
-	try {
-	    ac.setOrigin(origin);
+        try {
+            ac.setOrigin(origin);
 //	    if (cssFouffa == null) {
-	    cssFouffa = new CssFouffa(ac, url);
-	    cssFouffa.addListener(this);
+            cssFouffa = new CssFouffa(ac, url);
+            cssFouffa.addListener(this);
 //	    } else {
 //		cssFouffa.ReInit(ac, url);
 //	    }
 
-	    //	    cssFouffa.setResponse(res);
+            //	    cssFouffa.setResponse(res);
 
-	    // removed plh 2001-03-08
-	    // cssFouffa.setOrigin(origin);
-	    //	    cssFouffa.setDefaultMedium(defaultmedium);
-	    //	    cssFouffa.doConfig();
-	    if (media == null) {
-		if (ac.getMedium() == null) {
-		    media = "all";
-		} else {
-		    media = ac.getMedium();
-		}
-	    }
-	    AtRuleMedia m = new AtRuleMedia();
-	    try {
-	    addMedias(m, media, ac);
-		cssFouffa.setAtRule(m);
-	    } catch (org.w3c.css.util.InvalidParamException e) {
-		Errors er = new Errors();
-		er.addError(new org.w3c.css.parser.CssError(url.toString(),
-							    -1, e));
-		notifyErrors(er);
-		return;
-	    }
-	    cssFouffa.parseStyle();
-	} catch (Exception e) {
-	    Errors er = new Errors();
-	    er.addError(new org.w3c.css.parser.CssError(url.toString(),
-							-1, e));
-	    notifyErrors(er);
-	}
+            // removed plh 2001-03-08
+            // cssFouffa.setOrigin(origin);
+            //	    cssFouffa.setDefaultMedium(defaultmedium);
+            //	    cssFouffa.doConfig();
+            if (media == null) {
+                if (ac.getMedium() == null) {
+                    media = "all";
+                } else {
+                    media = ac.getMedium();
+                }
+            }
+            AtRuleMedia m = new AtRuleMedia();
+            try {
+                addMedias(m, media, ac);
+                cssFouffa.setAtRule(m);
+            } catch (org.w3c.css.util.InvalidParamException e) {
+                Errors er = new Errors();
+                er.addError(new org.w3c.css.parser.CssError(url.toString(),
+                        -1, e));
+                notifyErrors(er);
+                return;
+            }
+            cssFouffa.parseStyle();
+        } catch (Exception e) {
+            Errors er = new Errors();
+            er.addError(new org.w3c.css.parser.CssError(url.toString(),
+                    -1, e));
+            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);
-		}
+        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
      *
      * @param input the inputStream containing the style data
-     * @param url the name of the file the style element was read in.
-     * @exception IOException an IO error
+     * @param url   the name of the file the style element was read in.
+     * @throws IOException an IO error
      */
     public void parseStyleElement(ApplContext ac, InputStream input,
-				  String title, String media,
-				  URL url, int lineno) {
-    	style.setWarningLevel(ac.getWarningLevel());
-	if (Util.onDebug) {
-	    System.err.println("StyleSheet.parseStyleElement(" + title + ", "
-			       + media + ", " + url
-			       + "," + lineno + ")" );
-	}
-	try {
+                                  String title, String media,
+                                  URL url, int lineno) {
+        style.setWarningLevel(ac.getWarningLevel());
+        if (Util.onDebug) {
+            System.err.println("StyleSheet.parseStyleElement(" + title + ", "
+                    + media + ", " + url
+                    + "," + lineno + ")");
+        }
+        try {
 
 //	    if (cssFouffa == null) {
-	    String charset = ac.getCharsetForURL(url);
-	    cssFouffa = new CssFouffa(ac, input, charset, url, lineno);
-		cssFouffa.addListener(this);
+            String charset = ac.getCharsetForURL(url);
+            cssFouffa = new CssFouffa(ac, input, charset, url, lineno);
+            cssFouffa.addListener(this);
 //	    } else {
 //		cssFouffa.ReInit(ac, input, url, lineno);
 //	    }
 
-	    //	    cssFouffa.setResponse(res);
-	    //	    cssFouffa.setDefaultMedium(defaultmedium);
-	    //	    cssFouffa.doConfig();
+            //	    cssFouffa.setResponse(res);
+            //	    cssFouffa.setDefaultMedium(defaultmedium);
+            //	    cssFouffa.doConfig();
 
-	    if (media == null) {
-		media = "all";
-	    }
+            if (media == null) {
+                media = "all";
+            }
 
-	    AtRuleMedia m = new AtRuleMedia();
-	    try {
-	    	addMedias(m, media, ac);
-		cssFouffa.setAtRule(m);
-	    } catch (org.w3c.css.util.InvalidParamException e) {
-		Errors er = new Errors();
-		er.addError(new org.w3c.css.parser.CssError(url.toString(),
-							    -1, e));
-		notifyErrors(er);
-		return;
-	    }
-	    cssFouffa.parseStyle();
-	} catch (IOException e) {
-	    Errors er = new Errors();
-	    er.addError(new org.w3c.css.parser.CssError(url.toString(),
-							-1, e));
-	    notifyErrors(er);
-	} catch(TokenMgrError e) {
-	    Errors er = new Errors();
-	    CssParseException cpe = null;
-	    if (co != null) {
-		try {
-		    Object o[] = new Object[1];
-		    o[0] = e;
-		    Exception new_e = (Exception) co.newInstance(o);
-		    cpe = new CssParseException(new_e);
-		} catch (Exception ex) {
-		    cpe = null;
-		}
-	    }
-	    if (cpe == null) {
-		cpe = new CssParseException(new Exception(e.getMessage()));
-	    }
-	    er.addError(new org.w3c.css.parser.CssError(url.toString(),
-                            -1,
-							//e.getErrorLine(),
-							cpe));
-	    notifyErrors(er);
-	} catch(RuntimeException e) {
-	    Errors er = new Errors();
-	    er.addError(new org.w3c.css.parser.CssError(url.toString(),
-							cssFouffa.getLine(),
-						    new CssParseException(e)));
-	    notifyErrors(er);
-	}
+            AtRuleMedia m = new AtRuleMedia();
+            try {
+                addMedias(m, media, ac);
+                cssFouffa.setAtRule(m);
+            } catch (org.w3c.css.util.InvalidParamException e) {
+                Errors er = new Errors();
+                er.addError(new org.w3c.css.parser.CssError(url.toString(),
+                        -1, e));
+                notifyErrors(er);
+                return;
+            }
+            cssFouffa.parseStyle();
+        } catch (IOException e) {
+            Errors er = new Errors();
+            er.addError(new org.w3c.css.parser.CssError(url.toString(),
+                    -1, e));
+            notifyErrors(er);
+        } catch (TokenMgrError e) {
+            Errors er = new Errors();
+            CssParseException cpe = null;
+            if (co != null) {
+                try {
+                    Object o[] = new Object[1];
+                    o[0] = e;
+                    Exception new_e = (Exception) co.newInstance(o);
+                    cpe = new CssParseException(new_e);
+                } catch (Exception ex) {
+                    cpe = null;
+                }
+            }
+            if (cpe == null) {
+                cpe = new CssParseException(new Exception(e.getMessage()));
+            }
+            er.addError(new org.w3c.css.parser.CssError(url.toString(),
+                    -1,
+                    //e.getErrorLine(),
+                    cpe));
+            notifyErrors(er);
+        } catch (RuntimeException e) {
+            Errors er = new Errors();
+            er.addError(new org.w3c.css.parser.CssError(url.toString(),
+                    cssFouffa.getLine(),
+                    new CssParseException(e)));
+            notifyErrors(er);
+        }
     }
 
     /**
      * @param input the inputStream containing the style data
      * @param url   the name of the file the style element was read in.
-     * @exception IOException an IO error
+     * @throws IOException an IO error
+     * @see #parseStyleElement(ApplContext, InputStream, String, String, URL, int)
      * @deprecated Replaced by parseStyleElement
-     * @see #parseStyleElement(InputStream, URL, int)
      */
     public void parseStyleElement(ApplContext ac, String input, URL url, int lineno) {
-	parseStyleElement(ac, new ByteArrayInputStream(input.getBytes()),
-			  null, null, url, lineno);
+        parseStyleElement(ac, new ByteArrayInputStream(input.getBytes()),
+                null, null, url, lineno);
     }
 
     /**
      * Parse some declarations. All declarations always comes from the user
      *
      * @param input the inputStream containing the style data
-     * @param id the uniq id
-     * @param filename the name of the file the style element was read in.
-     * @exception IOException an IO error
+     * @param id    the uniq id
+     * @param url   the URL the style element was read in.
+     * @throws IOException an IO error
      */
     public void parseStyleAttribute(ApplContext ac, InputStream input, String id,
-				    URL url, int lineno) {
-    	style.setWarningLevel(ac.getWarningLevel());
-	lineno--; // why ?!?!
-	if (Util.onDebug) {
-	    System.err.println("StyleSheet.parseStyleAttribute(" + id + ","
-			       + url + "," + lineno + ")" );
-	}
+                                    URL url, int lineno) {
+        style.setWarningLevel(ac.getWarningLevel());
+        lineno--; // why ?!?!
+        if (Util.onDebug) {
+            System.err.println("StyleSheet.parseStyleAttribute(" + id + ","
+                    + url + "," + lineno + ")");
+        }
 
-	try {
-	    //	    if (cssFouffa == null) {
-	    String charset = ac.getCharsetForURL(url);
-	    cssFouffa = new CssFouffa(ac, input, charset, url, lineno);
-	    cssFouffa.addListener(this);
-	    //	    } else
+        try {
+            //	    if (cssFouffa == null) {
+            String charset = ac.getCharsetForURL(url);
+            cssFouffa = new CssFouffa(ac, input, charset, url, lineno);
+            cssFouffa.addListener(this);
+            //	    } else
 //		cssFouffa.ReInit(ac, input, url, lineno);
-	    CssSelectors selector = new CssSelectors(ac);
+            CssSelectors selector = new CssSelectors(ac);
 
-	    try {
-		AtRuleMedia media = new AtRuleMedia();
-		media.addMedia("all", ac);
-		cssFouffa.setAtRule(media);
-	    } catch (InvalidParamException e) {} //ignore
+            try {
+                AtRuleMedia media = new AtRuleMedia();
+                media.addMedia("all", ac);
+                cssFouffa.setAtRule(media);
+            } catch (InvalidParamException e) {
+            } //ignore
 
-	    try {
-		selector.addId(new IdSelector(id.substring(1)));;
-	    } catch  (InvalidParamException e) {
-		style.removeThisRule();
-		ac.getFrame().addError(new CssError(e));
-	    }
-	    cssFouffa.parseDeclarations(selector);
-	} catch (IOException e) {
-	    Errors er = new Errors();
-	    er.addError(new org.w3c.css.parser.CssError(url.toString(),
-							-1, e));
-	    notifyErrors(er);
-	}
+            try {
+                selector.addId(new IdSelector(id.substring(1)));
+            } catch (InvalidParamException e) {
+                style.removeThisRule();
+                ac.getFrame().addError(new CssError(e));
+            }
+            cssFouffa.parseDeclarations(selector);
+        } catch (IOException e) {
+            Errors er = new Errors();
+            er.addError(new org.w3c.css.parser.CssError(url.toString(),
+                    -1, e));
+            notifyErrors(er);
+        }
     }
 
     /**
      * @param input the inputStream containing the style data
-     * @param id the uniq id
-     * @param url the name of the file the style element was read in.
-     * @exception IOException an IO error
+     * @param id    the uniq id
+     * @param url   the name of the file the style element was read in.
+     * @throws IOException an IO error
+     * @see #parseStyleAttribute(ApplContext, InputStream, String, URL, int)
      * @deprecated Replaced by parseStyleAttribute
-     * @see #parseStyleAttribute(InputStream, URL, int)
      */
     public void parseStyleAttribute(ApplContext ac, String input, String id,
-				    URL url, int lineno) {
-	parseStyleAttribute(ac, new ByteArrayInputStream(input.getBytes()),
-			    id, url, lineno);
+                                    URL url, int lineno) {
+        parseStyleAttribute(ac, new ByteArrayInputStream(input.getBytes()),
+                id, url, lineno);
     }
 
     public void setStyle(Class style) {
-	cssFouffa.setStyle(style);
+        cssFouffa.setStyle(style);
     }
 
 }
Received on Monday, 29 August 2011 07:21:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:46 UTC