This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push: new 413fe6eec3 Add missing strings 413fe6eec3 is described below commit 413fe6eec34f9e9c57f56867fac9098465e8c670 Author: remm <r...@apache.org> AuthorDate: Thu Feb 8 11:45:33 2024 +0100 Add missing strings --- java/org/apache/catalina/filters/CsrfPreventionFilter.java | 3 ++- java/org/apache/catalina/filters/LocalStrings.properties | 1 + java/org/apache/catalina/valves/FilterValve.java | 14 ++++++-------- java/org/apache/catalina/valves/LocalStrings.properties | 6 ++++++ java/org/apache/tomcat/util/codec/binary/BaseNCodec.java | 2 +- .../tomcat/util/codec/binary/LocalStrings.properties | 2 ++ 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/java/org/apache/catalina/filters/CsrfPreventionFilter.java b/java/org/apache/catalina/filters/CsrfPreventionFilter.java index 2d65bb3544..9d4639c2bf 100644 --- a/java/org/apache/catalina/filters/CsrfPreventionFilter.java +++ b/java/org/apache/catalina/filters/CsrfPreventionFilter.java @@ -70,6 +70,7 @@ import org.apache.juli.logging.LogFactory; * Some URLs should not have nonce parameters added to them at all */ public class CsrfPreventionFilter extends CsrfPreventionFilterBase { + /** * The default set of URL patterns for which nonces will not be appended. */ @@ -240,7 +241,7 @@ public class CsrfPreventionFilter extends CsrfPreventionFilterBase { } else if (pattern.startsWith("/") && pattern.endsWith("/")) { return new PatternPredicate(pattern.substring(1, pattern.length() - 1)); } else { - throw new IllegalArgumentException("Unsupported pattern: " + pattern); + throw new IllegalArgumentException(sm.getString("csrfPrevention.unsupportedPattern", pattern)); } } diff --git a/java/org/apache/catalina/filters/LocalStrings.properties b/java/org/apache/catalina/filters/LocalStrings.properties index e7766c74d3..5c5da1559e 100644 --- a/java/org/apache/catalina/filters/LocalStrings.properties +++ b/java/org/apache/catalina/filters/LocalStrings.properties @@ -24,6 +24,7 @@ corsFilter.wrongType1=Expects an HttpServletRequest object of type [{0}] corsFilter.wrongType2=Expects an HttpServletRequest object of type [{0}] or [{1}] csrfPrevention.invalidRandomClass=Unable to create Random source using class [{0}] +csrfPrevention.unsupportedPattern=Unsupported pattern [{0}] expiresFilter.exceptionProcessingParameter=Exception processing configuration parameter [{0}]:[{1}] expiresFilter.expirationHeaderAlreadyDefined=Request [{0}] with response status [{1}] content-type [{2}], expiration header already defined diff --git a/java/org/apache/catalina/valves/FilterValve.java b/java/org/apache/catalina/valves/FilterValve.java index 4405106d31..f110f05274 100644 --- a/java/org/apache/catalina/valves/FilterValve.java +++ b/java/org/apache/catalina/valves/FilterValve.java @@ -141,8 +141,7 @@ public class FilterValve extends ValveBase implements FilterConfig { @Override public ServletContext getServletContext() { if (null == application) { - throw new IllegalStateException("Filter " + filter + - " has called getServletContext from FilterValve, but this FilterValve is not "); + throw new IllegalStateException(sm.getString("filterValve.noContext", getFilterClassName())); } else { return application; } @@ -184,7 +183,7 @@ public class FilterValve extends ValveBase implements FilterConfig { super.startInternal(); if (null == getFilterClassName()) { - throw new LifecycleException("No filterClass specified for FilterValve: a filterClass is required"); + throw new LifecycleException(sm.getString("filterValve.nullFilterClassName")); } Container parent = super.getContainer(); if (parent instanceof Context) { @@ -202,8 +201,7 @@ public class FilterValve extends ValveBase implements FilterConfig { ScheduledThreadPoolExecutor.class.getName().equals(args[0])) { return executor; } else { - throw new UnsupportedOperationException( - "This ServletContext is not really meant to be used."); + throw new UnsupportedOperationException(sm.getString("filterValve.proxyServletContext")); } } }); @@ -215,7 +213,7 @@ public class FilterValve extends ValveBase implements FilterConfig { filter.init(this); } catch (ServletException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException | ClassNotFoundException se) { - throw new LifecycleException("Failed to start FilterValve for filter " + filter, se); + throw new LifecycleException(sm.getString("filterValve.initError", getFilterClassName()), se); } } @@ -245,11 +243,11 @@ public class FilterValve extends ValveBase implements FilterConfig { if (!filterCallInfo.stop) { if (request != filterCallInfo.request) { - throw new IllegalStateException("Filter " + filter + " has illegally changed or wrapped the request"); + throw new IllegalStateException(sm.getString("filterValve.illegalWrapping", getFilterClassName())); } if (response != filterCallInfo.response) { - throw new IllegalStateException("Filter " + filter + " has illegally changed or wrapped the response"); + throw new IllegalStateException(sm.getString("filterValve.illegalWrapping", getFilterClassName())); } getNext().invoke(request, response); diff --git a/java/org/apache/catalina/valves/LocalStrings.properties b/java/org/apache/catalina/valves/LocalStrings.properties index b58f4d3221..62c342c3d2 100644 --- a/java/org/apache/catalina/valves/LocalStrings.properties +++ b/java/org/apache/catalina/valves/LocalStrings.properties @@ -50,6 +50,12 @@ extendedAccessLogValve.emptyPattern=Pattern was just empty or whitespace extendedAccessLogValve.noClosing=No closing ) found for in decode extendedAccessLogValve.patternParseError=Error parsing pattern [{0}] +filterValve.illegalWrapping=Filter of class [{0}] has illegally changed or wrapped the request +filterValve.initError=Error initializing filter of class [{0}] +filterValve.noContext=The filter valve for [{0}] has no associated Context +filterValve.nullFilterClassName=The filter class name is null +filterValve.proxyServletContext=This proxy Servlet context should not be used + http.400.desc=The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). http.400.reason=Bad Request http.401.desc=The request has not been applied to the target resource because it lacks valid authentication credentials for that resource. diff --git a/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java b/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java index 3575c992a8..7c7bf17fa5 100644 --- a/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java +++ b/java/org/apache/tomcat/util/codec/binary/BaseNCodec.java @@ -160,7 +160,7 @@ public abstract class BaseNCodec { private static int createPositiveCapacity(final int minCapacity) { if (minCapacity < 0) { // overflow - throw new OutOfMemoryError("Unable to allocate array size: " + (minCapacity & 0xffffffffL)); + throw new OutOfMemoryError(sm.getString("base64.outOfMemory", Long.valueOf(minCapacity & 0xffffffffL))); } // This is called when we require buffer expansion to a very big array. // Use the conservative maximum buffer size if possible, otherwise the biggest required. diff --git a/java/org/apache/tomcat/util/codec/binary/LocalStrings.properties b/java/org/apache/tomcat/util/codec/binary/LocalStrings.properties index 1ae86a32fb..6b17260a15 100644 --- a/java/org/apache/tomcat/util/codec/binary/LocalStrings.properties +++ b/java/org/apache/tomcat/util/codec/binary/LocalStrings.properties @@ -17,3 +17,5 @@ base64.impossibleModulus=Impossible modulus [{0}] base64.inputTooLarge=Input array too large, the output array would be bigger [{0}] than the specified maximum size of [{1}] base64.lineSeparator=Line separator must not contain base64 characters [{0}] base64.nullEncodeParameter=Cannot encode integer with null parameter + +base64.outOfMemory=Unable to allocate array size [{0}] --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org