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

(-)java/org/apache/catalina/security/SecurityUtil.java (-7 / +15 lines)
Lines 35-40 Link Here
35
import javax.servlet.http.HttpSession;
35
import javax.servlet.http.HttpSession;
36
36
37
import org.apache.catalina.Globals;
37
import org.apache.catalina.Globals;
38
import org.apache.catalina.comet.CometFilter;
39
import org.apache.catalina.comet.CometProcessor;
38
import org.apache.tomcat.util.ExceptionUtils;
40
import org.apache.tomcat.util.ExceptionUtils;
39
import org.apache.tomcat.util.res.StringManager;
41
import org.apache.tomcat.util.res.StringManager;
40
/**
42
/**
Lines 148-165 Link Here
148
                                     Principal principal)
150
                                     Principal principal)
149
        throws java.lang.Exception{
151
        throws java.lang.Exception{
150
152
153
        // CometProcessor servlets must not be cached as Servlet or NoSuchMethodException will be thrown.
154
        Class<?> targetType = targetObject instanceof CometProcessor ? CometProcessor.class : Servlet.class;
155
151
        Method method = null;
156
        Method method = null;
152
        Method[] methodsCache = classCache.get(Servlet.class);
157
        Method[] methodsCache = classCache.get(targetType);
153
        if(methodsCache == null) {
158
        if(methodsCache == null) {
154
            method = createMethodAndCacheIt(methodsCache,
159
            method = createMethodAndCacheIt(methodsCache,
155
                                            Servlet.class,
160
                                            targetType,
156
                                            methodName,
161
                                            methodName,
157
                                            targetParameterTypes);
162
                                            targetParameterTypes);
158
        } else {
163
        } else {
159
            method = findMethod(methodsCache, methodName);
164
            method = findMethod(methodsCache, methodName);
160
            if (method == null) {
165
            if (method == null) {
161
                method = createMethodAndCacheIt(methodsCache,
166
                method = createMethodAndCacheIt(methodsCache,
162
                                                Servlet.class,
167
                                                targetType,
163
                                                methodName,
168
                                                methodName,
164
                                                targetParameterTypes);
169
                                                targetParameterTypes);
165
            }
170
            }
Lines 228-245 Link Here
228
                                     Principal principal)
233
                                     Principal principal)
229
        throws java.lang.Exception{
234
        throws java.lang.Exception{
230
235
236
        // CometFilter servlets must not be cached as Filter or NoSuchMethodException will be thrown.
237
        Class<?> targetType = targetObject instanceof CometFilter ? CometFilter.class : Filter.class;
238
231
        Method method = null;
239
        Method method = null;
232
        Method[] methodsCache = classCache.get(Filter.class);
240
        Method[] methodsCache = classCache.get(targetType);
233
        if(methodsCache == null) {
241
        if(methodsCache == null) {
234
            method = createMethodAndCacheIt(methodsCache,
242
            method = createMethodAndCacheIt(methodsCache,
235
                                            Filter.class,
243
                                            targetType,
236
                                            methodName,
244
                                            methodName,
237
                                            targetParameterTypes);
245
                                            targetParameterTypes);
238
        } else {
246
        } else {
239
            method = findMethod(methodsCache, methodName);
247
            method = findMethod(methodsCache, methodName);
240
            if (method == null) {
248
            if (method == null) {
241
                method = createMethodAndCacheIt(methodsCache,
249
                method = createMethodAndCacheIt(methodsCache,
242
                                                Filter.class,
250
                                                targetType,
243
                                                methodName,
251
                                                methodName,
244
                                                targetParameterTypes);
252
                                                targetParameterTypes);
245
            }
253
            }
Lines 253-259 Link Here
253
     * Perform work as a particular </code>Subject</code>. Here the work
261
     * Perform work as a particular </code>Subject</code>. Here the work
254
     * will be granted to a <code>null</code> subject.
262
     * will be granted to a <code>null</code> subject.
255
     *
263
     *
256
     * @param methodName the method to apply the security restriction
264
     * @param method the method to apply the security restriction
257
     * @param targetObject the <code>Servlet</code> on which the method will
265
     * @param targetObject the <code>Servlet</code> on which the method will
258
     * be called.
266
     * be called.
259
     * @param targetArguments <code>Object</code> array contains the
267
     * @param targetArguments <code>Object</code> array contains the

Return to bug 58116