https://issues.apache.org/bugzilla/show_bug.cgi?id=50023
Summary: [patch] [jstl.core] confusing and complicated call
with simple solution
Product: Tomcat 7
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Jasper
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=26099)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26099)
patch
Hi,
While doing some static analysis on the Tomcat codebase, I came across this
piece of code, which was considered strange for the analysis:
if(hasContext){
ctxt.generateJavaSource(contextName + " = ");
ctxt.generateAttribute("context");
ctxt.generateJavaSource(";");
}
It takes a long time to understand that in this case, ctxt.generateAttribute is
equivalent to ctxt.getConstantAttribute (passing through
org.apache.jasper.compiler.Generator.GenerateVisitor.visit(AttributeGenerator)).
For sake of maintainability / readability, I suggest doing as as in other
classes implementing TagPlugin and using getConstantAttribute instead (e.g. in
Url.java: if(hasScope){ strScope = ctxt.getConstantAttribute("scope");}
A patch is attached,
Regards, --Martin
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]