Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "com.sun.jsp.tldUriToLocationMap" ServletContext attribute is ignored during TLD scanning #4

Open
glassfishrobot opened this issue Mar 23, 2016 · 5 comments

Comments

@glassfishrobot
Copy link

The "com.sun.jsp.tldUriToLocationMap" ServletContext attribute (a.k.a. Constants.JSP_TLD_URI_TO_LOCATION_MAP) is a feature that was introduced in GLASSFISH-747 via org.apache.jasper.runtime.TldScanner.

Even though the TldScanner#getLocation(String) method correctly retrieves the value of this attribute and populates a map...

public String[] getLocation(String uri) throws JasperException {
        if (mappings == null) {
            // Recovering the map done in onStart.
            mappings = (HashMap<String, String[]>) ctxt.getAttribute(
            Constants.JSP_TLD_URI_TO_LOCATION_MAP);
        }
        ...
}

The problem is that the TldScanner#scanTlds() method always re-initializes the map to an empty HashMap which causes TldScanner to forget the value of the attribute:

private void scanTlds() throws JasperException {

        mappings = new HashMap<String, String[]>();
        ...
}

Affected Versions

[current]

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Reported by ngriffin7a

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
Was assigned to super_glassfish

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
ngriffin7a said:
patch

======================================

diff --git a/org/apache/jasper/runtime/TldScanner.java b/org/apache/jasper/runtime/TldScanner.java
index 0d3e9c8..3ec378a 100644
--- a/org/apache/jasper/runtime/TldScanner.java
+++ b/org/apache/jasper/runtime/TldScanner.java
@@ -343,7 +343,9 @@ public class TldScanner implements ServletContainerInitializer {
      */
     private void scanTlds() throws JasperException {

-        mappings = new HashMap<String, String[]>();
+        if (mappings == null) {
+            mappings = new HashMap<String, String[]>();
+        }

         // Make a local copy of the system jar cache 
         jarTldCacheLocal.putAll(jarTldCache);

@glassfishrobot
Copy link
Author

@glassfishrobot Commented
This issue was imported from java.net JIRA JSP-52

@glassfishrobot
Copy link
Author

@glassfishrobot glassfishrobot self-assigned this Aug 17, 2018
@markt-asf markt-asf transferred this issue from jakartaee/pages Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant