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

2002/css-validator/org/w3c/css/css HTMLParserStyleSheetHandler.java,1.2,1.3 StyleSheetParser.java,1.23,1.24 TagSoupStyleSheetHandler.java,1.10,1.11 XMLStyleSheetHandler.java,1.33,1.34

From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 03 Nov 2011 16:00:41 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1RLzib-0005dd-PA@lionel-hutz.w3.org>
Update of /sources/public/2002/css-validator/org/w3c/css/css
In directory hutz:/tmp/cvs-serv21605/org/w3c/css/css

Modified Files:
	HTMLParserStyleSheetHandler.java StyleSheetParser.java 
	TagSoupStyleSheetHandler.java XMLStyleSheetHandler.java 
Log Message:
Recast of Ville Skytt&auml; patch to add Referer, Fixes http://www.w3.org/Bugs/Public/show_bug.cgi?id=14634

Index: StyleSheetParser.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/StyleSheetParser.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- StyleSheetParser.java	24 Oct 2011 19:49:03 -0000	1.23
+++ StyleSheetParser.java	3 Nov 2011 16:00:39 -0000	1.24
@@ -172,6 +172,8 @@
     public void parseURL(ApplContext ac, URL url, String title,
                          String kind, String media,
                          int origin) {
+        boolean doneref = false;
+        URL ref = ac.getReferrer();
         setWarningLevel(ac.getWarningLevel());
         if (Util.onDebug) {
             System.err.println("StyleSheet.parseURL(" + url + ", "
@@ -185,7 +187,6 @@
                 return;
             }
         }
-
         try {
             ac.setOrigin(origin);
 //	    if (cssFouffa == null) {
@@ -223,12 +224,18 @@
                 notifyErrors(er);
                 return;
             }
+            ac.setReferrer(url);
+            doneref = true;
             cssFouffa.parseStyle();
         } catch (Exception e) {
             Errors er = new Errors();
             er.addError(new org.w3c.css.parser.CssError(url.toString(),
                     -1, e));
             notifyErrors(er);
+        } finally {
+            if (doneref) {
+                ac.setReferrer(ref);
+            }
         }
     }
 
@@ -263,12 +270,14 @@
     public void parseStyleElement(ApplContext ac, InputStream input,
                                   String title, String media,
                                   URL url, int lineno) {
+        boolean doneref = false;
         style.setWarningLevel(ac.getWarningLevel());
         if (Util.onDebug) {
             System.err.println("StyleSheet.parseStyleElement(" + title + ", "
                     + media + ", " + url
                     + "," + lineno + ")");
         }
+        URL ref = ac.getReferrer();
         try {
 
 //	    if (cssFouffa == null) {
@@ -299,6 +308,8 @@
                 notifyErrors(er);
                 return;
             }
+            ac.setReferrer(url);
+            doneref = true;
             cssFouffa.parseStyle();
         } catch (IOException e) {
             Errors er = new Errors();
@@ -332,6 +343,10 @@
                     cssFouffa.getLine(),
                     new CssParseException(e)));
             notifyErrors(er);
+        } finally {
+            if (doneref) {
+                ac.setReferrer(ref);
+            }
         }
     }
 

Index: XMLStyleSheetHandler.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/XMLStyleSheetHandler.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- XMLStyleSheetHandler.java	31 Oct 2011 18:32:19 -0000	1.33
+++ XMLStyleSheetHandler.java	3 Nov 2011 16:00:39 -0000	1.34
@@ -527,9 +527,12 @@
         //    }
         //}
         source.setByteStream(in);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(url.toString());
         } finally {
+            ac.setReferrer(ref);
             in.close();
         }
     }
@@ -583,9 +586,12 @@
         //   }
         //}
         source.setSystemId(urlString);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(source);
         } finally {
+            ac.setReferrer(ref);
             cis.close();
         }
     }

Index: HTMLParserStyleSheetHandler.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/HTMLParserStyleSheetHandler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- HTMLParserStyleSheetHandler.java	31 Oct 2011 18:32:19 -0000	1.2
+++ HTMLParserStyleSheetHandler.java	3 Nov 2011 16:00:39 -0000	1.3
@@ -542,9 +542,12 @@
         baseURI = new URL(fileName);
         documentURI = new URL(fileName);
         source.setSystemId(fileName);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(source);
         } finally {
+            ac.setReferrer(ref);
             in.close();
         }
     }
@@ -596,9 +599,12 @@
         //   }
         //}
         source.setByteStream(in);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(url.toString());
         } finally {
+            ac.setReferrer(ref);
             in.close();
         }
     }
@@ -650,9 +656,12 @@
         //   }
         //}
         source.setSystemId(urlString);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(source);
         } finally {
+            ac.setReferrer(ref);
             cis.close();
         }
     }

Index: TagSoupStyleSheetHandler.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/css/TagSoupStyleSheetHandler.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- TagSoupStyleSheetHandler.java	31 Oct 2011 18:32:19 -0000	1.10
+++ TagSoupStyleSheetHandler.java	3 Nov 2011 16:00:39 -0000	1.11
@@ -71,7 +71,7 @@
     String type = null;
     String title = null;
     String charset = null;
-    StringBuilder text = new StringBuilder(255);
+    StringBuilder text = new StringBuilder();
 
     Locator locator;
 
@@ -534,9 +534,12 @@
         baseURI = new URL(fileName);
         documentURI = new URL(fileName);
         source.setSystemId(fileName);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(source);
         } finally {
+            ac.setReferrer(ref);
             in.close();
         }
     }
@@ -588,9 +591,12 @@
         //   }
         //}
         source.setByteStream(in);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(url.toString());
         } finally {
+            ac.setReferrer(ref);
             in.close();
         }
     }
@@ -642,9 +648,12 @@
         //   }
         //}
         source.setSystemId(urlString);
+        URL ref = ac.getReferrer();
         try {
+            ac.setReferrer(documentURI);
             xmlParser.parse(source);
         } finally {
+            ac.setReferrer(ref);
             cis.close();
         }
     }
Received on Thursday, 3 November 2011 16:02:53 UTC

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