This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new 6190b10148 Code cleanup - formatting. No functional change.
6190b10148 is described below

commit 6190b10148c7076eb97f2fec73849e98f5e1fb87
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 22 20:21:32 2023 +0100

    Code cleanup - formatting. No functional change.
---
 .../catalina/deploy/NamingResourcesImpl.java       | 235 ++++++++-------------
 1 file changed, 90 insertions(+), 145 deletions(-)

diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java 
b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
index 37f90217e2..39fcb2853b 100644
--- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java
+++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
@@ -60,13 +60,11 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Holds and manages the naming resources defined in the Jakarta EE
- * Naming Context and their associated JNDI context.
+ * Holds and manages the naming resources defined in the Jakarta EE Naming 
Context and their associated JNDI context.
  *
  * @author Remy Maucherat
  */
-public class NamingResourcesImpl extends LifecycleMBeanBase
-        implements Serializable, NamingResources {
+public class NamingResourcesImpl extends LifecycleMBeanBase implements 
Serializable, NamingResources {
 
     private static final long serialVersionUID = 1L;
 
@@ -105,56 +103,49 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
     /**
      * The EJB resource references for this web application, keyed by name.
      */
-    private final Map<String, ContextEjb> ejbs = new HashMap<>();
+    private final Map<String,ContextEjb> ejbs = new HashMap<>();
 
 
     /**
      * The environment entries for this web application, keyed by name.
      */
-    private final Map<String, ContextEnvironment> envs = new HashMap<>();
+    private final Map<String,ContextEnvironment> envs = new HashMap<>();
 
 
     /**
-     * The local  EJB resource references for this web application, keyed by
-     * name.
+     * The local EJB resource references for this web application, keyed by 
name.
      */
-    private final Map<String, ContextLocalEjb> localEjbs = new HashMap<>();
+    private final Map<String,ContextLocalEjb> localEjbs = new HashMap<>();
 
 
     /**
-     * The message destination references for this web application,
-     * keyed by name.
+     * The message destination references for this web application, keyed by 
name.
      */
-    private final Map<String, MessageDestinationRef> mdrs = new HashMap<>();
+    private final Map<String,MessageDestinationRef> mdrs = new HashMap<>();
 
 
     /**
-     * The resource environment references for this web application,
-     * keyed by name.
+     * The resource environment references for this web application, keyed by 
name.
      */
-    private final HashMap<String, ContextResourceEnvRef> resourceEnvRefs =
-        new HashMap<>();
+    private final HashMap<String,ContextResourceEnvRef> resourceEnvRefs = new 
HashMap<>();
 
 
     /**
      * The resource references for this web application, keyed by name.
      */
-    private final HashMap<String, ContextResource> resources =
-        new HashMap<>();
+    private final HashMap<String,ContextResource> resources = new HashMap<>();
 
 
     /**
      * The resource links for this web application, keyed by name.
      */
-    private final HashMap<String, ContextResourceLink> resourceLinks =
-        new HashMap<>();
+    private final HashMap<String,ContextResourceLink> resourceLinks = new 
HashMap<>();
 
 
     /**
      * The web service references for this web application, keyed by name.
      */
-    private final HashMap<String, ContextService> services =
-        new HashMap<>();
+    private final HashMap<String,ContextService> services = new HashMap<>();
 
 
     /**
@@ -166,8 +157,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
     /**
      * The property change support for this component.
      */
-    protected final PropertyChangeSupport support =
-            new PropertyChangeSupport(this);
+    protected final PropertyChangeSupport support = new 
PropertyChangeSupport(this);
 
 
     // ------------------------------------------------------------- Properties
@@ -184,6 +174,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
     /**
      * Set the container with which the naming resources are associated.
+     *
      * @param container the associated with the resources
      */
     public void setContainer(Object container) {
@@ -193,6 +184,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
     /**
      * Set the transaction object.
+     *
      * @param transaction the transaction descriptor
      */
     public void setTransaction(ContextTransaction transaction) {
@@ -220,8 +212,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
         String lookupName = ejb.getLookupName();
 
         if (ejbLink != null && ejbLink.length() > 0 && lookupName != null && 
lookupName.length() > 0) {
-            throw new IllegalArgumentException(
-                    sm.getString("namingResources.ejbLookupLink", 
ejb.getName()));
+            throw new 
IllegalArgumentException(sm.getString("namingResources.ejbLookupLink", 
ejb.getName()));
         }
 
         if (entries.contains(ejb.getName())) {
@@ -277,8 +268,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
         String lookupName = environment.getLookupName();
 
         // Entries with injection targets but no value are effectively ignored
-        if (injectionTargets != null && injectionTargets.size() > 0 &&
-                (value == null || value.length() == 0)) {
+        if (injectionTargets != null && injectionTargets.size() > 0 && (value 
== null || value.length() == 0)) {
             return;
         }
 
@@ -289,9 +279,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
         }
 
         if (!checkResourceType(environment)) {
-            throw new IllegalArgumentException(sm.getString(
-                    "namingResources.resourceTypeFail", environment.getName(),
-                    environment.getType()));
+            throw new IllegalArgumentException(
+                    sm.getString("namingResources.resourceTypeFail", 
environment.getName(), environment.getType()));
         }
 
         entries.add(environment.getName());
@@ -307,8 +296,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             try {
                 MBeanUtils.createMBean(environment);
             } catch (Exception e) {
-                log.warn(sm.getString("namingResources.mbeanCreateFail",
-                        environment.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanCreateFail", 
environment.getName()), e);
             }
         }
     }
@@ -321,8 +309,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
         }
         if (container instanceof Context) {
             // Could do this in one go. Lots of casts so split out for clarity
-            Engine engine =
-                (Engine) ((Context) container).getParent().getParent();
+            Engine engine = (Engine) ((Context) 
container).getParent().getParent();
             return engine.getService().getServer();
         }
         return null;
@@ -361,9 +348,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             return;
         } else {
             if (!checkResourceType(mdr)) {
-                throw new IllegalArgumentException(sm.getString(
-                        "namingResources.resourceTypeFail", mdr.getName(),
-                        mdr.getType()));
+                throw new IllegalArgumentException(
+                        sm.getString("namingResources.resourceTypeFail", 
mdr.getName(), mdr.getType()));
             }
             entries.add(mdr.getName());
         }
@@ -401,9 +387,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             return;
         } else {
             if (!checkResourceType(resource)) {
-                throw new IllegalArgumentException(sm.getString(
-                        "namingResources.resourceTypeFail", resource.getName(),
-                        resource.getType()));
+                throw new IllegalArgumentException(
+                        sm.getString("namingResources.resourceTypeFail", 
resource.getName(), resource.getType()));
             }
             entries.add(resource.getName());
         }
@@ -419,8 +404,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             try {
                 MBeanUtils.createMBean(resource);
             } catch (Exception e) {
-                log.warn(sm.getString("namingResources.mbeanCreateFail",
-                        resource.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanCreateFail", 
resource.getName()), e);
             }
         }
     }
@@ -437,9 +421,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             return;
         } else {
             if (!checkResourceType(resource)) {
-                throw new IllegalArgumentException(sm.getString(
-                        "namingResources.resourceTypeFail", resource.getName(),
-                        resource.getType()));
+                throw new IllegalArgumentException(
+                        sm.getString("namingResources.resourceTypeFail", 
resource.getName(), resource.getType()));
             }
             entries.add(resource.getName());
         }
@@ -478,8 +461,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             try {
                 MBeanUtils.createMBean(resourceLink);
             } catch (Exception e) {
-                log.warn(sm.getString("namingResources.mbeanCreateFail",
-                        resourceLink.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanCreateFail", 
resourceLink.getName()), e);
             }
         }
     }
@@ -508,8 +490,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the EJB resource reference with the specified name, if any;
-     * otherwise, return <code>null</code>.
+     * @return the EJB resource reference with the specified name, if any; 
otherwise, return <code>null</code>.
      *
      * @param name Name of the desired EJB resource reference
      */
@@ -523,8 +504,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the defined EJB resource references for this application.
-     * If there are none, a zero-length array is returned.
+     * @return the defined EJB resource references for this application. If 
there are none, a zero-length array is
+     *             returned.
      */
     public ContextEjb[] findEjbs() {
 
@@ -536,8 +517,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the environment entry with the specified name, if any;
-     * otherwise, return <code>null</code>.
+     * @return the environment entry with the specified name, if any; 
otherwise, return <code>null</code>.
      *
      * @param name Name of the desired environment entry
      */
@@ -551,9 +531,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the set of defined environment entries for this web
-     * application.  If none have been defined, a zero-length array
-     * is returned.
+     * @return the set of defined environment entries for this web 
application. If none have been defined, a zero-length
+     *             array is returned.
      */
     public ContextEnvironment[] findEnvironments() {
 
@@ -565,8 +544,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the local EJB resource reference with the specified name, if 
any;
-     * otherwise, return <code>null</code>.
+     * @return the local EJB resource reference with the specified name, if 
any; otherwise, return <code>null</code>.
      *
      * @param name Name of the desired EJB resource reference
      */
@@ -580,8 +558,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the defined local EJB resource references for this application.
-     * If there are none, a zero-length array is returned.
+     * @return the defined local EJB resource references for this application. 
If there are none, a zero-length array is
+     *             returned.
      */
     public ContextLocalEjb[] findLocalEjbs() {
 
@@ -593,8 +571,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the message destination reference with the specified name,
-     * if any; otherwise, return <code>null</code>.
+     * @return the message destination reference with the specified name, if 
any; otherwise, return <code>null</code>.
      *
      * @param name Name of the desired message destination reference
      */
@@ -608,8 +585,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the defined message destination references for this application.
-     * If there are none, a zero-length array is returned.
+     * @return the defined message destination references for this 
application. If there are none, a zero-length array
+     *             is returned.
      */
     public MessageDestinationRef[] findMessageDestinationRefs() {
 
@@ -621,8 +598,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the resource reference with the specified name, if any;
-     * otherwise return <code>null</code>.
+     * @return the resource reference with the specified name, if any; 
otherwise return <code>null</code>.
      *
      * @param name Name of the desired resource reference
      */
@@ -636,8 +612,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the resource link with the specified name, if any;
-     * otherwise return <code>null</code>.
+     * @return the resource link with the specified name, if any; otherwise 
return <code>null</code>.
      *
      * @param name Name of the desired resource link
      */
@@ -651,8 +626,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the defined resource links for this application.  If
-     * none have been defined, a zero-length array is returned.
+     * @return the defined resource links for this application. If none have 
been defined, a zero-length array is
+     *             returned.
      */
     public ContextResourceLink[] findResourceLinks() {
 
@@ -664,8 +639,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the defined resource references for this application.  If
-     * none have been defined, a zero-length array is returned.
+     * @return the defined resource references for this application. If none 
have been defined, a zero-length array is
+     *             returned.
      */
     public ContextResource[] findResources() {
 
@@ -677,8 +652,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the resource environment reference type for the specified
-     * name, if any; otherwise return <code>null</code>.
+     * @return the resource environment reference type for the specified name, 
if any; otherwise return
+     *             <code>null</code>.
      *
      * @param name Name of the desired resource environment reference
      */
@@ -692,9 +667,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the set of resource environment reference names for this
-     * web application.  If none have been specified, a zero-length
-     * array is returned.
+     * @return the set of resource environment reference names for this web 
application. If none have been specified, a
+     *             zero-length array is returned.
      */
     public ContextResourceEnvRef[] findResourceEnvRefs() {
 
@@ -706,8 +680,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the web service reference for the specified
-     * name, if any; otherwise return <code>null</code>.
+     * @return the web service reference for the specified name, if any; 
otherwise return <code>null</code>.
      *
      * @param name Name of the desired web service
      */
@@ -721,8 +694,8 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
 
     /**
-     * @return the defined web service references for this application.  If
-     * none have been defined, a zero-length array is returned.
+     * @return the defined web service references for this application. If 
none have been defined, a zero-length array
+     *             is returned.
      */
     public ContextService[] findServices() {
 
@@ -775,8 +748,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
                 try {
                     MBeanUtils.destroyMBean(environment);
                 } catch (Exception e) {
-                    log.warn(sm.getString("namingResources.mbeanDestroyFail",
-                            environment.getName()), e);
+                    log.warn(sm.getString("namingResources.mbeanDestroyFail", 
environment.getName()), e);
                 }
             }
             environment.setNamingResources(null);
@@ -819,8 +791,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             mdr = mdrs.remove(name);
         }
         if (mdr != null) {
-            support.firePropertyChange("messageDestinationRef",
-                                       mdr, null);
+            support.firePropertyChange("messageDestinationRef", mdr, null);
             mdr.setNamingResources(null);
         }
 
@@ -860,8 +831,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
                 try {
                     MBeanUtils.destroyMBean(resource);
                 } catch (Exception e) {
-                    log.warn(sm.getString("namingResources.mbeanDestroyFail",
-                            resource.getName()), e);
+                    log.warn(sm.getString("namingResources.mbeanDestroyFail", 
resource.getName()), e);
                 }
             }
             resource.setNamingResources(null);
@@ -880,8 +850,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
         ContextResourceEnvRef resourceEnvRef = null;
         synchronized (resourceEnvRefs) {
-            resourceEnvRef =
-                resourceEnvRefs.remove(name);
+            resourceEnvRef = resourceEnvRefs.remove(name);
         }
         if (resourceEnvRef != null) {
             support.firePropertyChange("resourceEnvRef", resourceEnvRef, null);
@@ -912,8 +881,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
                 try {
                     MBeanUtils.destroyMBean(resourceLink);
                 } catch (Exception e) {
-                    log.warn(sm.getString("namingResources.mbeanDestroyFail",
-                            resourceLink.getName()), e);
+                    log.warn(sm.getString("namingResources.mbeanDestroyFail", 
resourceLink.getName()), e);
                 }
             }
             resourceLink.setNamingResources(null);
@@ -956,8 +924,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             try {
                 MBeanUtils.createMBean(cr);
             } catch (Exception e) {
-                log.warn(sm.getString(
-                        "namingResources.mbeanCreateFail", cr.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanCreateFail", 
cr.getName()), e);
             }
         }
 
@@ -965,8 +932,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             try {
                 MBeanUtils.createMBean(ce);
             } catch (Exception e) {
-                log.warn(sm.getString(
-                        "namingResources.mbeanCreateFail", ce.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanCreateFail", 
ce.getName()), e);
             }
         }
 
@@ -974,8 +940,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
             try {
                 MBeanUtils.createMBean(crl);
             } catch (Exception e) {
-                log.warn(sm.getString(
-                        "namingResources.mbeanCreateFail", crl.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanCreateFail", 
crl.getName()), e);
             }
         }
     }
@@ -1011,22 +976,19 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
                 ctxt = (javax.naming.Context) ctxt.lookup("comp/env");
             }
         } catch (NamingException e) {
-            log.warn(sm.getString("namingResources.cleanupNoContext",
-                    container), e);
+            log.warn(sm.getString("namingResources.cleanupNoContext", 
container), e);
             return;
         }
-        for (ContextResource cr: resources.values()) {
+        for (ContextResource cr : resources.values()) {
             if (cr.getSingleton()) {
                 String closeMethod = cr.getCloseMethod();
                 if (closeMethod != null && closeMethod.length() > 0) {
                     String name = cr.getName();
                     Object resource;
                     try {
-                         resource = ctxt.lookup(name);
+                        resource = ctxt.lookup(name);
                     } catch (NamingException e) {
-                        log.warn(sm.getString(
-                                "namingResources.cleanupNoResource",
-                                cr.getName(), container), e);
+                        
log.warn(sm.getString("namingResources.cleanupNoResource", cr.getName(), 
container), e);
                         continue;
                     }
                     cleanUp(resource, name, closeMethod);
@@ -1037,12 +999,10 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
 
 
     /**
-     * Clean up a resource by calling the defined close method. For example,
-     * closing a database connection pool will close it's open connections. 
This
-     * will happen on GC but that leaves db connections open that may cause
-     * issues.
+     * Clean up a resource by calling the defined close method. For example, 
closing a database connection pool will
+     * close it's open connections. This will happen on GC but that leaves db 
connections open that may cause issues.
      *
-     * @param resource  The resource to close.
+     * @param resource The resource to close.
      */
     private void cleanUp(Object resource, String name, String closeMethod) {
         // Look for a zero-arg close() method
@@ -1050,24 +1010,20 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
         try {
             m = resource.getClass().getMethod(closeMethod, (Class<?>[]) null);
         } catch (SecurityException e) {
-            log.debug(sm.getString("namingResources.cleanupCloseSecurity",
-                    closeMethod, name, container));
+            log.debug(sm.getString("namingResources.cleanupCloseSecurity", 
closeMethod, name, container));
             return;
         } catch (NoSuchMethodException e) {
-            log.debug(sm.getString("namingResources.cleanupNoClose",
-                    name, container, closeMethod));
+            log.debug(sm.getString("namingResources.cleanupNoClose", name, 
container, closeMethod));
             return;
         }
         try {
             m.invoke(resource, (Object[]) null);
         } catch (IllegalArgumentException | IllegalAccessException e) {
-            log.warn(sm.getString("namingResources.cleanupCloseFailed",
-                    closeMethod, name, container), e);
+            log.warn(sm.getString("namingResources.cleanupCloseFailed", 
closeMethod, name, container), e);
         } catch (InvocationTargetException e) {
             Throwable t = ExceptionUtils.unwrapInvocationTargetException(e);
             ExceptionUtils.handleThrowable(t);
-            log.warn(sm.getString("namingResources.cleanupCloseFailed",
-                    closeMethod, name, container), t);
+            log.warn(sm.getString("namingResources.cleanupCloseFailed", 
closeMethod, name, container), t);
         }
     }
 
@@ -1083,8 +1039,7 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
             try {
                 MBeanUtils.destroyMBean(crl);
             } catch (Exception e) {
-                log.warn(sm.getString(
-                        "namingResources.mbeanDestroyFail", crl.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanDestroyFail", 
crl.getName()), e);
             }
         }
 
@@ -1092,8 +1047,7 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
             try {
                 MBeanUtils.destroyMBean(ce);
             } catch (Exception e) {
-                log.warn(sm.getString(
-                        "namingResources.mbeanDestroyFail", ce.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanDestroyFail", 
ce.getName()), e);
             }
         }
 
@@ -1101,8 +1055,7 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
             try {
                 MBeanUtils.destroyMBean(cr);
             } catch (Exception e) {
-                log.warn(sm.getString(
-                        "namingResources.mbeanDestroyFail", cr.getName()), e);
+                log.warn(sm.getString("namingResources.mbeanDestroyFail", 
cr.getName()), e);
             }
         }
 
@@ -1127,24 +1080,21 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
     protected String getObjectNameKeyProperties() {
         Object c = getContainer();
         if (c instanceof Container) {
-            return "type=NamingResources" +
-                    ((Container) c).getMBeanKeyProperties();
+            return "type=NamingResources" + ((Container) 
c).getMBeanKeyProperties();
         }
         // Server or just unknown
         return "type=NamingResources";
     }
 
     /**
-     * Checks that the configuration of the type for the specified resource is
-     * consistent with any injection targets and if the type is not specified,
-     * tries to configure the type based on the injection targets
+     * Checks that the configuration of the type for the specified resource is 
consistent with any injection targets and
+     * if the type is not specified, tries to configure the type based on the 
injection targets
      *
-     * @param resource  The resource to check
+     * @param resource The resource to check
      *
-     * @return  <code>true</code> if the type for the resource is now valid (if
-     *          previously <code>null</code> this means it is now set) or
-     *          <code>false</code> if the current resource type is inconsistent
-     *          with the injection targets and/or cannot be determined
+     * @return <code>true</code> if the type for the resource is now valid (if 
previously <code>null</code> this means
+     *             it is now set) or <code>false</code> if the current 
resource type is inconsistent with the injection
+     *             targets and/or cannot be determined
      */
     private boolean checkResourceType(ResourceBase resource) {
         if (!(container instanceof Context)) {
@@ -1152,8 +1102,7 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
             return true;
         }
 
-        if (resource.getInjectionTargets() == null ||
-                resource.getInjectionTargets().size() == 0) {
+        if (resource.getInjectionTargets() == null || 
resource.getInjectionTargets().size() == 0) {
             // No injection targets so use the defined type for the resource
             return true;
         }
@@ -1171,8 +1120,7 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
             }
         }
 
-        Class<?> compatibleClass =
-                getCompatibleType(context, resource, typeClass);
+        Class<?> compatibleClass = getCompatibleType(context, resource, 
typeClass);
         if (compatibleClass == null) {
             // Indicates that a compatible type could not be identified that
             // worked for all injection targets
@@ -1183,14 +1131,12 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
         return true;
     }
 
-    private Class<?> getCompatibleType(Context context,
-            ResourceBase resource, Class<?> typeClass) {
+    private Class<?> getCompatibleType(Context context, ResourceBase resource, 
Class<?> typeClass) {
 
         Class<?> result = null;
 
         for (InjectionTarget injectionTarget : resource.getInjectionTargets()) 
{
-            Class<?> clazz = Introspection.loadClass(
-                    context, injectionTarget.getTargetClass());
+            Class<?> clazz = Introspection.loadClass(context, 
injectionTarget.getTargetClass());
             if (clazz == null) {
                 // Can't load class - therefore ignore this target
                 continue;
@@ -1202,7 +1148,7 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
             Class<?> targetType = getSetterType(clazz, targetName);
             if (targetType == null) {
                 // Try a field match if no setter match
-                targetType = getFieldType(clazz,targetName);
+                targetType = getFieldType(clazz, targetName);
             }
             if (targetType == null) {
                 // No match - ignore this injection target
@@ -1241,8 +1187,7 @@ public class NamingResourcesImpl extends 
LifecycleMBeanBase
         Method[] methods = clazz.getDeclaredMethods();
         if (methods != null && methods.length > 0) {
             for (Method method : methods) {
-                if (Introspection.isValidSetter(method) &&
-                        Introspection.getPropertyName(method).equals(name)) {
+                if (Introspection.isValidSetter(method) && 
Introspection.getPropertyName(method).equals(name)) {
                     return method.getParameterTypes()[0];
                 }
             }


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to