Skip to content

Commit 0bece55

Browse files
committed
Define warning and medium args properly in CLI
Compared to how parameters are passed to the servlet and their default values, there is a difference with CLI which was causing different results when running the test suite. This will consider the warning argument properly, so that the count of warning is correct depending on the value of the parameter This will also pass the 'medium' argument properly as well, because it should not be considered for CSS1 (like the servlet does)
1 parent 0cd4c90 commit 0bece55

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

org/w3c/css/css/CssValidator.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.w3c.css.css;
1111

1212
import org.w3c.css.util.ApplContext;
13+
import org.w3c.css.util.CssVersion;
1314
import org.w3c.css.util.HTTPURL;
1415
import org.w3c.css.util.Messages;
1516
import org.w3c.css.util.Util;
@@ -79,13 +80,21 @@ public void setOptionsFromParams() {
7980
String profile = params.get("profile");
8081
ac.setCssVersionAndProfile(profile);
8182

82-
// medium to use
83-
ac.setMedium(params.get("medium"));
83+
// media, only if we are not using CSS1
84+
if (ac.getCssVersion() != CssVersion.CSS1) {
85+
String usermedium = params.get("medium");
86+
if (usermedium == null || usermedium.isEmpty()) {
87+
usermedium = "all";
88+
}
89+
ac.setMedium(usermedium);
90+
}
8491

8592
String vextwarn = params.get("vextwarning");
8693
ac.setTreatVendorExtensionsAsWarnings("true".equalsIgnoreCase(vextwarn));
8794
// TODO for now we use the same parameter for both vendor extensions and CSS Hacks.
8895
ac.setTreatCssHacksAsWarnings("true".equalsIgnoreCase(vextwarn));
96+
97+
ac.setWarningLevel(Integer.parseInt(params.get("warning")));
8998
}
9099

91100
public static void main(String args[])

0 commit comments

Comments
 (0)