View | Details | Raw Unified | Return to bug 54240
Collapse All | Expand All

(-)apache/jasper/compiler/TagPluginManager.java (-5 / +51 lines)
Lines 17-23 Link Here
17
17
18
package org.apache.jasper.compiler;
18
package org.apache.jasper.compiler;
19
19
20
import java.io.IOException;
20
import java.io.InputStream;
21
import java.io.InputStream;
22
import java.net.URL;
23
import java.util.Enumeration;
21
import java.util.HashMap;
24
import java.util.HashMap;
22
import java.util.Iterator;
25
import java.util.Iterator;
23
26
Lines 68-84 Link Here
68
        });
71
        });
69
72
70
    }
73
    }
71
 
74
75
    public static final String META_INF_JASPER_TAG_PLUGINS_XML = "META-INF/jasper/tagPlugins.xml";
76
72
    private void init(ErrorDispatcher err) throws JasperException {
77
    private void init(ErrorDispatcher err) throws JasperException {
73
        if (initialized)
78
        if (initialized)
74
            return;
79
            return;
75
80
81
        tagPlugins = new HashMap<String, TagPlugin>();
82
        
83
        Enumeration<URL> urls = null;
84
        try {
85
            urls = ctxt.getClassLoader().getResources(META_INF_JASPER_TAG_PLUGINS_XML);
86
        } catch (IOException e) {
87
        }
88
        if (urls != null) {
89
            while(urls.hasMoreElements()) {
90
                URL url = urls.nextElement();
91
                InputStream is = null;
92
                try {
93
                    is = url.openStream();
94
                    loadTagPlugins(err, is);
95
                }
96
                catch(IOException ioe) {
97
                    throw new JasperException(ioe);
98
                }
99
                finally {
100
                    try {
101
                        is.close();
102
                    }
103
                    catch(IOException ex) {
104
                    }
105
                }
106
            }
107
        }
76
        InputStream is = ctxt.getResourceAsStream(TAG_PLUGINS_XML);
108
        InputStream is = ctxt.getResourceAsStream(TAG_PLUGINS_XML);
77
        if (is == null)
109
        if (is != null) {
78
            return;
110
            try {
111
                loadTagPlugins(err, is);
112
            }
113
            finally {
114
                try {
115
                    is.close();
116
                }
117
                catch(IOException ex) {
118
                }
119
            }
120
        }
79
121
80
        TreeNode root = (new ParserUtils()).parseXMLDocument(TAG_PLUGINS_XML,
122
        initialized = true;
81
                                                             is);
123
    }
124
125
    private void loadTagPlugins(ErrorDispatcher err, InputStream is)
126
            throws JasperException {
127
        TreeNode root = (new ParserUtils()).parseXMLDocument(TAG_PLUGINS_XML, is);
82
        if (root == null) {
128
        if (root == null) {
83
            return;
129
            return;
84
        }
130
        }

Return to bug 54240