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

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


The following commit(s) were added to refs/heads/8.5.x by this push:
     new 29d048b5e5 Missing strings mostly
29d048b5e5 is described below

commit 29d048b5e578361f1abd480ff9398328e5f7e467
Author: remm <r...@apache.org>
AuthorDate: Fri Feb 16 12:19:09 2024 +0100

    Missing strings mostly
---
 java/org/apache/catalina/filters/CorsFilter.java   | 11 +----------
 .../catalina/filters/LocalStrings.properties       |  1 +
 java/org/apache/catalina/servlets/CGIServlet.java  |  5 ++---
 .../catalina/servlets/LocalStrings.properties      |  2 ++
 .../valves/CrawlerSessionManagerValve.java         |  8 ++++----
 .../valves/rewrite/LocalStrings.properties         |  5 +++++
 .../catalina/valves/rewrite/Substitution.java      | 23 ++++++++++++----------
 7 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/java/org/apache/catalina/filters/CorsFilter.java 
b/java/org/apache/catalina/filters/CorsFilter.java
index ada5e9909a..f34e4a5af7 100644
--- a/java/org/apache/catalina/filters/CorsFilter.java
+++ b/java/org/apache/catalina/filters/CorsFilter.java
@@ -352,16 +352,7 @@ public class CorsFilter implements Filter {
         response.resetBuffer();
 
         if (log.isDebugEnabled()) {
-            // Debug so no need for i18n
-            StringBuilder message = new StringBuilder("Invalid CORS request; 
Origin=");
-            message.append(origin);
-            message.append(";Method=");
-            message.append(method);
-            if (accessControlRequestHeaders != null) {
-                message.append(";Access-Control-Request-Headers=");
-                message.append(accessControlRequestHeaders);
-            }
-            log.debug(message.toString());
+            sm.getString("corsFilter.invalidRequest", origin, method, 
accessControlRequestHeaders);
         }
     }
 
diff --git a/java/org/apache/catalina/filters/LocalStrings.properties 
b/java/org/apache/catalina/filters/LocalStrings.properties
index be56650ae2..aab53ede4f 100644
--- a/java/org/apache/catalina/filters/LocalStrings.properties
+++ b/java/org/apache/catalina/filters/LocalStrings.properties
@@ -16,6 +16,7 @@
 addDefaultCharset.unsupportedCharset=Specified character set [{0}] is not 
supported
 
 corsFilter.invalidPreflightMaxAge=Unable to parse preflightMaxAge
+corsFilter.invalidRequest=Invalid CORS request; Origin [{0}] Method [{1}] 
Access-Control-Request-Headers [{2}]
 corsFilter.invalidSupportsCredentials=It is not allowed to configure 
supportsCredentials=[true] when allowedOrigins=[*]
 corsFilter.nullRequest=HttpServletRequest object is null
 corsFilter.nullRequestType=CORSRequestType object is null
diff --git a/java/org/apache/catalina/servlets/CGIServlet.java 
b/java/org/apache/catalina/servlets/CGIServlet.java
index 839c1b1671..39237610a4 100644
--- a/java/org/apache/catalina/servlets/CGIServlet.java
+++ b/java/org/apache/catalina/servlets/CGIServlet.java
@@ -1434,7 +1434,7 @@ public final class CGIServlet extends HttpServlet {
              */
 
             if (!isReady()) {
-                throw new IOException(this.getClass().getName() + ": not ready 
to run.");
+                throw new IOException(sm.getString("cgiServlet.notReady"));
             }
 
             if (log.isTraceEnabled()) {
@@ -1443,8 +1443,7 @@ public final class CGIServlet extends HttpServlet {
 
             if ((command.contains(File.separator + "." + File.separator)) ||
                     (command.contains(File.separator + "..")) || 
(command.contains(".." + File.separator))) {
-                throw new IOException(this.getClass().getName() + "Illegal 
Character in CGI command path " +
-                        "('.' or '..') detected.  Not running CGI [" + command 
+ "].");
+                throw new 
IOException(sm.getString("cgiServlet.invalidCommand", command));
             }
 
             /*
diff --git a/java/org/apache/catalina/servlets/LocalStrings.properties 
b/java/org/apache/catalina/servlets/LocalStrings.properties
index 1ce4990490..38807654a3 100644
--- a/java/org/apache/catalina/servlets/LocalStrings.properties
+++ b/java/org/apache/catalina/servlets/LocalStrings.properties
@@ -25,6 +25,8 @@ cgiServlet.find.location=Looking for a file at [{0}]
 cgiServlet.find.path=CGI script requested at path [{0}] relative to CGI 
location [{1}]
 cgiServlet.invalidArgumentDecoded=The decoded command line argument [{0}] did 
not match the configured cmdLineArgumentsDecoded pattern [{1}]
 cgiServlet.invalidArgumentEncoded=The encoded command line argument [{0}] did 
not match the configured cmdLineArgumentsEncoded pattern [{1}]
+cgiServlet.invalidCommand=Illegal Character in CGI command path ('.' or '..') 
detected, not running CGI [{0}]
+cgiServlet.notReady=CGI Servlet is not ready to run
 cgiServlet.runBadHeader=Bad header line [{0}]
 cgiServlet.runFail=I/O problems processing CGI
 cgiServlet.runHeaderReaderFail=I/O problems closing header reader
diff --git a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java 
b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
index 39dfab3138..2e18540f14 100644
--- a/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
+++ b/java/org/apache/catalina/valves/CrawlerSessionManagerValve.java
@@ -245,13 +245,13 @@ public class CrawlerSessionManagerValve extends ValveBase 
{
                             new 
CrawlerHttpSessionBindingListener(clientIdSessionId, clientIdentifier));
                     s.setMaxInactiveInterval(sessionInactiveInterval);
 
-                    if (log.isDebugEnabled()) {
-                        log.debug(request.hashCode() + ": New bot session. 
SessionID=" + s.getId());
+                    if (log.isTraceEnabled()) {
+                        log.trace(request.hashCode() + ": New bot session. 
SessionID=" + s.getId());
                     }
                 }
             } else {
-                if (log.isDebugEnabled()) {
-                    log.debug(request.hashCode() + ": Bot session accessed. 
SessionID=" + sessionId);
+                if (log.isTraceEnabled()) {
+                    log.trace(request.hashCode() + ": Bot session accessed. 
SessionID=" + sessionId);
                 }
             }
         }
diff --git a/java/org/apache/catalina/valves/rewrite/LocalStrings.properties 
b/java/org/apache/catalina/valves/rewrite/LocalStrings.properties
index db07290ebb..ffb6009f6d 100644
--- a/java/org/apache/catalina/valves/rewrite/LocalStrings.properties
+++ b/java/org/apache/catalina/valves/rewrite/LocalStrings.properties
@@ -26,3 +26,8 @@ rewriteValve.invalidMapClassName=Invalid map class name [{0}]
 rewriteValve.noConfiguration=No configuration resource found [{0}]
 rewriteValve.readConfiguration=Read configuration from [/WEB-INF/{0}]
 rewriteValve.readError=Error reading configuration
+
+substitution.badType=Bad type [{0}] in substitution [{1}]
+substitution.invalid=Invalid substitution [{0}]
+substitution.missingDigit=Substitution [{0}] is missing digit or curly brace
+substitution.noMap=Map [{0}] not found in substitution [{1}]
diff --git a/java/org/apache/catalina/valves/rewrite/Substitution.java 
b/java/org/apache/catalina/valves/rewrite/Substitution.java
index 1e70de2fcd..b7e39158e6 100644
--- a/java/org/apache/catalina/valves/rewrite/Substitution.java
+++ b/java/org/apache/catalina/valves/rewrite/Substitution.java
@@ -22,9 +22,12 @@ import java.util.Map;
 import java.util.regex.Matcher;
 
 import org.apache.catalina.util.URLEncoder;
+import org.apache.tomcat.util.res.StringManager;
 
 public class Substitution {
 
+    protected static final StringManager sm = 
StringManager.getManager(Substitution.class);
+
     public abstract static class SubstitutionElement {
         public abstract String evaluate(Matcher rule, Matcher cond, Resolver 
resolver);
     }
@@ -148,7 +151,7 @@ public class Substitution {
                 elements.add(newElement);
             } else if (isFirstPos(backslashPos, dollarPos, percentPos)) {
                 if (backslashPos + 1 == sub.length()) {
-                    throw new IllegalArgumentException(sub);
+                    throw new 
IllegalArgumentException(sm.getString("substitution.invalid", sub));
                 }
                 StaticElement newElement = new StaticElement();
                 newElement.value = sub.substring(pos, backslashPos) + 
sub.substring(backslashPos + 1, backslashPos + 2);
@@ -157,7 +160,7 @@ public class Substitution {
             } else if (isFirstPos(dollarPos, percentPos)) {
                 // $: back reference to rule or map lookup
                 if (dollarPos + 1 == sub.length()) {
-                    throw new IllegalArgumentException(sub);
+                    throw new 
IllegalArgumentException(sm.getString("substitution.invalid", sub));
                 }
                 if (pos < dollarPos) {
                     // Static text
@@ -179,17 +182,17 @@ public class Substitution {
                     int def = findMatchingColonOrBar(false, sub, open);
                     int close = findMatchingBrace(sub, open);
                     if (!(-1 < open && open < colon && colon < close)) {
-                        throw new IllegalArgumentException(sub);
+                        throw new 
IllegalArgumentException(sm.getString("substitution.invalid", sub));
                     }
                     newElement.map = maps.get(sub.substring(open + 1, colon));
                     if (newElement.map == null) {
-                        throw new IllegalArgumentException(sub + ": No map: " 
+ sub.substring(open + 1, colon));
+                        throw new 
IllegalArgumentException(sm.getString("substitution.noMap", sub.substring(open 
+ 1, colon), sub));
                     }
                     String key = null;
                     String defaultValue = null;
                     if (def > -1) {
                         if (!(colon < def && def < close)) {
-                            throw new IllegalArgumentException(sub);
+                            throw new 
IllegalArgumentException(sm.getString("substitution.invalid", sub));
                         }
                         key = sub.substring(colon + 1, def);
                         defaultValue = sub.substring(def + 1, close);
@@ -203,12 +206,12 @@ public class Substitution {
                     pos = close + 1;
                     elements.add(newElement);
                 } else {
-                    throw new IllegalArgumentException(sub + ": missing digit 
or curly brace.");
+                    throw new 
IllegalArgumentException(sm.getString("substitution.missingDigit", sub));
                 }
             } else {
                 // %: back reference to condition or server variable
                 if (percentPos + 1 == sub.length()) {
-                    throw new IllegalArgumentException(sub);
+                    throw new 
IllegalArgumentException(sm.getString("substitution.invalid", sub));
                 }
                 if (pos < percentPos) {
                     // Static text
@@ -229,7 +232,7 @@ public class Substitution {
                     int colon = findMatchingColonOrBar(true, sub, open);
                     int close = findMatchingBrace(sub, open);
                     if (!(-1 < open && open < close)) {
-                        throw new IllegalArgumentException(sub);
+                        throw new 
IllegalArgumentException(sm.getString("substitution.invalid", sub));
                     }
                     if (colon > -1 && open < colon && colon < close) {
                         String type = sub.substring(open + 1, colon);
@@ -243,7 +246,7 @@ public class Substitution {
                             newElement = new ServerVariableHttpElement();
                             ((ServerVariableHttpElement) newElement).key = 
sub.substring(colon + 1, close);
                         } else {
-                            throw new IllegalArgumentException(sub + ": Bad 
type: " + type);
+                            throw new 
IllegalArgumentException(sm.getString("substitution.badType", type, sub));
                         }
                     } else {
                         newElement = new ServerVariableElement();
@@ -252,7 +255,7 @@ public class Substitution {
                     pos = close + 1;
                     elements.add(newElement);
                 } else {
-                    throw new IllegalArgumentException(sub + ": missing digit 
or curly brace.");
+                    throw new 
IllegalArgumentException(sm.getString("substitution.missingDigit", sub));
                 }
             }
         }


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

Reply via email to