~ubuntu-branches/ubuntu/lucid/tomcat6/lucid

« back to all changes in this revision

Viewing changes to java/org/apache/catalina/security/SecurityUtil.java

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug, Iulian Udrea
  • Date: 2009-06-09 12:35:19 UTC
  • mfrom: (1.2.1 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090609123519-7owjbso5ttnka6ur
Tags: 6.0.20-1ubuntu1
[ Iulian Udrea ]
* Merge from debian unstable (LP: #385262), remaining changes:
  - debian/control, debian/rules: Use default-jdk to build
  - debian/control: Run using default-jre-headless by default

Show diffs side-by-side

added added

removed removed

Lines of Context:
180
180
 
181
181
    
182
182
    /**
183
 
     * Perform work as a particular </code>Subject</code>. Here the work
 
183
     * Perform work as a particular <code>Subject</code>. Here the work
184
184
     * will be granted to a <code>null</code> subject. 
185
185
     *
186
186
     * @param methodName the method to apply the security restriction
196
196
                                     final Class[] targetType,
197
197
                                     final Object[] targetArguments) 
198
198
        throws java.lang.Exception{
 
199
 
 
200
        doAsPrivilege(
 
201
                methodName, targetObject, targetType, targetArguments, null);
 
202
    }
 
203
    
 
204
    /**
 
205
     * Perform work as a particular <code>Subject</code>. Here the work
 
206
     * will be granted to a <code>null</code> subject. 
 
207
     *
 
208
     * @param methodName the method to apply the security restriction
 
209
     * @param targetObject the <code>Filter</code> on which the method will 
 
210
     * be called.
 
211
     * @param targetType <code>Class</code> array used to instanciate a
 
212
     * <code>Method</code> object.
 
213
     * @param targetArguments <code>Object</code> array contains the 
 
214
     * runtime parameters instance.
 
215
     * @param principal the <code>Principal</code> to which the security 
 
216
     * privilege apply
 
217
     */    
 
218
    public static void doAsPrivilege(final String methodName, 
 
219
                                     final Filter targetObject, 
 
220
                                     final Class[] targetType,
 
221
                                     final Object[] targetArguments,
 
222
                                     Principal principal) 
 
223
        throws java.lang.Exception{
199
224
        Method method = null;
200
225
 
201
226
        Method[] methodsCache = null;
215
240
                                            targetType);                     
216
241
        }
217
242
 
218
 
        execute(method, targetObject, targetArguments, null);
 
243
        execute(method, targetObject, targetArguments, principal);
219
244
    }
220
245
    
221
246
    
274
299
            }
275
300
 
276
301
            Subject.doAsPrivileged(subject, pea, null);       
277
 
       } catch( PrivilegedActionException pe) {
278
 
            Throwable e = ((InvocationTargetException)pe.getException())
 
302
        } catch( PrivilegedActionException pe) {
 
303
            Throwable e;
 
304
            if (pe.getException() instanceof InvocationTargetException) {
 
305
                e = ((InvocationTargetException)pe.getException())
279
306
                                .getTargetException();
 
307
            } else {
 
308
                e = pe;
 
309
            }
280
310
            
281
311
            if (log.isDebugEnabled()){
282
312
                log.debug(sm.getString("SecurityUtil.doAsPrivilege"), e);