This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 60056 - The case of close tags characters is affected by jsp comment conten between the close and open tag
Summary: The case of close tags characters is affected by jsp comment conten between t...
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Marek Fukala
URL:
Keywords:
: 60061 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-15 14:32 UTC by Jiri Kovalsky
Modified: 2005-11-04 13:44 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Kovalsky 2005-06-15 14:32:40 UTC
Development build #200506142000 of NetBeans 4.2
Windows XP, JDK 1.5.0_03 build #06

Description:
============
User has to close open HTML tags him/herself behind closed custom tags since
code completion does not suggest anything.

Steps to reproduce:
===================
1. Create new sample web application.
2. Add JSTL 1.1 library to the project.
3. Uncomment taglib directive at line 9.
4. Delete opening JSP comment tag at line 28 and corresponding closing tag at
line 33.
5. At line 33 type </| and invoke code completion.
6. Nothing is offered.
Comment 1 Jiri Kovalsky 2005-06-15 14:41:53 UTC
*** Issue 60061 has been marked as a duplicate of this issue. ***
Comment 2 Marek Fukala 2005-06-17 13:13:27 UTC
I found a minimal jsp page which demonstrates the problem:

<a>
<!-- ${a} -->
</

The problem is caused by an html comment which contains different tokens inside
(expression language, another jsp tag, directive or jsp comment). In such a case
the CC end tag is not offered.
Comment 3 Marek Fukala 2005-06-17 13:16:58 UTC
caused by:

javax.swing.text.BadLocationException: Misuse at 12
        at
org.netbeans.editor.ext.html.HTMLSyntaxSupport.getNextElement(HTMLSyntaxSupport.java:525)
        at
org.netbeans.editor.ext.html.HTMLSyntaxSupport.getElementChain(HTMLSyntaxSupport.java:350)
        at
org.netbeans.editor.ext.html.HTMLSyntaxSupport.getPreviousElement(HTMLSyntaxSupport.java:369)
        at
org.netbeans.editor.ext.html.SyntaxElement.getPrevious(SyntaxElement.java:82)
        at
org.netbeans.editor.ext.html.HTMLSyntaxSupport.getPossibleEndTags(HTMLSyntaxSupport.java:544)
        at
org.netbeans.editor.ext.html.HTMLCompletionQuery.query(HTMLCompletionQuery.java:221)
        at
org.netbeans.modules.web.core.syntax.completion.JspCompletionQuery.query(JspCompletionQuery.java:87)
        at
org.netbeans.modules.web.core.syntax.completion.JspCompletionProvider.queryImpl(JspCompletionProvider.java:154)
        at
org.netbeans.modules.web.core.syntax.completion.JspCompletionProvider$Query.query(JspCompletionProvider.java:96)
        at
org.netbeans.spi.editor.completion.support.AsyncCompletionTask.run(AsyncCompletionTask.java:181)
        at org.openide.util.Task.run(Task.java:207)
        at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:435)
        at
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:836)
Comment 4 Jiri Kovalsky 2005-06-17 13:29:30 UTC
This does not work in NetBeans 4.1 too.
Comment 5 Marek Fukala 2005-06-17 14:40:21 UTC
just note that tag matching doesn't work for html comments in this case as well.
Comment 6 Marek Fukala 2005-06-20 10:52:19 UTC
fixed

Checking in HTMLSyntaxSupport.java;
/cvs/html/editor/lib/src/org/netbeans/editor/ext/html/HTMLSyntaxSupport.java,v 
<--  HTMLSyntaxSupport.java
new revision: 1.14; previous revision: 1.13
done
Comment 7 Jiri Kovalsky 2005-06-21 07:48:07 UTC
It has improved indeed however one minor problem occured. Both closing tags are
suggested in uppercase which is inconsistent with rest of the editor. Above
stated steps to reproduce will offer </BODY> and </HTML> whereas if you type </
and invoke code completion right below opening <body> tag, code completion
suggests </body> and </html>.

Trying to verify in development build #200506201800 of NetBeans 4.2.
Comment 8 Marek Fukala 2005-06-21 16:18:23 UTC
I cannot reproduce it on latest build [20050621-17:00SELC]. Both html and body
end tags are offered in lower case even after jsp custom tags. Please verify
whether it still doesn't work.
Comment 9 Jiri Kovalsky 2005-06-23 16:06:37 UTC
Please double check it again. If you follow the procedure exactly step by step,
you will face the uppercase close tags too. Still reproducible in development
build #200506221800 of NetBeans 4.2.
Comment 10 Marek Fukala 2005-06-23 16:16:19 UTC
There is a bug in "smart case" code which determines the case of the open tag. 
A minimal version which can reproduce the problem:

<body>
<%-- A --%>
</BODY>
Comment 11 Marek Fukala 2005-10-13 13:15:02 UTC
The "smartcase" is totally broken - ach joooo :-(. But do not shout to me, I
didn't write it. I will try to rewrite it to give reasonable results.

For example:
<BODY a="b">
</| + CC => completes </body> (according to the attribute case)

... or ...

<A>
<b></b>
</| + CC => completes </a> (according to the <b> tag case)


Comment 12 Marek Fukala 2005-10-13 13:45:03 UTC
I fixed all mentined problems in this issue except the last example - the
character case is gotten from first found tag backward, not from pair open tag.
But it worked like that for several years and no one complained about. If
someone really wants this fixed fill a P5 or P4 please.

Checking in
html/editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java;
/cvs/html/editor/lib/src/org/netbeans/editor/ext/html/HTMLCompletionQuery.java,v
 <--  HTMLCompletionQuery.java
new revision: 1.22; previous revision: 1.21
done
Comment 13 Jiri Kovalsky 2005-11-04 13:44:04 UTC
Works fine in development build #200511031900 of NetBeans 5.0.