Leftover code in the CSS Validator ?


while doing some experiments to write a GUI for the CSS Validator, I've 
found a strange behaviour.
When validating http://www.w3.org, I've got some errors on:

voice-family: inherit;

Which seems perfectly acceptable.
The relevant code in ACssVoiceFamily is here:
if (val.equals(inherit)) {
     if(value.getCount() > 1) {
	throw new InvalidParamException("unrecognize", ac);
     inheritValue = true;

Which is fine and executed correctly, except that "val" is obtained by
CssValue val = value.getValue();
and getValue() does not consume the token.

Back in CssParser:
CssProperty p = handleDeclaration(string_property.toLowerCase(),
                                                   values, important);
// Did the property recognize all values in the expression ?
if (!values.end() && ac.getMedium() == null) {
      addError(new InvalidParamException("unrecognize", "", ac),
} else {
    // ok, return the new property
    {if (true) return p;}  <--- smells like temporary code :-D

So, in that case, "!values.end()" is true, and in my test, 
ac.getMedium() is null, thus the reported errors.

But, with the CSS Validator online service, there is no way to set 
Medium to null, thus the "errors" go unnoticed.
So basically, in the online validator, the execution path is this one:
if (false) {
} else {
    {if (true) return p;}

So... I don't know how to conclude. What happens next? :-)

Damien B

Received on Thursday, 24 July 2008 14:27:06 UTC