You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2023/06/22 19:23:23 UTC

[tomcat] branch 9.0.x updated: Code cleanup - formatting. No functional change.

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

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


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

commit 6eeece67ab6feeee72f9fef54ab34c0de8d5037c
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jun 22 20:23:17 2023 +0100

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

diff --git a/java/org/apache/catalina/deploy/NamingResourcesImpl.java b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
index 45c38991bf..258eb2bbd1 100644
--- a/java/org/apache/catalina/deploy/NamingResourcesImpl.java
+++ b/java/org/apache/catalina/deploy/NamingResourcesImpl.java
@@ -60,13 +60,12 @@ import org.apache.tomcat.util.res.StringManager;
 
 
 /**
- * Holds and manages the naming resources defined in the J2EE Enterprise
- * Naming Context and their associated JNDI context.
+ * Holds and manages the naming resources defined in the J2EE Enterprise 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 +104,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 +158,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 +175,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 +185,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
 
     /**
      * Set the transaction object.
+     *
      * @param transaction the transaction descriptor
      */
     public void setTransaction(ContextTransaction transaction) {
@@ -220,8 +213,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 +269,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 +280,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 +297,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 +310,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 +349,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 +388,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 +405,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 +422,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 +462,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 +491,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 +505,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 +518,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 +532,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 +545,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 +559,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 +572,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 +586,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 +599,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 +613,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 +627,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 +640,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 +653,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 +668,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 +681,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 +695,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 +749,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 +792,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 +832,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 +851,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 +882,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 +925,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 +933,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 +941,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 +977,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 +1000,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 +1011,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 +1040,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 +1048,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 +1056,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 +1081,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 +1103,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 +1121,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 +1132,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 +1149,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 +1188,7 @@ public class NamingResourcesImpl extends LifecycleMBeanBase
         Method[] methods = Introspection.getDeclaredMethods(clazz);
         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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org