W3C home > Mailing lists > Public > www-validator-cvs@w3.org > June 2004

2002/css-validator/org/w3c/css/servlet CssValidator.java,1.13,1.14

From: Sijtsche Smeman <sijtsche@dev.w3.org>
Date: Tue, 1 Jun 2004 06:15:45 -0400 (EDT)
Message-Id: <6ECBE0F6-B3B6-11D8-9D40-000A95E54002@dev.w3.org>
To: www-validator-cvs@w3.org




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

Modified Files:
	CssValidator.java
Log Message:
default supplied for usermedium

Index: CssValidator.java
===================================================================
RCS file:  
/sources/public/2002/css-validator/org/w3c/css/servlet/ 
CssValidator.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- CssValidator.java	7 Apr 2004 09:59:01 -0000	1.13
+++ CssValidator.java	1 Jun 2004 10:15:42 -0000	1.14
@@ -224,6 +224,10 @@
  	    ac.setCredential(credential);
  	}

+	if (usermedium == null || "".equals(usermedium)) {
+		usermedium = "all";
+	}
+
  	InputStream in = req.getInputStream();

  	ac.setMedium(usermedium);
@@ -259,10 +263,10 @@
  	    System.err.println( "[DEBUG]  profile is : " + ac.getCssVersion()
  				+ " medium is " + usermedium);
  	}
-	
+
  	// verify the request
  	if ((uri == null) && (text == null)) {
-	    // res.sendError(res.SC_BAD_REQUEST,
+	    // res.sendError(res.SC_BAD_REQUEST,
              //                "You have send an invalid request.");
  	    handleError(res, "No file",
  	     new  
IOException(ac.getMsg().getServletString("invalid-request")));
@@ -324,7 +328,7 @@
  	    parser = new StyleSheetParser();

  	    try {
-		parser.parseStyleElement(ac,
+		parser.parseStyleElement(ac,
  				     new ByteArrayInputStream(text.getBytes()),
  				     null, usermedium,
  				     new URL("file://localhost/TextArea"), 0);
@@ -386,7 +390,7 @@
  	String warning = null;
  	String error = null;
  	String profile = null;
-	String usermedium = null;
+	String usermedium = "all";

  	ServletInputStream in = req.getInputStream();
  	byte[] buf = new byte[2048];
@@ -395,7 +399,7 @@
  	int len;

  	if (req.getParameter("debug") != null) {
-	    Util.onDebug = req.getParameter("debug").equals("true") ||
+	    Util.onDebug = req.getParameter("debug").equals("true") ||
  		Util.onDebug;
  	    if (Util.onDebug) {
  		System.err.println("SWITCH DEBUG MODE REQUEST");
@@ -438,27 +442,32 @@
  	    System.arraycopy(general, 0, buf, 0, count);
  	    NVPair[] tmp = Codecs.mpFormDataDecode(buf, req.getContentType());
  	    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("output")) {
-		    output = (String) tmp[i].getValue();
-		} else if (tmp[i].getName().equals("warning")) {
-		    warning = (String) tmp[i].getValue();
-		} else if (tmp[i].getName().equals("error")) {
-		    warning = (String) tmp[i].getValue();
-		} else if (tmp[i].getName().equals("input")) {
-		    XMLinput = ((String) tmp[i].getValue()).equals("XML");
-		} else if (tmp[i].getName().equals("profile")) {
-		    profile = (String) tmp[i].getValue();
-		} else if (tmp[i].getName().equals("usermedium")) {
-		    usermedium = (String) tmp[i].getValue();
-		    ac.setMedium(usermedium);
-		}
+			if (tmp[i].getName().equals("file")) {
+				file = (FakeFile) tmp[i].getValue();
+			} else if (tmp[i].getName().equals("output")) {
+				output = (String) tmp[i].getValue();
+			} else if (tmp[i].getName().equals("warning")) {
+				warning = (String) tmp[i].getValue();
+			} else if (tmp[i].getName().equals("error")) {
+				warning = (String) tmp[i].getValue();
+			} else if (tmp[i].getName().equals("input")) {
+				XMLinput = ((String) tmp[i].getValue()).equals("XML");
+			} else if (tmp[i].getName().equals("profile")) {
+				profile = (String) tmp[i].getValue();
+			} else if (tmp[i].getName().equals("usermedium")) {
+				usermedium = (String) tmp[i].getValue();
+				if (usermedium == null || "".equals(usermedium)) {
+					usermedium = "all";
+				}
+			}
  	    }
  	} catch (Exception e) {
  	    System.out.println("Oups! Error in Util/Codecs.java?!?");
  	    e.printStackTrace();
  	}
+
+	ac.setMedium(usermedium);
+
  	if (output == null) {
  	    output = texthtml;
  	}
@@ -542,7 +551,7 @@
  	} else {
  	    res.setHeader("Content-Language", "en");
  	}
-	
+
  	if (styleSheet == null) {
  	    throw new IOException(ac.getMsg().getServletString("process")
  				  + " " + title);
@@ -558,7 +567,7 @@
  	}
  	styleSheet.findConflicts(ac);

-	StyleReport style = StyleReportFactory.getStyleReport(ac, title,
+	StyleReport style = StyleReportFactory.getStyleReport(ac, title,
  							      styleSheet,
  							      output,
  							      warningLevel);
Received on Tuesday, 1 June 2004 06:28:49 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:02:06 UTC