Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005936 [Resin] block always 08-17-15 17:21 09-24-15 14:07
Reporter libor View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.45
Summary 0005936: JspTagSupport cannot be cast to javax.servlet.jsp.tagext.Tag
Description With upgrade to 4.0.45 many pages started failing with errors
XYZ cannot be cast to javax.servlet.jsp.tagext.Tag

I compared one of the failing fragments in generated by 4.0.40 with equivalent fragment compiled in 4.0.45

Fragment from 4.0.40, notice the use of TagAdapter:
    _jsp__xyz__tag_26 = new _jsp._WEB_22dINF._tags._xyz__tag();
    _jsp__xyz__tag_26_adapter = new javax.servlet.jsp.tagext.TagAdapter(_jsp__xyz__tag_26);
    _jsp__xyz__tag_26.setJspBody(_jsp_fragment_0 = createFragment_0(null, _jsp_parentContext, pageContext, _jsp__xyz__tag_26_adapter, getJspBody(), _jsp_state, _jsp_pageManager));

Fragment from 4.0.45:
    _jsp__xyz__tag_26 = _jsp_state.get_jsp__xyz__tag_26();
    com.caucho.jsp.PageContextWrapper _jsp_context42
            = _jsp_pageManager.createPageContextWrapper(pageContext);
    _jsp_context42.setAttribute("activeTest", _caucho_expr_2.evalString(_jsp_env));
    _jsp__xyz__tag_26.setJspBody(_jsp_fragment_0 = createFragment_0(_jsp_fragment_0, _jsp_parentContext, pageContext, _jsp__xyz__tag_26, getJspBody(), _jsp_state, _jsp_pageManager));}


    private _jsp._WEB_22dINF._tags._xyz__tag _jsp__xyz__tag_26;

    final _jsp._WEB_22dINF._tags._xyz__tag get_jsp__xyz__tag_26() throws Throwable
        if (_jsp__xyz__tag_26 == null) {
            _jsp__xyz__tag_26 = new _jsp._WEB_22dINF._tags._xyz__tag();

        return _jsp__xyz__tag_26;

In both cases the _jsp._WEB_22dINF._tags._xyz__tag extends, in 4.0.45 it is not wrapped before the attempt to cast it as javax.servlet.jsp.tagext.Tag

I don't see a way we can work around this issue, thus it is blocking us from upgrading to 4.0.45

A side note/question seems like the SimpleTag instances are now cached, but the documentation [^] states "Unlike classic tag handlers, simple tag handlers are never cached and reused by the JSP container." Is this going to cause problems???
Additional Information
Attached Files  0005936.tar.bz2 [^] (363,006 bytes) 09-21-15 17:07

- Relationships

- Notes
09-21-15 17:09

The 0005936.tar.bz2 contains minimal failing app.

The key seems to be the scriptlet in a.tag, it can be empty, but need to be present to cause the CCE.

The nested tag need to extend TagSupport
09-22-15 07:56

Thanks for the test case! We were able to easily reproduce it.

Resin 4.0.45 introduced a bug where it was looking for generated tag classes in the wrong directory (lower-cased, instead of what it was before). Because it couldn't find the classes, it fell back to a placeholder class, which was the cause for the exception. The bug only showed up for:

1. custom tag libraries
2. useBody

In reference to caching tags, the bug caused Resin to produce bad JSP code. Fixing the bug should produce JSP-spec compliant code (i.e. proper caching to tags).
09-24-15 14:07


- Issue History
Date Modified Username Field Change
08-17-15 17:21 libor New Issue
09-21-15 17:07 libor File Added: 0005936.tar.bz2
09-21-15 17:09 libor Note Added: 0006651
09-22-15 07:56 nam Note Added: 0006652
09-24-15 14:07 ferg Note Added: 0006653
09-24-15 14:07 ferg Assigned To  => ferg
09-24-15 14:07 ferg Status new => closed
09-24-15 14:07 ferg Resolution open => fixed
09-24-15 14:07 ferg Fixed in Version  => 4.0.46

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
35 total queries executed.
29 unique queries executed.
Powered by Mantis Bugtracker