2002/css-validator/org/w3c/css/servlet CssValidator.java,1.40,1.41

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

Modified Files:
	CssValidator.java 
Log Message:
last round for uploaded files with BOM

Index: CssValidator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- CssValidator.java	15 Feb 2009 18:23:37 -0000	1.40
+++ CssValidator.java	16 Feb 2009 16:42:14 -0000	1.41
@@ -641,7 +641,6 @@
 	    ac.setFakeFile(file);
 	    fileName = file.getName();
 	    Util.verbose("File : " + fileName);
-	    is = file.getInputStream();
 	    // another way to get file type...
 	    isCSS = file.getContentType().equals(textcss);
 	} else if (text != null ) {
@@ -650,13 +649,15 @@
 	    Util.verbose("- " + fileName + " Data -");
 	    Util.verbose(text);
 	    Util.verbose("- End of " + fileName + " Data");
-	    is = new ByteArrayInputStream(text.getBytes());
 	    //quick test that works in most cases to determine wether it's 
 	    //HTML or CSS
 	    isCSS = isCSS(text);
 	}
 	fileName = "file://localhost/" + fileName;
   	try {
+	    URL u = new URL(fileName);
+	    is = ac.getFakeInputStream(u);
+
 	    ac.setFakeURL(fileName);
 	    if (isCSS) {
 		//if CSS:
@@ -664,15 +665,16 @@
 		parser.parseStyleElement(ac, is, null, usermedium,
 					 new URL(fileName), 0);
 	  	  
-		handleRequest(ac, res, fileName, parser
-			      .getStyleSheet(), output, warningLevel, errorReport);
+		handleRequest(ac, res, fileName, parser.getStyleSheet(),
+			      output, warningLevel, errorReport);
 	    } else {
 		// else, trying HTML
-		TagSoupStyleSheetHandler handler = new TagSoupStyleSheetHandler(null, ac);
+		TagSoupStyleSheetHandler handler;
+		handler = new TagSoupStyleSheetHandler(null, ac);
 		handler.parse(is, fileName);
 
-		handleRequest(ac, res, fileName, handler.getStyleSheet(), output,
-			      warningLevel, errorReport);
+		handleRequest(ac, res, fileName, handler.getStyleSheet(),
+			      output, warningLevel, errorReport);
 	    }
 	} catch (ProtocolException pex) {
 	    if (Util.onDebug) {

Received on Monday, 16 February 2009 16:42:24 UTC