Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 330335 - Wrong error shown by JspMarkupValidator for unknown tags.
Summary: Wrong error shown by JspMarkupValidator for unknown tags.
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: jst.jsp (show other bugs)
Version: 3.0.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.5 P   Edit
Assignee: Nick Sandonato CLA
QA Contact: Nick Sandonato CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-16 05:46 EST by Rakesh CLA
Modified: 2010-12-03 11:05 EST (History)
1 user (show)

See Also:
thatnitind: review+


Attachments
patch (3.48 KB, patch)
2010-11-16 05:52 EST, Rakesh CLA
no flags Details | Diff
patch (1.29 KB, patch)
2010-11-17 10:47 EST, Nick Sandonato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rakesh CLA 2010-11-16 05:46:21 EST
Build Identifier: M20090211-1700

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<unknowntag1> 
  <unknowntag2><jsp:attribute name="test"></jsp:attribute></unknowntag2> 
</unknowntag1>
</body>
</html>
Take above jsp, make any change in title(just to invoke source validator).Save file.You will error markers for unknown tags. These tags are generated by JspMarkupValidator for unmatching start and end tag. 

Reproducible: Always
Comment 1 Rakesh CLA 2010-11-16 05:52:07 EST
Created attachment 183210 [details]
patch

For unknown tags , there doesn't seem to an easy way to determine matching start-end tags .Although we can use a stack to keep track of start-end tags, but it would also report correct behavior for structures like <A><B></A></B>.I have ignored it for unknown tags.This behavior is not present in wtp 3.2.3 , it is happening in 3.0.5 .
Comment 2 Nick Sandonato CLA 2010-11-17 10:47:01 EST
Hi Rakesh,

I think it may be best to get to the root of the problem, and that is that unknown tags are automatically treated as non-containers. This then causes the end tag to not be paired with the start. We could backport the fix from bug 97566. But, in the scenario where people are expecting isContainer() to return false for elements without a CMElementDeclaration, we might cause problems.

The other option, if this is deemed too risky, is to update MarkupValidator directly. Since we know isContainer() returns false for these nodes, we can put the check directly in the else block that checks for "end tag that has no start tag" in #checkStartEndTagPairs(). if (startRegion == null) check for a CMElementDeclaration, if one doesn't exist for xmlNode, then ignore the unpaired start/end tags.

Nitin, do you think backporting the changes to ElementImpl#isContainer is too risky?
Comment 3 Nick Sandonato CLA 2010-11-17 10:47:22 EST
Created attachment 183308 [details]
patch
Comment 4 Nick Sandonato CLA 2010-12-03 11:05:47 EST
Code was released on 11/19.