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

(-)java/org/apache/catalina/core/DefaultInstanceManager.java (-36 / +30 lines)
Lines 301-338 Link Here
301
                    // JNDI is enabled
301
                    // JNDI is enabled
302
                    Field[] fields = Introspection.getDeclaredFields(clazz);
302
                    Field[] fields = Introspection.getDeclaredFields(clazz);
303
                    for (Field field : fields) {
303
                    for (Field field : fields) {
304
                        Resource resourceAnnotation;
305
                        EJB ejbAnnotation;
306
                        WebServiceRef webServiceRefAnnotation;
307
                        PersistenceContext persistenceContextAnnotation;
308
                        PersistenceUnit persistenceUnitAnnotation;
304
                        if (injections != null && injections.containsKey(field.getName())) {
309
                        if (injections != null && injections.containsKey(field.getName())) {
305
                            annotations.add(new AnnotationCacheEntry(
310
                            annotations.add(new AnnotationCacheEntry(
306
                                    field.getName(), null,
311
                                    field.getName(), null,
307
                                    injections.get(field.getName()),
312
                                    injections.get(field.getName()),
308
                                    AnnotationCacheEntryType.FIELD));
313
                                    AnnotationCacheEntryType.FIELD));
309
                        } else if (field.isAnnotationPresent(Resource.class)) {
314
                        } else if ((resourceAnnotation = field.getAnnotation(Resource.class)) != null) {
310
                            Resource annotation = field.getAnnotation(Resource.class);
311
                            annotations.add(new AnnotationCacheEntry(
315
                            annotations.add(new AnnotationCacheEntry(
312
                                    field.getName(), null, annotation.name(),
316
                                    field.getName(), null, resourceAnnotation.name(),
313
                                    AnnotationCacheEntryType.FIELD));
317
                                    AnnotationCacheEntryType.FIELD));
314
                        } else if (field.isAnnotationPresent(EJB.class)) {
318
                        } else if ((ejbAnnotation = field.getAnnotation(EJB.class)) != null) {
315
                            EJB annotation = field.getAnnotation(EJB.class);
316
                            annotations.add(new AnnotationCacheEntry(
319
                            annotations.add(new AnnotationCacheEntry(
317
                                    field.getName(), null, annotation.name(),
320
                                    field.getName(), null, ejbAnnotation.name(),
318
                                    AnnotationCacheEntryType.FIELD));
321
                                    AnnotationCacheEntryType.FIELD));
319
                        } else if (field.isAnnotationPresent(WebServiceRef.class)) {
322
                        } else if ((webServiceRefAnnotation = field.getAnnotation(WebServiceRef.class)) != null) {
320
                            WebServiceRef annotation =
321
                                    field.getAnnotation(WebServiceRef.class);
322
                            annotations.add(new AnnotationCacheEntry(
323
                            annotations.add(new AnnotationCacheEntry(
323
                                    field.getName(), null, annotation.name(),
324
                                    field.getName(), null, webServiceRefAnnotation.name(),
324
                                    AnnotationCacheEntryType.FIELD));
325
                                    AnnotationCacheEntryType.FIELD));
325
                        } else if (field.isAnnotationPresent(PersistenceContext.class)) {
326
                        } else if ((persistenceContextAnnotation = field.getAnnotation(PersistenceContext.class)) != null) {
326
                            PersistenceContext annotation =
327
                                    field.getAnnotation(PersistenceContext.class);
328
                            annotations.add(new AnnotationCacheEntry(
327
                            annotations.add(new AnnotationCacheEntry(
329
                                    field.getName(), null, annotation.name(),
328
                                    field.getName(), null, persistenceContextAnnotation.name(),
330
                                    AnnotationCacheEntryType.FIELD));
329
                                    AnnotationCacheEntryType.FIELD));
331
                        } else if (field.isAnnotationPresent(PersistenceUnit.class)) {
330
                        } else if ((persistenceUnitAnnotation = field.getAnnotation(PersistenceUnit.class)) != null) {
332
                            PersistenceUnit annotation =
333
                                    field.getAnnotation(PersistenceUnit.class);
334
                            annotations.add(new AnnotationCacheEntry(
331
                            annotations.add(new AnnotationCacheEntry(
335
                                    field.getName(), null, annotation.name(),
332
                                    field.getName(), null, persistenceUnitAnnotation.name(),
336
                                    AnnotationCacheEntryType.FIELD));
333
                                    AnnotationCacheEntryType.FIELD));
337
                        }
334
                        }
338
                    }
335
                    }
Lines 359-401 Link Here
359
                                continue;
356
                                continue;
360
                            }
357
                            }
361
                        }
358
                        }
362
                        if (method.isAnnotationPresent(Resource.class)) {
359
                        Resource resourceAnnotation;
363
                            Resource annotation = method.getAnnotation(Resource.class);
360
                        EJB ejbAnnotation;
361
                        WebServiceRef webServiceRefAnnotation;
362
                        PersistenceContext persistenceContextAnnotation;
363
                        PersistenceUnit persistenceUnitAnnotation;
364
                        if ((resourceAnnotation = method.getAnnotation(Resource.class)) != null) {
364
                            annotations.add(new AnnotationCacheEntry(
365
                            annotations.add(new AnnotationCacheEntry(
365
                                    method.getName(),
366
                                    method.getName(),
366
                                    method.getParameterTypes(),
367
                                    method.getParameterTypes(),
367
                                    annotation.name(),
368
                                    resourceAnnotation.name(),
368
                                    AnnotationCacheEntryType.SETTER));
369
                                    AnnotationCacheEntryType.SETTER));
369
                        } else if (method.isAnnotationPresent(EJB.class)) {
370
                        } else if ((ejbAnnotation = method.getAnnotation(EJB.class)) != null) {
370
                            EJB annotation = method.getAnnotation(EJB.class);
371
                            annotations.add(new AnnotationCacheEntry(
371
                            annotations.add(new AnnotationCacheEntry(
372
                                    method.getName(),
372
                                    method.getName(),
373
                                    method.getParameterTypes(),
373
                                    method.getParameterTypes(),
374
                                    annotation.name(),
374
                                    ejbAnnotation.name(),
375
                                    AnnotationCacheEntryType.SETTER));
375
                                    AnnotationCacheEntryType.SETTER));
376
                        } else if (method.isAnnotationPresent(WebServiceRef.class)) {
376
                        } else if ((webServiceRefAnnotation =method.getAnnotation(WebServiceRef.class)) != null) {
377
                            WebServiceRef annotation =
378
                                    method.getAnnotation(WebServiceRef.class);
379
                            annotations.add(new AnnotationCacheEntry(
377
                            annotations.add(new AnnotationCacheEntry(
380
                                    method.getName(),
378
                                    method.getName(),
381
                                    method.getParameterTypes(),
379
                                    method.getParameterTypes(),
382
                                    annotation.name(),
380
                                    webServiceRefAnnotation.name(),
383
                                    AnnotationCacheEntryType.SETTER));
381
                                    AnnotationCacheEntryType.SETTER));
384
                        } else if (method.isAnnotationPresent(PersistenceContext.class)) {
382
                        } else if ((persistenceContextAnnotation = method.getAnnotation(PersistenceContext.class)) != null) {
385
                            PersistenceContext annotation =
386
                                    method.getAnnotation(PersistenceContext.class);
387
                            annotations.add(new AnnotationCacheEntry(
383
                            annotations.add(new AnnotationCacheEntry(
388
                                    method.getName(),
384
                                    method.getName(),
389
                                    method.getParameterTypes(),
385
                                    method.getParameterTypes(),
390
                                    annotation.name(),
386
                                    persistenceContextAnnotation.name(),
391
                                    AnnotationCacheEntryType.SETTER));
387
                                    AnnotationCacheEntryType.SETTER));
392
                        } else if (method.isAnnotationPresent(PersistenceUnit.class)) {
388
                        } else if ((persistenceUnitAnnotation = method.getAnnotation(PersistenceUnit.class)) != null) {
393
                            PersistenceUnit annotation =
394
                                    method.getAnnotation(PersistenceUnit.class);
395
                            annotations.add(new AnnotationCacheEntry(
389
                            annotations.add(new AnnotationCacheEntry(
396
                                    method.getName(),
390
                                    method.getName(),
397
                                    method.getParameterTypes(),
391
                                    method.getParameterTypes(),
398
                                    annotation.name(),
392
                                    persistenceUnitAnnotation.name(),
399
                                    AnnotationCacheEntryType.SETTER));
393
                                    AnnotationCacheEntryType.SETTER));
400
                        }
394
                        }
401
                    }
395
                    }

Return to bug 56611