tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1763748 - in /tomcat/trunk/java/org/apache: catalina/connector/Connector.java coyote/AbstractProtocol.java
Date Fri, 07 Oct 2016 11:53:31 GMT
Author: markt
Date: Fri Oct  7 11:53:31 2016
New Revision: 1763748

URL: http://svn.apache.org/viewvc?rev=1763748&view=rev
Log:
Clean-up

Modified:
    tomcat/trunk/java/org/apache/catalina/connector/Connector.java
    tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java

Modified: tomcat/trunk/java/org/apache/catalina/connector/Connector.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Connector.java?rev=1763748&r1=1763747&r2=1763748&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/connector/Connector.java (original)
+++ tomcat/trunk/java/org/apache/catalina/connector/Connector.java Fri Oct  7 11:53:31 2016
@@ -880,8 +880,7 @@ public class Connector extends Lifecycle
                 protocolHandler.pause();
             }
         } catch (Exception e) {
-            log.error(sm.getString
-                      ("coyoteConnector.protocolHandlerPauseFailed"), e);
+            log.error(sm.getString("coyoteConnector.protocolHandlerPauseFailed"), e);
         }
     }
 
@@ -895,8 +894,7 @@ public class Connector extends Lifecycle
                 protocolHandler.resume();
             }
         } catch (Exception e) {
-            log.error(sm.getString
-                      ("coyoteConnector.protocolHandlerResumeFailed"), e);
+            log.error(sm.getString("coyoteConnector.protocolHandlerResumeFailed"), e);
         }
     }
 
@@ -916,22 +914,20 @@ public class Connector extends Lifecycle
         protocolHandler.setAdapter(adapter);
 
         // Make sure parseBodyMethodsSet has a default
-        if( null == parseBodyMethodsSet ) {
+        if (null == parseBodyMethodsSet) {
             setParseBodyMethods(getParseBodyMethods());
         }
 
-        if (protocolHandler.isAprRequired() &&
-                !AprLifecycleListener.isAprAvailable()) {
-            throw new LifecycleException(
-                    sm.getString("coyoteConnector.protocolHandlerNoApr",
-                            getProtocolHandlerClassName()));
+        if (protocolHandler.isAprRequired() && !AprLifecycleListener.isAprAvailable())
{
+            throw new LifecycleException(sm.getString("coyoteConnector.protocolHandlerNoApr",
+                    getProtocolHandlerClassName()));
         }
-        if (AprLifecycleListener.isAprAvailable() &&
-                AprLifecycleListener.getUseOpenSSL() &&
+        if (AprLifecycleListener.isAprAvailable() && AprLifecycleListener.getUseOpenSSL()
&&
                 protocolHandler instanceof AbstractHttp11JsseProtocol) {
             AbstractHttp11JsseProtocol<?> jsseProtocolHandler =
                     (AbstractHttp11JsseProtocol<?>) protocolHandler;
-            if (jsseProtocolHandler.isSSLEnabled() && jsseProtocolHandler.getSslImplementationName()
== null) {
+            if (jsseProtocolHandler.isSSLEnabled() &&
+                    jsseProtocolHandler.getSslImplementationName() == null) {
                 // OpenSSL is compatible with the JSSE configuration, so use it if APR is
available
                 jsseProtocolHandler.setSslImplementationName(OpenSSLImplementation.class.getName());
             }
@@ -965,14 +961,8 @@ public class Connector extends Lifecycle
         try {
             protocolHandler.start();
         } catch (Exception e) {
-            String errPrefix = "";
-            if(this.service != null) {
-                errPrefix += "service.getName(): \"" + this.service.getName() + "\"; ";
-            }
-
-            throw new LifecycleException
-                (errPrefix + " " + sm.getString
-                 ("coyoteConnector.protocolHandlerStartFailed"), e);
+            throw new LifecycleException(
+                    sm.getString("coyoteConnector.protocolHandlerStartFailed"), e);
         }
     }
 
@@ -992,9 +982,8 @@ public class Connector extends Lifecycle
                 protocolHandler.stop();
             }
         } catch (Exception e) {
-            throw new LifecycleException
-                (sm.getString
-                 ("coyoteConnector.protocolHandlerStopFailed"), e);
+            throw new LifecycleException(
+                    sm.getString("coyoteConnector.protocolHandlerStopFailed"), e);
         }
     }
 
@@ -1006,9 +995,8 @@ public class Connector extends Lifecycle
                 protocolHandler.destroy();
             }
         } catch (Exception e) {
-            throw new LifecycleException
-                (sm.getString
-                 ("coyoteConnector.protocolHandlerDestroyFailed"), e);
+            throw new LifecycleException(
+                    sm.getString("coyoteConnector.protocolHandlerDestroyFailed"), e);
         }
 
         if (getService() != null) {

Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1763748&r1=1763747&r2=1763748&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original)
+++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Fri Oct  7 11:53:31 2016
@@ -538,34 +538,29 @@ public abstract class AbstractProtocol<S
 
     @Override
     public void init() throws Exception {
-        if (getLog().isInfoEnabled())
-            getLog().info(sm.getString("abstractProtocolHandler.init",
-                    getName()));
+        if (getLog().isInfoEnabled()) {
+            getLog().info(sm.getString("abstractProtocolHandler.init", getName()));
+        }
 
         if (oname == null) {
             // Component not pre-registered so register it
             oname = createObjectName();
             if (oname != null) {
-                Registry.getRegistry(null, null).registerComponent(this, oname,
-                    null);
+                Registry.getRegistry(null, null).registerComponent(this, oname, null);
             }
         }
 
         if (this.domain != null) {
             try {
-                tpOname = new ObjectName(domain + ":" +
-                        "type=ThreadPool,name=" + getName());
-                Registry.getRegistry(null, null).registerComponent(endpoint,
-                        tpOname, null);
+                tpOname = new ObjectName(domain + ":" + "type=ThreadPool,name=" + getName());
+                Registry.getRegistry(null, null).registerComponent(endpoint, tpOname, null);
             } catch (Exception e) {
-                getLog().error(sm.getString(
-                        "abstractProtocolHandler.mbeanRegistrationFailed",
+                getLog().error(sm.getString( "abstractProtocolHandler.mbeanRegistrationFailed",
                         tpOname, getName()), e);
             }
-            rgOname=new ObjectName(domain +
-                    ":type=GlobalRequestProcessor,name=" + getName());
+            rgOname = new ObjectName(domain + ":type=GlobalRequestProcessor,name=" + getName());
             Registry.getRegistry(null, null).registerComponent(
-                    getHandler().getGlobal(), rgOname, null );
+                    getHandler().getGlobal(), rgOname, null);
         }
 
         String endpointName = getName();
@@ -577,9 +572,9 @@ public abstract class AbstractProtocol<S
 
     @Override
     public void start() throws Exception {
-        if (getLog().isInfoEnabled())
-            getLog().info(sm.getString("abstractProtocolHandler.start",
-                    getNameInternal()));
+        if (getLog().isInfoEnabled()) {
+            getLog().info(sm.getString("abstractProtocolHandler.start", getNameInternal()));
+        }
 
         endpoint.start();
 
@@ -594,18 +589,19 @@ public abstract class AbstractProtocol<S
 
     @Override
     public void pause() throws Exception {
-        if(getLog().isInfoEnabled())
-            getLog().info(sm.getString("abstractProtocolHandler.pause",
-                    getName()));
+        if (getLog().isInfoEnabled()) {
+            getLog().info(sm.getString("abstractProtocolHandler.pause", getName()));
+        }
 
         endpoint.pause();
     }
 
+
     @Override
     public void resume() throws Exception {
-        if(getLog().isInfoEnabled())
-            getLog().info(sm.getString("abstractProtocolHandler.resume",
-                    getName()));
+        if(getLog().isInfoEnabled()) {
+            getLog().info(sm.getString("abstractProtocolHandler.resume", getName()));
+        }
 
         endpoint.resume();
     }
@@ -613,9 +609,9 @@ public abstract class AbstractProtocol<S
 
     @Override
     public void stop() throws Exception {
-        if(getLog().isInfoEnabled())
-            getLog().info(sm.getString("abstractProtocolHandler.stop",
-                    getName()));
+        if(getLog().isInfoEnabled()) {
+            getLog().info(sm.getString("abstractProtocolHandler.stop", getName()));
+        }
 
         if (asyncTimeout != null) {
             asyncTimeout.stop();
@@ -628,9 +624,9 @@ public abstract class AbstractProtocol<S
     @Override
     public void destroy() throws Exception {
         if(getLog().isInfoEnabled()) {
-            getLog().info(sm.getString("abstractProtocolHandler.destroy",
-                    getName()));
+            getLog().info(sm.getString("abstractProtocolHandler.destroy", getName()));
         }
+
         try {
             endpoint.destroy();
         } finally {
@@ -641,19 +637,19 @@ public abstract class AbstractProtocol<S
                     // Possibly registered with a different MBeanServer
                     try {
                         mserver.unregisterMBean(oname);
-                    } catch (MBeanRegistrationException |
-                            InstanceNotFoundException e) {
-                        getLog().info(sm.getString(
-                                "abstractProtocol.mbeanDeregistrationFailed",
+                    } catch (MBeanRegistrationException | InstanceNotFoundException e) {
+                        getLog().info(sm.getString("abstractProtocol.mbeanDeregistrationFailed",
                                 oname, mserver));
                     }
                 }
             }
 
-            if (tpOname != null)
+            if (tpOname != null) {
                 Registry.getRegistry(null, null).unregisterComponent(tpOname);
-            if (rgOname != null)
+            }
+            if (rgOname != null) {
                 Registry.getRegistry(null, null).unregisterComponent(rgOname);
+            }
         }
     }
 



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


Mime
View raw message