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 2020/10/16 08:09:54 UTC

[tomcat] 02/03: Align with 9.0.x

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 f45531efbc609fef9683924a1c91a9bad66d8d95
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Fri Oct 16 08:59:17 2020 +0100

    Align with 9.0.x
    
    Comments, Javadoc, i18n
---
 java/javax/servlet/GenericServlet.java                 | 6 +++---
 java/javax/servlet/LocalStrings.properties             | 3 +++
 java/javax/servlet/LocalStrings_de.properties          | 2 ++
 java/javax/servlet/LocalStrings_fr.properties          | 3 +++
 java/javax/servlet/LocalStrings_ja.properties          | 3 +++
 java/javax/servlet/LocalStrings_ko.properties          | 3 +++
 java/javax/servlet/LocalStrings_zh_CN.properties       | 3 +++
 java/javax/servlet/ServletRegistration.java            | 2 +-
 java/javax/servlet/ServletRequestWrapper.java          | 9 +++++++--
 java/javax/servlet/ServletResponseWrapper.java         | 9 +++++++--
 java/javax/servlet/http/HttpSessionBindingEvent.java   | 2 +-
 java/javax/servlet/http/HttpUtils.java                 | 5 ++---
 java/javax/servlet/http/WebConnection.java             | 4 ++--
 java/javax/servlet/resources/jsp_2_1.xsd               | 2 +-
 java/javax/servlet/resources/web-jsptaglibrary_1_1.dtd | 2 +-
 java/javax/servlet/resources/web-jsptaglibrary_1_2.dtd | 2 +-
 java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd | 2 +-
 java/javax/servlet/resources/web-jsptaglibrary_2_1.xsd | 2 +-
 18 files changed, 45 insertions(+), 19 deletions(-)

diff --git a/java/javax/servlet/GenericServlet.java b/java/javax/servlet/GenericServlet.java
index f040cb7..da70a61 100644
--- a/java/javax/servlet/GenericServlet.java
+++ b/java/javax/servlet/GenericServlet.java
@@ -180,12 +180,12 @@ public abstract class GenericServlet implements Servlet, ServletConfig,
      * Writes the specified message to a servlet log file, prepended by the
      * servlet's name. See {@link ServletContext#log(String)}.
      *
-     * @param msg
+     * @param message
      *            a <code>String</code> specifying the message to be written to
      *            the log file
      */
-    public void log(String msg) {
-        getServletContext().log(getServletName() + ": " + msg);
+    public void log(String message) {
+        getServletContext().log(getServletName() + ": " + message);
     }
 
     /**
diff --git a/java/javax/servlet/LocalStrings.properties b/java/javax/servlet/LocalStrings.properties
index b57cb4c..cad5eb7 100644
--- a/java/javax/servlet/LocalStrings.properties
+++ b/java/javax/servlet/LocalStrings.properties
@@ -21,3 +21,6 @@ httpMethodConstraintElement.invalidMethod=Invalid HTTP method
 
 value.false=false
 value.true=true
+
+wrapper.nullRequest=Request cannot be null
+wrapper.nullResponse=Response cannot be null
diff --git a/java/javax/servlet/LocalStrings_de.properties b/java/javax/servlet/LocalStrings_de.properties
index e91efd3..c8a5526 100644
--- a/java/javax/servlet/LocalStrings_de.properties
+++ b/java/javax/servlet/LocalStrings_de.properties
@@ -18,3 +18,5 @@ err.not_iso8859_1=Kein ISO 8859-1 Zeichen: [{0}]
 httpMethodConstraintElement.invalidMethod=Ungültige HTTP-Methode
 
 value.true=wahr
+
+wrapper.nullResponse=Der Response darf nicht 'null' sein
diff --git a/java/javax/servlet/LocalStrings_fr.properties b/java/javax/servlet/LocalStrings_fr.properties
index 603b694..bd1cdfc 100644
--- a/java/javax/servlet/LocalStrings_fr.properties
+++ b/java/javax/servlet/LocalStrings_fr.properties
@@ -21,3 +21,6 @@ httpMethodConstraintElement.invalidMethod=Méthode HTTP invalide
 
 value.false=false
 value.true=true
+
+wrapper.nullRequest=La requête ne peut pas être null
+wrapper.nullResponse=La réponse ne peut pas être null
diff --git a/java/javax/servlet/LocalStrings_ja.properties b/java/javax/servlet/LocalStrings_ja.properties
index 7abfb9b..693dcf5 100644
--- a/java/javax/servlet/LocalStrings_ja.properties
+++ b/java/javax/servlet/LocalStrings_ja.properties
@@ -21,3 +21,6 @@ httpMethodConstraintElement.invalidMethod=無効なHTTPメソッド
 
 value.false=false
 value.true=true
+
+wrapper.nullRequest=リクエストには null を指定できません。
+wrapper.nullResponse=レスポンスには null を指定できません。
diff --git a/java/javax/servlet/LocalStrings_ko.properties b/java/javax/servlet/LocalStrings_ko.properties
index b09b07b..63865cb 100644
--- a/java/javax/servlet/LocalStrings_ko.properties
+++ b/java/javax/servlet/LocalStrings_ko.properties
@@ -21,3 +21,6 @@ httpMethodConstraintElement.invalidMethod=유효하지 않은 HTTP 메소드
 
 value.false=false
 value.true=true
+
+wrapper.nullRequest=요청이 널이어서는 안됩니다.
+wrapper.nullResponse=응답이 널일 수는 없습니다.
diff --git a/java/javax/servlet/LocalStrings_zh_CN.properties b/java/javax/servlet/LocalStrings_zh_CN.properties
index 60310f3..6f983a9 100644
--- a/java/javax/servlet/LocalStrings_zh_CN.properties
+++ b/java/javax/servlet/LocalStrings_zh_CN.properties
@@ -21,3 +21,6 @@ httpMethodConstraintElement.invalidMethod=无效的HTTP.方法
 
 value.false=否
 value.true=true
+
+wrapper.nullRequest=请求不能为空
+wrapper.nullResponse=响应不能为空
diff --git a/java/javax/servlet/ServletRegistration.java b/java/javax/servlet/ServletRegistration.java
index 4b7fd94..d31611b 100644
--- a/java/javax/servlet/ServletRegistration.java
+++ b/java/javax/servlet/ServletRegistration.java
@@ -66,8 +66,8 @@ public interface ServletRegistration extends Registration {
      */
     public static interface Dynamic extends ServletRegistration, Registration.Dynamic {
         public void setLoadOnStartup(int loadOnStartup);
+        public Set<String> setServletSecurity(ServletSecurityElement constraint);
         public void setMultipartConfig(MultipartConfigElement multipartConfig);
         public void setRunAsRole(String roleName);
-        public Set<String> setServletSecurity(ServletSecurityElement constraint);
     }
 }
diff --git a/java/javax/servlet/ServletRequestWrapper.java b/java/javax/servlet/ServletRequestWrapper.java
index 825159b..f5a51b4 100644
--- a/java/javax/servlet/ServletRequestWrapper.java
+++ b/java/javax/servlet/ServletRequestWrapper.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Map;
+import java.util.ResourceBundle;
 
 /**
  * Provides a convenient implementation of the ServletRequest interface that can
@@ -32,6 +33,10 @@ import java.util.Map;
  * @see javax.servlet.ServletRequest
  */
 public class ServletRequestWrapper implements ServletRequest {
+    private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+    private static final ResourceBundle lStrings =
+        ResourceBundle.getBundle(LSTRING_FILE);
+
     private ServletRequest request;
 
     /**
@@ -43,7 +48,7 @@ public class ServletRequestWrapper implements ServletRequest {
      */
     public ServletRequestWrapper(ServletRequest request) {
         if (request == null) {
-            throw new IllegalArgumentException("Request cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullRequest"));
         }
         this.request = request;
     }
@@ -64,7 +69,7 @@ public class ServletRequestWrapper implements ServletRequest {
      */
     public void setRequest(ServletRequest request) {
         if (request == null) {
-            throw new IllegalArgumentException("Request cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullRequest"));
         }
         this.request = request;
     }
diff --git a/java/javax/servlet/ServletResponseWrapper.java b/java/javax/servlet/ServletResponseWrapper.java
index ffb48b4..0d3fb1e 100644
--- a/java/javax/servlet/ServletResponseWrapper.java
+++ b/java/javax/servlet/ServletResponseWrapper.java
@@ -19,6 +19,7 @@ package javax.servlet;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Locale;
+import java.util.ResourceBundle;
 
 /**
  * Provides a convenient implementation of the ServletResponse interface that
@@ -30,6 +31,10 @@ import java.util.Locale;
  * @see javax.servlet.ServletResponse
  */
 public class ServletResponseWrapper implements ServletResponse {
+    private static final String LSTRING_FILE = "javax.servlet.LocalStrings";
+    private static final ResourceBundle lStrings =
+        ResourceBundle.getBundle(LSTRING_FILE);
+
     private ServletResponse response;
 
     /**
@@ -42,7 +47,7 @@ public class ServletResponseWrapper implements ServletResponse {
      */
     public ServletResponseWrapper(ServletResponse response) {
         if (response == null) {
-            throw new IllegalArgumentException("Response cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullResponse"));
         }
         this.response = response;
     }
@@ -66,7 +71,7 @@ public class ServletResponseWrapper implements ServletResponse {
      */
     public void setResponse(ServletResponse response) {
         if (response == null) {
-            throw new IllegalArgumentException("Response cannot be null");
+            throw new IllegalArgumentException(lStrings.getString("wrapper.nullResponse"));
         }
         this.response = response;
     }
diff --git a/java/javax/servlet/http/HttpSessionBindingEvent.java b/java/javax/servlet/http/HttpSessionBindingEvent.java
index 91e5167..70138c7 100644
--- a/java/javax/servlet/http/HttpSessionBindingEvent.java
+++ b/java/javax/servlet/http/HttpSessionBindingEvent.java
@@ -20,7 +20,7 @@ package javax.servlet.http;
 /**
  * Events of this type are either sent to an object that implements
  * {@link HttpSessionBindingListener} when it is bound or unbound from a
- * session, or to a {@link HttpSessionAttributeListener} that has been
+ * session, or to an {@link HttpSessionAttributeListener} that has been
  * configured in the deployment descriptor when any attribute is bound, unbound
  * or replaced in a session.
  * <p>
diff --git a/java/javax/servlet/http/HttpUtils.java b/java/javax/servlet/http/HttpUtils.java
index 6c65592..22b089f 100644
--- a/java/javax/servlet/http/HttpUtils.java
+++ b/java/javax/servlet/http/HttpUtils.java
@@ -18,6 +18,7 @@
 package javax.servlet.http;
 
 import java.io.IOException;
+import java.util.Arrays;
 import java.util.Hashtable;
 import java.util.ResourceBundle;
 import java.util.StringTokenizer;
@@ -101,9 +102,7 @@ public class HttpUtils {
             String val = parseName(pair.substring(pos+1, pair.length()), sb);
             if (ht.containsKey(key)) {
                 String oldVals[] = ht.get(key);
-                valArray = new String[oldVals.length + 1];
-                for (int i = 0; i < oldVals.length; i++)
-                    valArray[i] = oldVals[i];
+                valArray = Arrays.copyOf(oldVals, oldVals.length + 1);
                 valArray[oldVals.length] = val;
             } else {
                 valArray = new String[1];
diff --git a/java/javax/servlet/http/WebConnection.java b/java/javax/servlet/http/WebConnection.java
index e619e8c..c64c5c8 100644
--- a/java/javax/servlet/http/WebConnection.java
+++ b/java/javax/servlet/http/WebConnection.java
@@ -22,7 +22,7 @@ import javax.servlet.ServletInputStream;
 import javax.servlet.ServletOutputStream;
 
 /**
- * The interface used by a {@link HttpUpgradeHandler} to interact with an upgraded
+ * The interface used by an {@link HttpUpgradeHandler} to interact with an upgraded
  * HTTP connection.
  *
  * @since Servlet 3.1
@@ -48,4 +48,4 @@ public interface WebConnection extends AutoCloseable {
      * @throws IOException If an I/O occurs while obtaining the stream
      */
     ServletOutputStream getOutputStream() throws IOException;
-}
\ No newline at end of file
+}
diff --git a/java/javax/servlet/resources/jsp_2_1.xsd b/java/javax/servlet/resources/jsp_2_1.xsd
index e58edba..1c5c372 100644
--- a/java/javax/servlet/resources/jsp_2_1.xsd
+++ b/java/javax/servlet/resources/jsp_2_1.xsd
@@ -20,7 +20,7 @@
 <!--
   **  The actual Sun XSD for this stripped down XSD can be found at
   **  http://java.sun.com/xml/ns/javaee/jsp_2_1.xsd
-  **  This XSD contains only the functional elements for programmatic use.
+  **  This XSD contains only the functional elements for programatic use.
 -->
 
 <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
diff --git a/java/javax/servlet/resources/web-jsptaglibrary_1_1.dtd b/java/javax/servlet/resources/web-jsptaglibrary_1_1.dtd
index acd148f..47cdf06 100644
--- a/java/javax/servlet/resources/web-jsptaglibrary_1_1.dtd
+++ b/java/javax/servlet/resources/web-jsptaglibrary_1_1.dtd
@@ -39,7 +39,7 @@ shortname   a simple default short name that could be used by
             prefix value in taglib directives
 uri         a uri uniquely identifying this taglib
 info        a simple string describing the "use" of this taglib,
-            should be user discernible
+            should be user discernable
 -->
 
 <!ELEMENT taglib (tlibversion, jspversion?, shortname, uri?, info?, tag+) >
diff --git a/java/javax/servlet/resources/web-jsptaglibrary_1_2.dtd b/java/javax/servlet/resources/web-jsptaglibrary_1_2.dtd
index 0f87842..da8d1a7 100644
--- a/java/javax/servlet/resources/web-jsptaglibrary_1_2.dtd
+++ b/java/javax/servlet/resources/web-jsptaglibrary_1_2.dtd
@@ -62,7 +62,7 @@ small-icon      optional small-icon that can be used by tools
 large-icon      optional large-icon that can be used by tools
 
 description     a simple string describing the "use" of this taglib,
-                should be user discernible
+                should be user discernable
 
 validator       optional TagLibraryValidator information
 
diff --git a/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd b/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd
index 0e2b965..6ecd8ee 100644
--- a/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd
+++ b/java/javax/servlet/resources/web-jsptaglibrary_2_0.xsd
@@ -669,7 +669,7 @@
         The taglib tag is the document root, it defines:
 
         description     a simple string describing the "use" of this taglib,
-                        should be user discernible
+                        should be user discernable
 
         display-name    the display-name element contains a
                         short name that is intended to be displayed
diff --git a/java/javax/servlet/resources/web-jsptaglibrary_2_1.xsd b/java/javax/servlet/resources/web-jsptaglibrary_2_1.xsd
index 00975cd..2714f78 100644
--- a/java/javax/servlet/resources/web-jsptaglibrary_2_1.xsd
+++ b/java/javax/servlet/resources/web-jsptaglibrary_2_1.xsd
@@ -18,7 +18,7 @@
 -->
 
 <!--
-  ** This XSD contains only the programmatic elements required for an implementation.
+  ** This XSD contains only the programatic elements required for an implementation.
   ** For the XSD from Sun that includes documentation and other copyrighted information
   ** please refer to http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd for a fully documented and latest
   **  XSD.


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