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

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

commit 7fe302a529b57892913aff80bea00284046894a1
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Sep 27 16:38:35 2019 +0100

    Align with 8.5.x - spacing, l10n, javadoc
---
 .../apache/catalina/core/LocalStrings.properties   |   6 +
 .../catalina/core/LocalStrings_fr.properties       |   6 +
 .../catalina/core/LocalStrings_ja.properties       |   6 +
 .../catalina/core/LocalStrings_ko.properties       |   6 +
 java/org/apache/catalina/core/StandardServer.java  | 159 ++++++++++-----------
 5 files changed, 96 insertions(+), 87 deletions(-)

diff --git a/java/org/apache/catalina/core/LocalStrings.properties 
b/java/org/apache/catalina/core/LocalStrings.properties
index 4ae4e63..f74a948 100644
--- a/java/org/apache/catalina/core/LocalStrings.properties
+++ b/java/org/apache/catalina/core/LocalStrings.properties
@@ -283,9 +283,15 @@ standardPipeline.valve.destroy=Error destroying Valve
 standardPipeline.valve.start=Error starting Valve
 standardPipeline.valve.stop=Error stopping Valve
 
+standardServer.accept.error=An IO exception occurred trying to accept on the 
socket listening for the shutdown command
+standardServer.accept.readError=An IO exception occurred trying to read the 
shutdown command
+standardServer.accept.security=A security error occurred trying to accept on 
the socket listening for the shutdown command
 standardServer.accept.timeout=The socket listening for the shutdown command 
experienced an unexpected timeout [{0}] milliseconds after the call to 
accept(). Is this an instance of bug 56684?
+standardServer.invalidShutdownCommand=Invalid shutdown command [{0}] received
 standardServer.onameFail=MBean name specified for Server [{0}] is not valid
 standardServer.shutdownViaPort=A valid shutdown command was received via the 
shutdown port. Stopping the Server instance.
+standardServer.storeConfig.contextError=Error storing context [{0}] 
configuration
+standardServer.storeConfig.error=Error storing server configuration
 
 standardService.connector.destroyFailed=Failed to destroy connector [{0}]
 standardService.connector.initFailed=Failed to initialize connector [{0}]
diff --git a/java/org/apache/catalina/core/LocalStrings_fr.properties 
b/java/org/apache/catalina/core/LocalStrings_fr.properties
index e71b6f4..552277f 100644
--- a/java/org/apache/catalina/core/LocalStrings_fr.properties
+++ b/java/org/apache/catalina/core/LocalStrings_fr.properties
@@ -273,8 +273,14 @@ standardPipeline.valve.destroy=Erreur lors de la 
destruction de la valve
 standardPipeline.valve.start=Erreur lors du démarrage de la valve
 standardPipeline.valve.stop=Erreur lors de l'arrêt de la valve
 
+standardServer.accept.error=Une erreur d'IO s'est produite en essayant 
d'accepter sur le socket qui attend la commande d'arrêt
+standardServer.accept.readError=Une erreur d'IO s'est produite lors de la 
lecture de la commande d'arrêt
+standardServer.accept.security=Une erreur de sécurité s'est produite en 
essayant d'accepter sur le socket qui attend la commande d'arrêt
 standardServer.accept.timeout=Le socket qui écoute en attendant la commande 
d''arrêt a rencontré un délai d''attente dépassé inattendu [{0}] millisecondes 
après l''appel à accept()
+standardServer.invalidShutdownCommand=Une commande d''arrêt invalide [{0}] a 
été reçue
 standardServer.shutdownViaPort=Une commande d'arrêt valide a été reçue sur le 
port d'arrêt, arrêt de l'instance du serveur
+standardServer.storeConfig.contextError=Erreur lors de l''enregistrement de la 
configuration du contexte [{0}]
+standardServer.storeConfig.error=Erreur lors de l'enregistrement de la 
configuration du serveur
 
 standardService.start.name=Démarrage du service [{0}]
 standardService.stop.name=Arrêt du service [{0}]
diff --git a/java/org/apache/catalina/core/LocalStrings_ja.properties 
b/java/org/apache/catalina/core/LocalStrings_ja.properties
index c002edd..fb8c9c1 100644
--- a/java/org/apache/catalina/core/LocalStrings_ja.properties
+++ b/java/org/apache/catalina/core/LocalStrings_ja.properties
@@ -273,8 +273,14 @@ standardPipeline.valve.destroy=Valve を破棄できません。
 standardPipeline.valve.start=Valve を開始できません。
 standardPipeline.valve.stop=Valve を停止できません。
 
+standardServer.accept.error=シャットダウンコマンドを受信するソケットの accept で入出力例外が発生しました。
+standardServer.accept.readError=シャットダウンコマンドの読み取り時に入出力例外が発生しました。
+standardServer.accept.security=シャットダウンコマンドを受信するソケットの accept でセキュリティエラーを発生しました。
 
standardServer.accept.timeout=シャットダウンコマンドをリスンするソケットは、accept()の呼び出し後に予期しないタイムアウト[{0}]ミリ秒を経験しました。
 これはバグ56684の一例ですか?
+standardServer.invalidShutdownCommand=不正なシャットダウンコマンド [{0}] を受信しました。
 standardServer.shutdownViaPort=有効なシャットダウンコマンドがシャットダウンポート経由で受信されました。 
サーバーインスタンスを停止します。
+standardServer.storeConfig.contextError=コンテキスト [{0}] の構成の格納時にエラーが発生しました。
+standardServer.storeConfig.error=サーバー構成を格納できません。
 
 standardService.start.name=サービス [{0}] を起動します
 standardService.stop.name=サービス [{0}] を停止します
diff --git a/java/org/apache/catalina/core/LocalStrings_ko.properties 
b/java/org/apache/catalina/core/LocalStrings_ko.properties
index a440920..26e738a 100644
--- a/java/org/apache/catalina/core/LocalStrings_ko.properties
+++ b/java/org/apache/catalina/core/LocalStrings_ko.properties
@@ -214,8 +214,14 @@ standardPipeline.valve.destroy=Valve를 소멸시키는 중 오류 발생
 standardPipeline.valve.start=Valve를 시작시키는 중 오류 발생
 standardPipeline.valve.stop=Valve를 중지시키는 중 오류 발생
 
+standardServer.accept.error=셧다운 명령을 위해 listen하고 있는 소켓에서, accept를 시도하는 중, 
IOException이 발생했습니다.
+standardServer.accept.readError=셧다운 명령을 읽으려 시도하는 중 IOException이 발생했습니다.
+standardServer.accept.security=셧다운 명령을 위해 listen하고 있는 소켓에서, accept를 시도하는 중, 보안 
오류가 발생했습니다.
 standardServer.accept.timeout=셧다운 명령을 위해 listen하고 있는 소켓이, accept()를 호출 한 후, 
예기치 않은 제한 시간 초과([{0}] 밀리초)를 발생시켰습니다. 버그 56684가 발생한 경우일까요?
+standardServer.invalidShutdownCommand=유효하지 않은 셧다운 명령 [{0}]을(를) 받았습니다.
 standardServer.shutdownViaPort=셧다운 포트를 통해 유효한 셧다운 명령을 받았습니다. 서버 인스턴스를 중지시킵니다.
+standardServer.storeConfig.contextError=컨텍스트 [{0}]의 설정을 저장하는 중 오류 발생
+standardServer.storeConfig.error=서버 설정을 저장하는 중 오류 발생
 
 standardService.start.name=서비스 [{0}]을(를) 시작합니다.
 standardService.stop.name=서비스 [{0}]을(를) 중지시킵니다.
diff --git a/java/org/apache/catalina/core/StandardServer.java 
b/java/org/apache/catalina/core/StandardServer.java
index 9b3c8ae..3e3d68c 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -31,6 +31,8 @@ import java.net.URLClassLoader;
 import java.security.AccessControlException;
 import java.util.Random;
 
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanException;
 import javax.management.ObjectName;
 
 import org.apache.catalina.Context;
@@ -79,6 +81,8 @@ public final class StandardServer extends LifecycleMBeanBase 
implements Server {
         if (isUseNaming()) {
             namingContextListener = new NamingContextListener();
             addLifecycleListener(namingContextListener);
+        } else {
+            namingContextListener = null;
         }
 
     }
@@ -109,7 +113,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
     /**
      * The naming context listener for this web application.
      */
-    private NamingContextListener namingContextListener = null;
+    private final NamingContextListener namingContextListener;
 
 
     /**
@@ -179,9 +183,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public javax.naming.Context getGlobalNamingContext() {
-
-        return (this.globalNamingContext);
-
+        return this.globalNamingContext;
     }
 
 
@@ -190,11 +192,8 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      *
      * @param globalNamingContext The new global naming resource context
      */
-    public void setGlobalNamingContext
-        (javax.naming.Context globalNamingContext) {
-
+    public void setGlobalNamingContext(javax.naming.Context 
globalNamingContext) {
         this.globalNamingContext = globalNamingContext;
-
     }
 
 
@@ -203,9 +202,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public NamingResources getGlobalNamingResources() {
-
-        return (this.globalNamingResources);
-
+        return this.globalNamingResources;
     }
 
 
@@ -236,11 +233,10 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public String getInfo() {
-
-        return (info);
-
+        return info;
     }
 
+
     /**
      * Report the current Tomcat Server Release number
      * @return Tomcat release identifier
@@ -273,9 +269,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public int getPort() {
-
-        return (this.port);
-
+        return this.port;
     }
 
 
@@ -286,9 +280,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public void setPort(int port) {
-
         this.port = port;
-
     }
 
 
@@ -297,9 +289,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public String getAddress() {
-
-        return (this.address);
-
+        return this.address;
     }
 
 
@@ -310,9 +300,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public void setAddress(String address) {
-
         this.address = address;
-
     }
 
     /**
@@ -320,9 +308,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public String getShutdown() {
-
-        return (this.shutdown);
-
+        return this.shutdown;
     }
 
 
@@ -333,9 +319,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public void setShutdown(String shutdown) {
-
         this.shutdown = shutdown;
-
     }
 
 
@@ -419,11 +403,11 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
     @Override
     public void await() {
         // Negative values - don't wait on port - tomcat is embedded or we 
just don't like ports
-        if( port == -2 ) {
+        if (port == -2) {
             // undocumented yet - for embedding apps that are around, alive.
             return;
         }
-        if( port==-1 ) {
+        if (port==-1) {
             try {
                 awaitThread = Thread.currentThread();
                 while(!stopAwait) {
@@ -477,15 +461,14 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
                                 Long.valueOf(System.currentTimeMillis() - 
acceptStartTime)), ste);
                         continue;
                     } catch (AccessControlException ace) {
-                        log.warn("StandardServer.accept security exception: "
-                                + ace.getMessage(), ace);
+                        
log.warn(sm.getString("standardServer.accept.security"), ace);
                         continue;
                     } catch (IOException e) {
                         if (stopAwait) {
                             // Wait was aborted with socket.close()
                             break;
                         }
-                        log.error("StandardServer.await: accept: ", e);
+                        log.error(sm.getString("standardServer.accept.error"), 
e);
                         break;
                     }
 
@@ -501,7 +484,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
                         try {
                             ch = stream.read();
                         } catch (IOException e) {
-                            log.warn("StandardServer.await: read: ", e);
+                            
log.warn(sm.getString("standardServer.accept.readError"), e);
                             ch = -1;
                         }
                         // Control character or EOF (-1) terminates loop
@@ -528,8 +511,7 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
                     log.info(sm.getString("standardServer.shutdownViaPort"));
                     break;
                 } else
-                    log.warn("StandardServer.await: Invalid command '"
-                            + command.toString() + "' received");
+                    
log.warn(sm.getString("standardServer.invalidShutdownCommand", 
command.toString()));
             }
         } finally {
             ServerSocket serverSocket = awaitSocket;
@@ -549,41 +531,37 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
 
 
     /**
-     * Return the specified Service (if it exists); otherwise return
+     * @return the specified Service (if it exists); otherwise return
      * <code>null</code>.
      *
      * @param name Name of the Service to be returned
      */
     @Override
     public Service findService(String name) {
-
         if (name == null) {
-            return (null);
+            return null;
         }
         synchronized (servicesLock) {
             for (int i = 0; i < services.length; i++) {
                 if (name.equals(services[i].getName())) {
-                    return (services[i]);
+                    return services[i];
                 }
             }
         }
-        return (null);
-
+        return null;
     }
 
 
     /**
-     * Return the set of Services defined within this Server.
+     * @return the set of Services defined within this Server.
      */
     @Override
     public Service[] findServices() {
-
-        return (services);
-
+        return services;
     }
 
     /**
-     * Return the JMX service names.
+     * @return the JMX service names.
      */
     public ObjectName[] getServiceNames() {
         ObjectName onames[]=new ObjectName[ services.length ];
@@ -635,7 +613,6 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
 
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * Add a property change listener to this component.
      *
@@ -665,12 +642,10 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      */
     @Override
     public String toString() {
-
         StringBuilder sb = new StringBuilder("StandardServer[");
         sb.append(getPort());
         sb.append("]");
-        return (sb.toString());
-
+        return sb.toString();
     }
 
 
@@ -678,17 +653,27 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      * Write the configuration information for this entire <code>Server</code>
      * out to the server.xml configuration file.
      *
-     * @exception   javax.management.InstanceNotFoundException
-     *              if the managed resource object cannot be found
-     * @exception   javax.management.MBeanException
-     *              if the initializer of the object throws an exception, or
-     *              persistence is not supported
-     * @exception   javax.management.RuntimeOperationsException
-     *              if an exception is reported by the persistence mechanism
-     */
-    public synchronized void storeConfig() throws Exception {
-        ObjectName sname = new ObjectName("Catalina:type=StoreConfig");
-        mserver.invoke(sname, "storeConfig", null, null);
+     * @exception InstanceNotFoundException
+     *            if the managed resource object cannot be found
+     * @exception MBeanException
+     *            if the initializer of the object throws an exception, or
+     *            persistence is not supported
+     * @exception javax.management.RuntimeOperationsException
+     *            if an exception is reported by the persistence mechanism
+     */
+    public synchronized void storeConfig() throws InstanceNotFoundException, 
MBeanException {
+        try {
+            // Note: Hard-coded domain used since this object is per Server/JVM
+            ObjectName sname = new ObjectName("Catalina:type=StoreConfig");
+            if (mserver.isRegistered(sname)) {
+                mserver.invoke(sname, "storeConfig", null, null);
+            } else {
+                
log.error(sm.getString("standardServer.storeConfig.notAvailable", sname));
+            }
+        } catch (Throwable t) {
+            ExceptionUtils.handleThrowable(t);
+            log.error(sm.getString("standardServer.storeConfig.error"), t);
+        }
     }
 
 
@@ -696,34 +681,35 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
      * Write the configuration information for <code>Context</code>
      * out to the specified configuration file.
      *
-     * @exception javax.management.InstanceNotFoundException if the managed 
resource object
-     *  cannot be found
-     * @exception javax.management.MBeanException if the initializer of the 
object throws
-     *  an exception, or persistence is not supported
-     * @exception javax.management.RuntimeOperationsException if an exception 
is reported
-     *  by the persistence mechanism
-     */
-    public synchronized void storeContext(Context context) throws Exception {
-
-        ObjectName sname = null;
+     * @param context the context which should save its configuration
+     * @exception InstanceNotFoundException
+     *            if the managed resource object cannot be found
+     * @exception MBeanException
+     *            if the initializer of the object throws an exception
+     *            or persistence is not supported
+     * @exception javax.management.RuntimeOperationsException
+     *            if an exception is reported by the persistence mechanism
+     */
+    public synchronized void storeContext(Context context) throws 
InstanceNotFoundException, MBeanException {
         try {
-           sname = new ObjectName("Catalina:type=StoreConfig");
-           if(mserver.isRegistered(sname)) {
-               mserver.invoke(sname, "store",
-                   new Object[] {context},
-                   new String [] { "java.lang.String"});
-           } else
-               log.error("StoreConfig mbean not registered" + sname);
+            // Note: Hard-coded domain used since this object is per Server/JVM
+            ObjectName sname = new ObjectName("Catalina:type=StoreConfig");
+            if (mserver.isRegistered(sname)) {
+                mserver.invoke(sname, "store",
+                    new Object[] {context},
+                    new String [] { "java.lang.String"});
+            } else {
+                
log.error(sm.getString("standardServer.storeConfig.notAvailable", sname));
+            }
         } catch (Throwable t) {
             ExceptionUtils.handleThrowable(t);
-            log.error(t);
+            log.error(sm.getString("standardServer.storeConfig.contextError", 
context.getName()), t);
         }
-
     }
 
 
     /**
-     * Return true if naming should be used.
+     * @return <code>true</code> if naming should be used.
      */
     private boolean isUseNaming() {
         boolean useNaming = true;
@@ -863,11 +849,11 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
     @Override
     public ClassLoader getParentClassLoader() {
         if (parentClassLoader != null)
-            return (parentClassLoader);
+            return parentClassLoader;
         if (catalina != null) {
-            return (catalina.getParentClassLoader());
+            return catalina.getParentClassLoader();
         }
-        return (ClassLoader.getSystemClassLoader());
+        return ClassLoader.getSystemClassLoader();
     }
 
     /**
@@ -915,5 +901,4 @@ public final class StandardServer extends 
LifecycleMBeanBase implements Server {
     protected final String getObjectNameKeyProperties() {
         return "type=Server";
     }
-
 }


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

Reply via email to