2002/css-validator/org/w3c/css/parser CssFouffa.java,1.58,1.59

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

Modified Files:
	CssFouffa.java 
Log Message:
various things: Use of BigIntegers to avoid limits, background-* are now avoiding multiplication of checks and properties in CssXStyles impls, various updates for other properties, use of a string reader for string input, added the possibility of not following links, prepared for aggregation of all uris parsed

Index: CssFouffa.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/parser/CssFouffa.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- CssFouffa.java	21 Oct 2011 12:52:29 -0000	1.58
+++ CssFouffa.java	9 Feb 2012 17:36:27 -0000	1.59
@@ -33,6 +33,7 @@
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLConnection;
 import java.nio.charset.Charset;
@@ -70,19 +71,19 @@
 
     ArrayList<String> visited = null;
 
+
     /**
      * Create a new CssFouffa with a data input and a begin line number.
      *
-     * @param input     data input
+     * @param ac        The validation context
+     * @param reader    The data stream reader
      * @param file      The source file (use for errors, warnings and import)
      * @param beginLine The begin line number in the file. (used for HTML for example)
      * @throws IOException if an I/O error occurs.
      */
-    public CssFouffa(ApplContext ac, InputStream input, String charset,
-                     URL file, int beginLine)
+    public CssFouffa(ApplContext ac, Reader reader, URL file, int beginLine)
             throws IOException {
-        super(new InputStreamReader(input, (charset == null) ?
-                "iso-8859-1" : charset));
+        super(reader);
         if (ac.getOrigin() == -1) {
             setOrigin(StyleSheetOrigin.AUTHOR); // default is user
         } else {
@@ -133,6 +134,21 @@
     }
 
     /**
+     * Create a new CssFouffa with a data input and a begin line number.
+     *
+     * @param input     data input
+     * @param file      The source file (use for errors, warnings and import)
+     * @param beginLine The begin line number in the file. (used for HTML for example)
+     * @throws IOException if an I/O error occurs.
+     */
+    public CssFouffa(ApplContext ac, InputStream input, String charset,
+                     URL file, int beginLine)
+            throws IOException {
+        this(ac, new InputStreamReader(input, (charset == null) ?
+                "iso-8859-1" : charset), file, beginLine);
+    }
+
+    /**
      * Create a new CssFouffa with a data input.
      *
      * @param input data input
@@ -407,6 +423,24 @@
         newAtRule(importrule);
         endOfAtRule();
 
+        URL importedURL;
+        try {
+        importedURL = HTTPURL.getURL(url, file);
+        } catch (MalformedURLException mue) {
+            if (!Util.noErrorTrace) {
+                ac.getFrame().addError(new CssError(mue));
+            } 
+            return;
+        }
+        
+        // add it to the list of linked URIs
+        ac.addLinkedURI(importedURL);
+        // check if we need to follow it
+        if (!ac.followlinks()) {
+            // TODO add a warning ?
+            return;
+        }
+
         //if it's not permitted to import... (direct input)
         if (url.getProtocol().equals("file")) {
             ac.getFrame().addWarning("unsupported-import");
@@ -414,7 +448,6 @@
         }
 
         try {
-            URL importedURL = HTTPURL.getURL(url, file);
             String surl = importedURL.toString();
 
             if (visited == null) {
@@ -815,8 +848,8 @@
         // loadConfig("css2", null);
     }
 
-    public CssFouffa(ApplContext ac, Reader stream) {
-        super(stream);
+    public CssFouffa(ApplContext ac, Reader reader) {
+        super(reader);
         this.ac = ac;
         properties = new CssPropertyFactory(ac.getPropertyKey());
     }

Received on Thursday, 9 February 2012 17:37:05 UTC