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 2019/10/04 15:53:00 UTC

[tomcat] 02/02: Polish. Align with 9.0.x. i18n improvements.

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

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

commit 2ae5c4bda4d6b54de08ec7f50eceb3899be683ef
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Oct 4 16:47:47 2019 +0100

    Polish. Align with 9.0.x. i18n improvements.
---
 .../tomcat/util/modeler/LocalStrings.properties    | 17 ++++++++++
 .../tomcat/util/modeler/LocalStrings_fr.properties | 18 +++++++++++
 .../tomcat/util/modeler/LocalStrings_ja.properties | 18 +++++++++++
 .../tomcat/util/modeler/LocalStrings_ko.properties | 18 +++++++++++
 .../util/modeler/LocalStrings_zh_CN.properties     | 17 ++++++++++
 .../modules/MbeansDescriptorsDigesterSource.java   |  4 +--
 .../MbeansDescriptorsIntrospectionSource.java      | 37 +++++++++++-----------
 .../tomcat/util/modeler/modules/ModelerSource.java |  2 ++
 8 files changed, 110 insertions(+), 21 deletions(-)

diff --git a/java/org/apache/tomcat/util/modeler/LocalStrings.properties b/java/org/apache/tomcat/util/modeler/LocalStrings.properties
new file mode 100644
index 0000000..b3d9b47
--- /dev/null
+++ b/java/org/apache/tomcat/util/modeler/LocalStrings.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+modules.digesterParseError=Error parsing registry data
+modules.readDescriptorsError=Error reading descriptors
diff --git a/java/org/apache/tomcat/util/modeler/LocalStrings_fr.properties b/java/org/apache/tomcat/util/modeler/LocalStrings_fr.properties
new file mode 100644
index 0000000..30d80ca
--- /dev/null
+++ b/java/org/apache/tomcat/util/modeler/LocalStrings_fr.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+modules.digesterParseError=Erreur lors de l'analyse des données du registre
+modules.readDescriptorsError=Erreur lors de la lecture des descripteurs
+
diff --git a/java/org/apache/tomcat/util/modeler/LocalStrings_ja.properties b/java/org/apache/tomcat/util/modeler/LocalStrings_ja.properties
new file mode 100644
index 0000000..21c9711
--- /dev/null
+++ b/java/org/apache/tomcat/util/modeler/LocalStrings_ja.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+modules.digesterParseError=レジストリデータの解析エラー
+modules.readDescriptorsError=ディスクリプタ読み取り中のエラー
+
diff --git a/java/org/apache/tomcat/util/modeler/LocalStrings_ko.properties b/java/org/apache/tomcat/util/modeler/LocalStrings_ko.properties
new file mode 100644
index 0000000..ffcf3fd
--- /dev/null
+++ b/java/org/apache/tomcat/util/modeler/LocalStrings_ko.properties
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+modules.digesterParseError=레지스트리 데이터를 파싱하는 중 오류 발생
+modules.readDescriptorsError=Descriptor들을 읽는 중 오류 발생
+
diff --git a/java/org/apache/tomcat/util/modeler/LocalStrings_zh_CN.properties b/java/org/apache/tomcat/util/modeler/LocalStrings_zh_CN.properties
new file mode 100644
index 0000000..519a3cd
--- /dev/null
+++ b/java/org/apache/tomcat/util/modeler/LocalStrings_zh_CN.properties
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+modules.readDescriptorsError=读取描述文件出错
+
diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
index c885a36..a3ab5c4 100644
--- a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
+++ b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java
@@ -156,7 +156,7 @@ public class MbeansDescriptorsDigesterSource extends ModelerSource
 
         InputStream stream = (InputStream) source;
 
-        ArrayList<ManagedBean> loadedMbeans = new ArrayList<>();
+        List<ManagedBean> loadedMbeans = new ArrayList<>();
         synchronized(dLock) {
             if (digester == null) {
                 digester = createDigester();
@@ -168,7 +168,7 @@ public class MbeansDescriptorsDigesterSource extends ModelerSource
                 digester.push(loadedMbeans);
                 digester.parse(stream);
             } catch (Exception e) {
-                log.error("Error digesting Registry data", e);
+                log.error(sm.getString("modules.digesterParseError"), e);
                 throw e;
             } finally {
                 digester.reset();
diff --git a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
index 7cde874..83b80e1 100644
--- a/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
+++ b/java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsIntrospectionSource.java
@@ -83,7 +83,7 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource
             registry.addManagedBean(managed);
 
         } catch( Exception ex ) {
-            log.error( "Error reading descriptors ", ex);
+            log.error(sm.getString("modules.readDescriptorsError"), ex);
         }
     }
 
@@ -91,8 +91,7 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource
 
     // ------------ Implementation for non-declared introspection classes
 
-    private static final Hashtable<String,String> specialMethods =
-            new Hashtable<>();
+    private static final Hashtable<String,String> specialMethods = new Hashtable<>();
     static {
         specialMethods.put( "preDeregister", "");
         specialMethods.put( "postDeregister", "");
@@ -338,26 +337,26 @@ public class MbeansDescriptorsIntrospectionSource extends ModelerSource
                     mbean.addAttribute(ai);
             }
 
+            // This map is populated by iterating the methods (which end up as
+            // values in the Map) and obtaining the key from the value. It is
+            // impossible for a key to be associated with a null value.
             for (Entry<String,Method> entry : invokeAttMap.entrySet()) {
                 String name = entry.getKey();
                 Method m = entry.getValue();
-                if(m != null) {
-                    OperationInfo op=new OperationInfo();
-                    op.setName(name);
-                    op.setReturnType(m.getReturnType().getName());
-                    op.setDescription("Introspected operation " + name);
-                    Class<?> parms[] = m.getParameterTypes();
-                    for(int i=0; i<parms.length; i++ ) {
-                        ParameterInfo pi=new ParameterInfo();
-                        pi.setType(parms[i].getName());
-                        pi.setName(("param" + i).intern());
-                        pi.setDescription(("Introspected parameter param" + i).intern());
-                        op.addParameter(pi);
-                    }
-                    mbean.addOperation(op);
-                } else {
-                    log.error("Null arg method for [" + name + "]");
+
+                OperationInfo op=new OperationInfo();
+                op.setName(name);
+                op.setReturnType(m.getReturnType().getName());
+                op.setDescription("Introspected operation " + name);
+                Class<?> parms[] = m.getParameterTypes();
+                for(int i=0; i<parms.length; i++ ) {
+                    ParameterInfo pi=new ParameterInfo();
+                    pi.setType(parms[i].getName());
+                    pi.setName(("param" + i).intern());
+                    pi.setDescription(("Introspected parameter param" + i).intern());
+                    op.addParameter(pi);
                 }
+                mbean.addOperation(op);
             }
 
             if( log.isDebugEnabled())
diff --git a/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java b/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
index d2699b8..6506b0c 100644
--- a/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
+++ b/java/org/apache/tomcat/util/modeler/modules/ModelerSource.java
@@ -21,11 +21,13 @@ import java.util.List;
 import javax.management.ObjectName;
 
 import org.apache.tomcat.util.modeler.Registry;
+import org.apache.tomcat.util.res.StringManager;
 
 /**
  * Source for descriptor data. More sources can be added.
  */
 public abstract class ModelerSource {
+    protected static final StringManager sm = StringManager.getManager(Registry.class);
     protected Object source;
 
     /**


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