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

2002/css-validator/org/w3c/css/servlet CssValidator.java,1.28,1.29

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 20 Jul 2007 05:58:33 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1IBlVZ-0006cK-1n@lionel-hutz.w3.org>

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

Modified Files:
	CssValidator.java 
Log Message:
enabling doPost for direct input

Index: CssValidator.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/servlet/CssValidator.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- CssValidator.java	13 Jul 2007 13:32:20 -0000	1.28
+++ CssValidator.java	20 Jul 2007 05:58:29 -0000	1.29
@@ -495,6 +495,8 @@
 	    for (int i = 0; i < tmp.length; i++) {
 		if (tmp[i].getName().equals("file")) {
 		    file = (FakeFile) tmp[i].getValue();
+		} else if (tmp[i].getName().equals("text")) {
+		    text = (String) tmp[i].getValue();
 		} else if (tmp[i].getName().equals("output")) {
 		    output = (String) tmp[i].getValue();
 		} else if (tmp[i].getName().equals("warning")) {
@@ -522,7 +524,7 @@
 	if (output == null) {
 	    output = texthtml;
 	}
-	if (file == null || file.getSize() == 0) {
+	if (file == null || file.getSize() == 0 || text == null || text.length() == 0) {
 	    // res.sendError(res.SC_BAD_REQUEST,
 	    // "You have send an invalid request");
 	    handleError(res, ac, output, "No file",
@@ -564,21 +566,45 @@
 	} else {
 	    ac.setCssVersion("css21");
 	}
-	
-	Util.verbose("File : " + file.getName());
+	if (file != null && file.getSize() != 0) {
+  	Util.verbose("File : " + file.getName());
 
-	parser = new StyleSheetParser();
+  	parser = new StyleSheetParser();
 
-	try {
-	    parser.parseStyleElement(ac, file.getInputStream(), null, null,
-				     new URL("file://localhost/" + file.getName()), 0);
+  	try {
+  	    parser.parseStyleElement(ac, file.getInputStream(), null, null,
+  				     new URL("file://localhost/" + file.getName()), 0);
 
-	    handleRequest(ac, res, "file://localhost/" + file.getName(), parser
-			  .getStyleSheet(), output, warningLevel, errorReport);
-	} catch (Exception e) {
-	    handleError(res, ac, output, file.getName(), e, false);
-	}
+  	    handleRequest(ac, res, "file://localhost/" + file.getName(), parser
+  			  .getStyleSheet(), output, warningLevel, errorReport);
+  	} catch (Exception e) {
+  	    handleError(res, ac, output, file.getName(), e, false);
+  	}
+  }
+  else {
+      Util.verbose("- TextArea Data -");
+	    Util.verbose(text);
+	    Util.verbose("- End of TextArea Data");
 
+	    parser = new StyleSheetParser();
+
+	    try {
+                
+		parser.parseStyleElement(ac,
+			new ByteArrayInputStream(text.getBytes()),
+			null, usermedium,
+			new URL("file://localhost/TextArea"), 0);
+
+		handleRequest(ac, res, "file://localhost/TextArea",
+			parser.getStyleSheet(), output, warningLevel,
+			errorReport);
+	    } catch (Exception e) {
+		handleError(res, ac, output, "TextArea", e, false);
+	    }
+	  
+  }
+  
+  
 	Util.verbose("CssValidator: Request terminated.\n");
     }
 
Received on Friday, 20 July 2007 05:58:35 GMT

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