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 2023/02/23 16:48:36 UTC
[tomcat] 02/06: Use i18n
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit cfc1812ac9a54f7c5b18ddedfa875df2b283dbe0
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Feb 23 16:41:59 2023 +0000
Use i18n
---
java/org/apache/catalina/connector/CoyoteAdapter.java | 10 +++++-----
java/org/apache/catalina/connector/LocalStrings.properties | 3 +++
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/java/org/apache/catalina/connector/CoyoteAdapter.java b/java/org/apache/catalina/connector/CoyoteAdapter.java
index 0e0526a878..d13cefc327 100644
--- a/java/org/apache/catalina/connector/CoyoteAdapter.java
+++ b/java/org/apache/catalina/connector/CoyoteAdapter.java
@@ -629,7 +629,7 @@ public class CoyoteAdapter implements Adapter {
connector.getService().getContainer().logAccess(request, response, 0, true);
return false;
} else {
- response.sendError(400, "Invalid URI");
+ response.sendError(400, sm.getString("coyoteAdapter.invalidURI"));
}
}
@@ -643,7 +643,7 @@ public class CoyoteAdapter implements Adapter {
if (undecodedURI.getType() == MessageBytes.T_BYTES) {
if (connector.getRejectSuspiciousURIs()) {
if (checkSuspiciousURIs(undecodedURI.getByteChunk())) {
- response.sendError(400, "Invalid URI");
+ response.sendError(400, sm.getString("coyoteAdapter.invalidURI"));
}
}
@@ -658,7 +658,7 @@ public class CoyoteAdapter implements Adapter {
try {
req.getURLDecoder().convert(decodedURI.getByteChunk(), connector.getEncodedSolidusHandlingInternal());
} catch (IOException ioe) {
- response.sendError(400, "Invalid URI: " + ioe.getMessage());
+ response.sendError(400, sm.getString("coyoteAdapter.invalidURIWithMessage", ioe.getMessage()));
}
// Normalization
if (normalize(req.decodedURI(), connector.getAllowBackslash())) {
@@ -668,7 +668,7 @@ public class CoyoteAdapter implements Adapter {
// Therefore it is not necessary to check that the URI remains
// normalized after character decoding
} else {
- response.sendError(400, "Invalid URI");
+ response.sendError(400, sm.getString("coyoteAdapter.invalidURI"));
}
} else {
/* The URI is chars or String, and has been sent using an in-memory
@@ -866,7 +866,7 @@ public class CoyoteAdapter implements Adapter {
if (header != null) {
res.addHeader("Allow", header);
}
- response.sendError(405, "TRACE method is not allowed");
+ response.sendError(405, sm.getString("coyoteAdapter.trace"));
// Safe to skip the remainder of this method.
return true;
}
diff --git a/java/org/apache/catalina/connector/LocalStrings.properties b/java/org/apache/catalina/connector/LocalStrings.properties
index 4f77e0eb9b..7d81708f8e 100644
--- a/java/org/apache/catalina/connector/LocalStrings.properties
+++ b/java/org/apache/catalina/connector/LocalStrings.properties
@@ -21,7 +21,10 @@ coyoteAdapter.checkRecycled.request=Encountered a non-recycled request and recyc
coyoteAdapter.checkRecycled.response=Encountered a non-recycled response and recycled it forcedly.
coyoteAdapter.connect=HTTP requests using the CONNECT method are not supported
coyoteAdapter.debug=The variable [{0}] has value [{1}]
+coyoteAdapter.invalidURI=Invalid URI
+coyoteAdapter.invalidURIWithMessage=Invalid URI: [{0}]
coyoteAdapter.nullRequest=An asynchronous dispatch may only happen on an existing request
+coyoteAdapter.trace=TRACE method is not allowed
coyoteConnector.invalidEncoding=The encoding [{0}] is not recognised by the JRE. The Connector will continue to use [{1}]
coyoteConnector.invalidPort=The connector cannot start since the specified port value of [{0}] is invalid
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org