Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CA39D200B40 for ; Thu, 2 Jun 2016 04:26:04 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id C8C93160A4D; Thu, 2 Jun 2016 02:26:04 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1CD7E160A4C for ; Thu, 2 Jun 2016 04:26:03 +0200 (CEST) Received: (qmail 24311 invoked by uid 500); 2 Jun 2016 02:26:03 -0000 Mailing-List: contact dev-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Developers List" Delivered-To: mailing list dev@tomcat.apache.org Received: (qmail 24299 invoked by uid 99); 2 Jun 2016 02:26:03 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Jun 2016 02:26:03 +0000 Received: from asf-bz1-us-mid.priv.apache.org (nat1-us-mid.apache.org [23.253.172.122]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPS id D6F5B1A02C8 for ; Thu, 2 Jun 2016 02:26:02 +0000 (UTC) Received: by asf-bz1-us-mid.priv.apache.org (ASF Mail Server at asf-bz1-us-mid.priv.apache.org, from userid 33) id D9E85602E2; Thu, 2 Jun 2016 02:26:01 +0000 (UTC) From: bugzilla@apache.org To: dev@tomcat.apache.org Subject: [Bug 59654] New: Jsp spec violation in tld identifying? Date: Thu, 02 Jun 2016 02:26:01 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Tomcat 7 X-Bugzilla-Component: Jasper X-Bugzilla-Version: trunk X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: huxing.zhang@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@tomcat.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bz.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 archived-at: Thu, 02 Jun 2016 02:26:05 -0000 https://bz.apache.org/bugzilla/show_bug.cgi?id=3D59654 Bug ID: 59654 Summary: Jsp spec violation in tld identifying? Product: Tomcat 7 Version: trunk Hardware: All OS: All Status: NEW Severity: major Priority: P2 Component: Jasper Assignee: dev@tomcat.apache.org Reporter: huxing.zhang@gmail.com What the spec says: JSP.7.3.1 Identifying Tag Library Descriptors ... TLD files should not be placed in /WEB-INF/classes or /WEB-INF/lib, and must not be placed inside /WEB-INF/tags or a subdirectory of it, unless named implicit.tld and intended to configure an implicit tag library with its JSP version and tlib-version. Out test case: We have simple web app with the following structure: test =E2=94=9C=E2=94=80=E2=94=80 WEB-INF =E2=94=82=C2=A0=C2=A0 =E2=94=9C=E2=94=80=E2=94=80 classes =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 tags =E2=94=82=C2=A0=C2=A0 =E2=94=94=E2=94=80=E2=94=80 test.tld =E2=94=94=E2=94=80=E2=94=80 taglib.jsp test.tld: 1.0 f get java.lang.System java.lang.String getProperty(java.lang.String) taglib.jsp: <%@page contentType=3D"text/html;charset=3DUTF-8" pageEncoding=3D"UTF-8"%> <%@ taglib uri=3D"/WEB-INF/tags/test.tld" prefix=3D"f"%>

${f:get("java.home")}

Tomcat 7.0.69 behavior: After deploying the test web app and visit http://localhost:8080/test/taglib.jsp, the jsp page gets compiled and java = home has been correctly displayed. Tomcat 8 & 9 trunk behavior: When visiting http://localhost:8080/test/taglib.jsp, server responded with = HTTP 500: HTTP Status 500 - Unable to find taglib "f" for URI: /WEB-INF/tags/test.tld org.apache.jasper.JasperException: Unable to find taglib "f" for URI: /WEB-INF/tags/test.tld =20=20=20 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler= .java:55) =20=20=20 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:27= 7) =20=20=20 org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:75) =20=20=20 org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.jav= a:183) org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:421) org.apache.jasper.compiler.Parser.parseDirective(Parser.java:479) org.apache.jasper.compiler.Parser.parseElements(Parser.java:1435) org.apache.jasper.compiler.Parser.parse(Parser.java:139) =20=20=20 org.apache.jasper.compiler.ParserController.doParse(ParserController.java:2= 27) =20=20=20 org.apache.jasper.compiler.ParserController.parse(ParserController.java:100) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199) org.apache.jasper.compiler.Compiler.compile(Compiler.java:356) org.apache.jasper.compiler.Compiler.compile(Compiler.java:336) org.apache.jasper.compiler.Compiler.compile(Compiler.java:323) =20=20=20 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:= 585) =20=20=20 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:= 363) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) Conclusion: Clearly the tomcat 7 behavior is against spec, which I think should be fixe= d. Analysis: After some digging, I found that the tld file is skipped during tld scan ph= ase. However, when parsing tag lib directive, the org.apache.jasper.compiler.TagLibraryInfoImpl#generateTLDLocation didn't ch= eck the tld file location that is prohibited by spec. Since the implementation is quite different between tomcat 7 % tomcat 8+. I found it hard to backport the tomcat 8 implementation to tomcat 7. Therefor= e, the fix should be specific to tomcat 7(tomcat 6 is not investigated.) Proposed Fix: Please refer to the attachment. I've added a dedicated message to indicate such an behaivor is violating sp= ec. p.s.=20 Should we also add the dedicated message to tomcat 8+ ? Because the message "Unable to find taglib "f" for URI: /WEB-INF/tags/test.tld" is somewhat confusing. The file does exist, it is the spec that requires tomcat not to = load it. --=20 You are receiving this mail because: You are the assignee for the bug.= --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org For additional commands, e-mail: dev-help@tomcat.apache.org