glassfish
  1. glassfish
  2. GLASSFISH-20449

Unable to use jsp .tag files when there are session beans in the web application (WAR)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 4.0_b86_RC2
    • Fix Version/s: 4.0_b88_RC4
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Mac OSX, JDK 1.7.0_21

      Description

      Simple web application with .tag file in WEB-INF/tags. Create a simple stateless session bean. Create two jsp files using the .tag file, and only one of them will work. If the stateless bean is removed both jsp files work.

      The custom tag in the .tag file only works for the first viewed jsp, the others referring that same tag will not work (unless the session bean is removed).

        Activity

        Hide
        kchung added a comment -

        Verified that the problem exists in B87. I have a fix in jsp-impl, yet to be integrated.

        Show
        kchung added a comment - Verified that the problem exists in B87. I have a fix in jsp-impl, yet to be integrated.
        Hide
        Peter Salomonsen added a comment -

        replaced javax.servlet.jsp-2.3.2-SNAPSHOT.jar into gf/modules/javax.servlet.jsp fixed the issue.

        Show
        Peter Salomonsen added a comment - replaced javax.servlet.jsp-2.3.2-SNAPSHOT.jar into gf/modules/javax.servlet.jsp fixed the issue.
        Hide
        kchung added a comment -

        Change Control comments

        • What is the impact on the customer of the bug?

        A major functionality will not work if not fixed.

        • What is the cost/risk of fixing the bug?

        There two parts to the fix
        1. Don't generate codes to invoke ResourceInjector for tag files.
        2. For classic tag handlers and tag that extends SimpleTags, generate code to invoke ResourceInjector.PreDestroy

        The risk is medium, since it potentially affects codes generated for all JSP pages. However, risk is also limited in a sense, because it removes unnecessary calls to ResourceInjector (for tag file) and adds cleanups (for others), so it should not alter the behavior of existing working JSP pages.

        • Is there an impact on documentation or message strings?

        No.

        • Which tests should QA (re)run to verify the fix did not destabilize GlassFish?

        JSP portion of devtests. JSP tck tests (except EL related tests)

        • Which is the targeted build of 4.0 for this fix?

        b88 final build

        • If this an integration of a new version of a component from another project,
          what are the changes that are being brought in? This might be list of
          Jira issues from that project or a list of revision messages.

        Project: jsp
        Repository: svn
        Revision: 1453
        Author: kchung
        Date: 2013-05-06 21:16:13 UTC
        Link:

        Log Message:
        ------------
        1. Tag files should not call recource injector
        2. Tag handler should call PreDestroy when released.
        This fixes https://java.net/jira/browse/GLASSFISH-20449 and https://java.net/jira/browse/GLASSFISH-18650

        Revisions:
        ----------
        1453

        Diffs:
        ------
        Index: trunk/impl/src/main/java/org/apache/jasper/compiler/Generator.java
        ===================================================================
        — trunk/impl/src/main/java/org/apache/jasper/compiler/Generator.java (revision 1452)
        +++ trunk/impl/src/main/java/org/apache/jasper/compiler/Generator.java (revision 1453)
        @@ -2429,6 +2429,10 @@
        out.print(tagHandlerVar);
        out.println(");");
        } else

        { + out.printin("if (_jspx_resourceInjector != null) "); + out.print("_jspx_resourceInjector.preDestroy("); + out.print(tagHandlerVar); + out.println(");"); out.printin(tagHandlerVar); out.println(".release();"); }

        @@ -2472,6 +2476,10 @@
        out.print(tagHandlerVar);
        out.println(");");
        } else

        { + out.printin("if (_jspx_resourceInjector != null) "); + out.print("_jspx_resourceInjector.preDestroy("); + out.print(tagHandlerVar); + out.println(");"); out.printin(tagHandlerVar); out.println(".release();"); }

        @@ -2511,11 +2519,15 @@
        out.print(" ");
        out.print(tagHandlerVar);
        out.print(" = ");

        • out.print("(_jspx_resourceInjector != null) ? ");
        • out.print("_jspx_resourceInjector.createTagHandlerInstance(");
          + if (n.getTagFileInfo() == null) { + // Tag files do not support resource injection + out.print("(_jspx_resourceInjector != null)? "); + out.print("_jspx_resourceInjector.createTagHandlerInstance("); + out.print(tagHandlerClassName); + out.print(".class) : "); + }

          + out.print("new ");
          out.print(tagHandlerClassName);

        • out.print(".class) : new ");
        • out.print(tagHandlerClassName);
          out.println("();");

        generateSetters(n, tagHandlerVar, handlerInfo, true);
        @@ -2561,6 +2573,14 @@
        declareScriptingVars(n, VariableInfo.AT_END);
        syncScriptingVars(n, VariableInfo.AT_END);

        + if (n.getTagFileInfo() == null)

        { + // Tag files do not support resource injection + out.printin("if (_jspx_resourceInjector != null) "); + out.print("_jspx_resourceInjector.preDestroy("); + out.print(tagHandlerVar); + out.println(");"); + }

        +
        n.setEndJavaLine(out.getJavaLine());
        }

        Show
        kchung added a comment - Change Control comments What is the impact on the customer of the bug? A major functionality will not work if not fixed. What is the cost/risk of fixing the bug? There two parts to the fix 1. Don't generate codes to invoke ResourceInjector for tag files. 2. For classic tag handlers and tag that extends SimpleTags, generate code to invoke ResourceInjector.PreDestroy The risk is medium, since it potentially affects codes generated for all JSP pages. However, risk is also limited in a sense, because it removes unnecessary calls to ResourceInjector (for tag file) and adds cleanups (for others), so it should not alter the behavior of existing working JSP pages. Is there an impact on documentation or message strings? No. Which tests should QA (re)run to verify the fix did not destabilize GlassFish? JSP portion of devtests. JSP tck tests (except EL related tests) Which is the targeted build of 4.0 for this fix? b88 final build If this an integration of a new version of a component from another project, what are the changes that are being brought in? This might be list of Jira issues from that project or a list of revision messages. Project: jsp Repository: svn Revision: 1453 Author: kchung Date: 2013-05-06 21:16:13 UTC Link: Log Message: ------------ 1. Tag files should not call recource injector 2. Tag handler should call PreDestroy when released. This fixes https://java.net/jira/browse/GLASSFISH-20449 and https://java.net/jira/browse/GLASSFISH-18650 Revisions: ---------- 1453 Diffs: ------ Index: trunk/impl/src/main/java/org/apache/jasper/compiler/Generator.java =================================================================== — trunk/impl/src/main/java/org/apache/jasper/compiler/Generator.java (revision 1452) +++ trunk/impl/src/main/java/org/apache/jasper/compiler/Generator.java (revision 1453) @@ -2429,6 +2429,10 @@ out.print(tagHandlerVar); out.println(");"); } else { + out.printin("if (_jspx_resourceInjector != null) "); + out.print("_jspx_resourceInjector.preDestroy("); + out.print(tagHandlerVar); + out.println(");"); out.printin(tagHandlerVar); out.println(".release();"); } @@ -2472,6 +2476,10 @@ out.print(tagHandlerVar); out.println(");"); } else { + out.printin("if (_jspx_resourceInjector != null) "); + out.print("_jspx_resourceInjector.preDestroy("); + out.print(tagHandlerVar); + out.println(");"); out.printin(tagHandlerVar); out.println(".release();"); } @@ -2511,11 +2519,15 @@ out.print(" "); out.print(tagHandlerVar); out.print(" = "); out.print("(_jspx_resourceInjector != null) ? "); out.print("_jspx_resourceInjector.createTagHandlerInstance("); + if (n.getTagFileInfo() == null) { + // Tag files do not support resource injection + out.print("(_jspx_resourceInjector != null)? "); + out.print("_jspx_resourceInjector.createTagHandlerInstance("); + out.print(tagHandlerClassName); + out.print(".class) : "); + } + out.print("new "); out.print(tagHandlerClassName); out.print(".class) : new "); out.print(tagHandlerClassName); out.println("();"); generateSetters(n, tagHandlerVar, handlerInfo, true); @@ -2561,6 +2573,14 @@ declareScriptingVars(n, VariableInfo.AT_END); syncScriptingVars(n, VariableInfo.AT_END); + if (n.getTagFileInfo() == null) { + // Tag files do not support resource injection + out.printin("if (_jspx_resourceInjector != null) "); + out.print("_jspx_resourceInjector.preDestroy("); + out.print(tagHandlerVar); + out.println(");"); + } + n.setEndJavaLine(out.getJavaLine()); }
        Hide
        Tom Mueller added a comment -

        Approved for GF 4.0

        Show
        Tom Mueller added a comment - Approved for GF 4.0
        Hide
        kchung added a comment -

        Fix committed to 4.0 branch and trunk.

        Show
        kchung added a comment - Fix committed to 4.0 branch and trunk.

          People

          • Assignee:
            kchung
            Reporter:
            Peter Salomonsen
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: