Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 133702 - Editor ignores web.xml <include-prelude> tag
Editor ignores web.xml <include-prelude> tag
Status: VERIFIED FIXED
Product: javaee
Classification: Unclassified
Component: JSP Parser
6.x
All All
: P2 (vote)
: 6.x
Assigned To: Tomas Mysik
issues@javaee
61fixes2-fixed
: REGRESSION
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2008-04-22 18:19 UTC by Martin Schovanek
Modified: 2008-07-10 15:02 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schovanek 2008-04-22 18:19:20 UTC
To reproduce:
1) have a header.jspf:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

2) have a following section in the web.xml:
<jsp-config>
    <jsp-property-group>
        <url-pattern>*.jsp</url-pattern>
        <include-prelude>/header.jspf</include-prelude>
        <include-coda>/footer.jspf</include-coda>
    </jsp-property-group>
</jsp-config-->
3) create a .jsp like:
<c:out value="XYZ"/>

ERROR: the Core JSTL is not included and the <c:out... is not recognized as Core JSTL's tag.

NOTE: this case should be covered by test specification and a qa-functional automated test.
Comment 1 Tomasz Slota 2008-04-23 12:50:55 UTC
The problem is located in JSP parser, PageInfo.getIncludePrelude() returns an empty list.
Comment 2 Tomas Mysik 2008-04-24 08:29:14 UTC
Reproduced, I tried to find out what is wrong - but no success. I will investigate more.
Comment 3 Tomas Mysik 2008-04-24 09:44:13 UTC
Workaround: restart IDE helps. Hopefully it is not so frequent operation to add/remove these tags.
Comment 4 pslechta 2008-06-03 13:37:38 UTC
Hello tmyslik,

can you please fix this bug as soon as possible (till 09-Jun-2008), so it can be part of NB 6.1 patch 2?

Thanks!
Comment 5 pslechta 2008-06-03 15:10:08 UTC
I cannot reproduce this problem on NB 6.1 patch 1 on Win XP. The example works for me...
Comment 6 Martin Schovanek 2008-06-03 16:18:47 UTC
Still reproducible on my Mac OS X, Jardo can you try to reproduce on Win platform please?
Comment 7 Jaroslav Pospisil 2008-06-03 17:46:36 UTC
Reproducible also on Win Vista with all-updated NB6.1 ML FCS.
Comment 8 pslechta 2008-06-05 14:13:25 UTC
Just to clarify the issue: the problem is with syntax highlighting and code completion only.
Compilation (including JSP files) and deployment works fine. After deployment, the page shows expected result.
Comment 9 Tomas Mysik 2008-06-05 15:03:30 UTC
IMHO this issue is not P2 because 'include-prelude' and 'include-coda' are not ignored, they are not "refreshed" after 
change (IDE restart helps). It's bug but still I don't think that it is so common use case. Of course, I can be wrong.
I will try to look at it during this weekend.
Comment 10 pslechta 2008-06-05 15:52:15 UTC
I would say that it is some caching issue.
When the IDE is restarted, it remembers the information from prelude. But if you comment it out from web.xml, it still
remembers it. Closing and opening the project does not help (IDE restart helps)...
Comment 11 pslechta 2008-06-06 16:46:10 UTC
Caching issue.

WebAppParseSupport.createCompilationContext uses cached options for parser (line 374):
        Options options = useEditor ? editorOptions : diskOptions;

Options are implemented by OptionsImpl and this class caches JspConfig (constructor, line 78):
        jspConfig = new JspConfig(context, this);

org.apache.jasper.compiler.JspConfig (from glassfish-jspparser-2.0.jar) caches results from parsing web.xml file (search
for processWebDotXml method), the method is called just once, so web.xml is parsed also only once (cannot provide line
numbers because I did not have sources for this file so I had to decompile).

The fix may be to refresh options in WebAppParseSupport before each parsing:

--- a/web.jspparser/extsrc/org/netbeans/modules/web/jspparser_ext/WebAppParseSupport.java       Wed Jun 04 11:40:45 2008
+0200
+++ b/web.jspparser/extsrc/org/netbeans/modules/web/jspparser_ext/WebAppParseSupport.java       Fri Jun 06 17:40:18 2008
+0200
@@ -374,6 +374,7 @@
         Options options = useEditor ? editorOptions : diskOptions;
         ServletContext context = useEditor ? editorContext : diskContext;
         JspCompilationContext clctxt = null;
+        reinitOptions();
         try {
             if (isTagFile) {
                 clctxt = new JspCompilationContext(jspUri, null,  options, context, null, rctxt, null);

I tried this fix and it works for me.

Tomas, please let me know if the fix is OK (any performance/other objections?) and if I can push it into trunk... Thanks!
Comment 12 pslechta 2008-06-06 17:01:01 UTC
Better diff attached:

--- a/web.jspparser/extsrc/org/netbeans/modules/web/jspparser_ext/WebAppParseSupport.java       Wed Jun 04 11:40:45 2008
+0200
+++ b/web.jspparser/extsrc/org/netbeans/modules/web/jspparser_ext/WebAppParseSupport.java       Fri Jun 06 18:00:01 2008
+0200
@@ -371,6 +371,7 @@
     private synchronized JspCompilationContext createCompilationContext(FileObject jspFile, boolean useEditor) {
         boolean isTagFile = determineIsTagFile(jspFile);
         String jspUri = getJSPUri(jspFile);
+        reinitOptions();
         Options options = useEditor ? editorOptions : diskOptions;
         ServletContext context = useEditor ? editorContext : diskContext;
         JspCompilationContext clctxt = null;
Comment 13 Tomas Mysik 2008-06-09 09:50:32 UTC
The fix is IMHO not OK because it just clears the cache *every time* - I have to find out what is wrong and then fix 
it. Let's discuss it more face to face. Thanks for your investigation Petr.
Comment 14 Tomas Mysik 2008-06-10 09:32:23 UTC
Fixed.
http://hg.netbeans.org/main/rev/e0de9ae374ce
Comment 15 pslechta 2008-06-10 13:03:58 UTC
QA, please verify this issue till 12-Jun-2008 so it can be part of NB 6.1 patch 2.
Thanks!
Comment 16 Martin Schovanek 2008-06-10 16:19:00 UTC
v.
Comment 17 pslechta 2008-06-10 17:05:30 UTC
The fix has been ported into the release61_fixes repository.

http://hg.netbeans.org/release61_fixes/rev/73c1dec2758b
Comment 18 Quality Engineering 2008-06-11 15:56:13 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #251 build
Changeset: http://hg.netbeans.org/main/rev/e0de9ae374ce
User: Tomas Mysik <tmysik@netbeans.org>
Log: #133702: Editor ignores web.xml <include-prelude> tag


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo