Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330335

Summary: Wrong error shown by JspMarkupValidator for unknown tags.
Product: [WebTools] WTP Source Editing Reporter: Rakesh <rakes123>
Component: jst.jspAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nick Sandonato <nsand.dev>
Severity: normal    
Priority: P3 CC: thatnitind
Version: 3.0.5Flags: thatnitind: review+
Target Milestone: 3.0.5 P   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch
none
patch none

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.