W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

[BUG + FIX] Null attribute values

From: Gary L Peskin <garyp@firstech.com>
Date: Fri, 4 Aug 2000 19:28:30 -0400 (EDT)
Message-ID: <398B51A7.C244D01B@firstech.com>
To: Html-Tidy <html-tidy@w3.org>
I've attached a particularly ugly piece of HTML code that I received.

You'll notice on line 59, there is a td element with a BACKGROUND=
element where the quotes seem to be hosed up.  When Tidy is parsing
this, it thinks BACKGROUND is the attribute and SRC= is the value of the
attribute.  So far, so good.

The next attribute is images/clearPixel.gif" and there is no value since
this is not followed by an equal sign.  This causes Tidy to vomit while
trying to reference a null pointer due to a null value being passed into
Report.attrError when reporting a BAD_ATTRIBUTE_VALUE.

My recommended fix for Java Tidy is to change Lexer.parseAttrs at line
2,612 of Lexer.java (8 july 2000 edition) from:

  Report.attrError(this, this.token, value, Report.BAD_ATTRIBUTE_VALUE);

to:

  if (value == null)
    Report.attrError(this, this.token, attribute,
Report.MISSING_ATTR_VALUE);
  else
    Report.attrError(this, this.token, value,
Report.BAD_ATTRIBUTE_VALUE);

Gary

Received on Friday, 4 August 2000 19:37:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 3 April 2012 06:13:44 GMT