Bug 63724 - Compile JSP to class when using Tiles and custom tag fails
Summary: Compile JSP to class when using Tiles and custom tag fails
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 9.0.21
Hardware: All Mac OS X 10.1
: P2 major (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-04 11:10 UTC by Carlos Hager
Modified: 2019-09-05 18:38 UTC (History)
0 users



Attachments
stacktrace (19.16 KB, text/plain)
2019-09-04 11:10 UTC, Carlos Hager
Details
source code of the project to be tested (23.21 KB, application/zip)
2019-09-05 13:58 UTC, Carlos Hager
Details
print of debug showing why it fails (90.49 KB, image/png)
2019-09-05 13:59 UTC, Carlos Hager
Details
print of debug showing how it was when used to work (84.75 KB, image/png)
2019-09-05 14:00 UTC, Carlos Hager
Details
stacktrace of the example project (5.61 KB, text/plain)
2019-09-05 14:12 UTC, Carlos Hager
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Hager 2019-09-04 11:10:42 UTC
Created attachment 36758 [details]
stacktrace

The commit "Replace custom split(String,String) method with call to String.split by Christopher Schultz on 08/05/19 at 21:55 and git hash f7c41d120c6374a8221b684a5ad5ede3d1621ff4" introduced a bug in the version of Apache Tomcat 9.0.21 where the jsp pages using taglibs within struts tiles template are no longer being parsed properly.


I got the latest git version and revert the commit (f7c41d120c6374a8221b684a5ad5ede3d1621ff4) mentioned above. The jsp pages are being parsed properly again.

This is bug under jasper.jar / class org.apache.jasper.compiler.JspUtil.java
Comment 1 Mark Thomas 2019-09-04 17:22:40 UTC
Please provide the simplest possible example (which is probably going to be a WAR file) - including source - that demonstrates this issue.
Comment 2 Carlos Hager 2019-09-05 13:58:05 UTC
Created attachment 36760 [details]
source code of the project to be tested

simple project which works till version 9.0.20 and fail with the higher versions 

using gradle 4.10.X to generate the war to be deployed run: $ gradle clean build war
Comment 3 Carlos Hager 2019-09-05 13:59:50 UTC
Created attachment 36761 [details]
print of debug showing why it fails

print of debug showing why it fails, when new split method is considering the first "/" and adding and extra "." to the package name causing the fail
Comment 4 Carlos Hager 2019-09-05 14:00:55 UTC
Created attachment 36762 [details]
print of debug showing how it was when used to work

the local split method wasn't considering the the first "/" and the package name was being build properly
Comment 5 Carlos Hager 2019-09-05 14:08:46 UTC
(In reply to Mark Thomas from comment #1)
> Please provide the simplest possible example (which is probably going to be
> a WAR file) - including source - that demonstrates this issue.

Hi Mark, thank for the quick reply. I have attached the source code of the project (war had 4mb and was being blocked) and 2 prints while debugging.

On the method JspUtil().makeJavaPackage, the split method used to not considerate the first "/" of the String. But the new refactor it does take this situation in count, causing the make a java package with "..", how you can see in the stacktrace.

Stacktrace:

An error occurred at line: [1] in the generated java file: [/Users/carloshager/Library/Caches/IntelliJIdea2019.2/tomcat/Unnamed_error-example/work/Catalina/localhost/error_example/org/apache/jsp/tag/meta//WEB_002dINF/customTldResource_tld/main/jsPerformanceLog_tag.java]
The declared package "" does not match the expected package "org.apache.jsp.tag.meta.WEB_002dINF.customTldResource_tld.main"

An error occurred at line: [9] in the generated java file: [/Users/carloshager/Library/Caches/IntelliJIdea2019.2/tomcat/Unnamed_error-example/work/Catalina/localhost/error_example/org/apache/jsp/tag/meta//WEB_002dINF/customTldResource_tld/main/jsPerformanceLog_tag.java]
Syntax error on token ".", delete this token
Comment 6 Carlos Hager 2019-09-05 14:12:51 UTC
Created attachment 36763 [details]
stacktrace of the example project

stacktrace of the example project
Comment 7 Mark Thomas 2019-09-05 18:38:09 UTC
Thanks for the test case. It made it much easier to be sure that the issue was fixed.

Fixed in:
- master for 9.0.25 onwards