This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new 31fc7c3942 Add missing strings 31fc7c3942 is described below commit 31fc7c3942f5d867dd17ccc3e3b7904eb3012f0d Author: remm <r...@apache.org> AuthorDate: Thu Oct 5 11:15:09 2023 +0200 Add missing strings Also cleanups. --- .../org/apache/catalina/authenticator/BasicAuthenticator.java | 6 +++--- .../org/apache/catalina/authenticator/LocalStrings.properties | 3 +++ java/org/apache/catalina/realm/JNDIRealm.java | 4 ++-- java/org/apache/catalina/realm/LocalStrings.properties | 1 + .../org/apache/coyote/http11/filters/BufferedInputFilter.java | 8 +++++--- java/org/apache/coyote/http11/filters/ChunkedInputFilter.java | 3 +-- java/org/apache/coyote/http11/filters/LocalStrings.properties | 3 +++ java/org/apache/jasper/runtime/PageContextImpl.java | 2 +- java/org/apache/tomcat/util/buf/LocalStrings.properties | 1 + java/org/apache/tomcat/util/buf/UDecoder.java | 4 ++-- .../tomcat/util/net/openssl/ciphers/LocalStrings.properties | 1 + java/org/apache/tomcat/util/threads/LocalStrings.properties | 2 ++ java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java | 11 +++++------ java/org/apache/tomcat/websocket/DigestAuthenticator.java | 5 ++++- java/org/apache/tomcat/websocket/LocalStrings.properties | 2 ++ .../org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java | 5 ----- 16 files changed, 36 insertions(+), 25 deletions(-) diff --git a/java/org/apache/catalina/authenticator/BasicAuthenticator.java b/java/org/apache/catalina/authenticator/BasicAuthenticator.java index eb9e4dbc20..acdf084051 100644 --- a/java/org/apache/catalina/authenticator/BasicAuthenticator.java +++ b/java/org/apache/catalina/authenticator/BasicAuthenticator.java @@ -100,7 +100,7 @@ public class BasicAuthenticator extends AuthenticatorBase { } } catch (IllegalArgumentException iae) { if (log.isDebugEnabled()) { - log.debug("Invalid Authorization" + iae.getMessage()); + log.debug(sm.getString("basicAuthenticator.invalidAuthorization", iae.getMessage())); } } } @@ -221,7 +221,7 @@ public class BasicAuthenticator extends AuthenticatorBase { base64blobLength = authorization.getLength() - METHOD.length(); } else { // is this possible, or permitted? - throw new IllegalArgumentException("Authorization header method is not \"Basic\""); + throw new IllegalArgumentException(sm.getString("basicAuthenticator.notBasic")); } } @@ -235,7 +235,7 @@ public class BasicAuthenticator extends AuthenticatorBase { // restore original offset authorization.setOffset(initialOffset); if (decoded == null) { - throw new IllegalArgumentException("Basic Authorization credentials are not Base64"); + throw new IllegalArgumentException(sm.getString("basicAuthenticator.notBase64")); } return decoded; } diff --git a/java/org/apache/catalina/authenticator/LocalStrings.properties b/java/org/apache/catalina/authenticator/LocalStrings.properties index 4be5aff94f..d66d2f2492 100644 --- a/java/org/apache/catalina/authenticator/LocalStrings.properties +++ b/java/org/apache/catalina/authenticator/LocalStrings.properties @@ -32,7 +32,10 @@ authenticator.sessionExpired=The time allowed for the login process has been exc authenticator.tomcatPrincipalLogoutFail=Logout with TomcatPrincipal instance has failed authenticator.unauthorized=Cannot authenticate with the provided credentials +basicAuthenticator.invalidAuthorization=Invalid Authorization: [{0}] basicAuthenticator.invalidCharset=The only permitted values are null, the empty string or UTF-8 +basicAuthenticator.notBase64=Basic Authorization credentials are not Base64 +basicAuthenticator.notBasic=Authorization header method is not ''Basic'' digestAuthenticator.cacheRemove=A valid entry has been removed from client nonce cache to make room for new entries. A replay attack is now possible. To prevent the possibility of replay attacks, reduce nonceValidity or increase nonceCacheSize. Further warnings of this type will be suppressed for 5 minutes. digestAuthenticator.invalidAlgorithm=Unable to configure DIGEST authentication to use the algorithm [{0}] as it is not permitted by RFC 7616. diff --git a/java/org/apache/catalina/realm/JNDIRealm.java b/java/org/apache/catalina/realm/JNDIRealm.java index 84073c9824..0cfc594b21 100644 --- a/java/org/apache/catalina/realm/JNDIRealm.java +++ b/java/org/apache/catalina/realm/JNDIRealm.java @@ -2927,11 +2927,11 @@ public class JNDIRealm extends RealmBase { String pathComponent = userNameUri.getPath(); // Should not ever have an empty path component, since that is /{DN} if (pathComponent.length() < 1) { - throw new InvalidNameException("Search returned unparseable absolute name: " + resultName); + throw new InvalidNameException(sm.getString("jndiRealm.invalidName", resultName)); } name = parser.parse(pathComponent.substring(1)); } catch (URISyntaxException e) { - throw new InvalidNameException("Search returned unparseable absolute name: " + resultName); + throw new InvalidNameException(sm.getString("jndiRealm.invalidName", resultName)); } } diff --git a/java/org/apache/catalina/realm/LocalStrings.properties b/java/org/apache/catalina/realm/LocalStrings.properties index 7ac439ff9d..aeb49cde38 100644 --- a/java/org/apache/catalina/realm/LocalStrings.properties +++ b/java/org/apache/catalina/realm/LocalStrings.properties @@ -77,6 +77,7 @@ jndiRealm.emptyCipherSuites=Empty String for cipher suites given. Using default jndiRealm.exception=Exception performing authentication jndiRealm.exception.retry=Exception performing authentication. Retrying... jndiRealm.invalidHostnameVerifier=[{0}] not a valid class name for a HostnameVerifier +jndiRealm.invalidName=Search returned unparsable absolute name: [{0}] jndiRealm.invalidSslProtocol=Given protocol [{0}] is invalid. It has to be one of [{1}] jndiRealm.invalidSslSocketFactory=[{0}] not a valid class name for an SSLSocketFactory jndiRealm.multipleEntries=User name [{0}] has multiple entries diff --git a/java/org/apache/coyote/http11/filters/BufferedInputFilter.java b/java/org/apache/coyote/http11/filters/BufferedInputFilter.java index a091c92f3a..8727f4d1a6 100644 --- a/java/org/apache/coyote/http11/filters/BufferedInputFilter.java +++ b/java/org/apache/coyote/http11/filters/BufferedInputFilter.java @@ -26,6 +26,7 @@ import org.apache.coyote.Request; import org.apache.coyote.http11.InputFilter; import org.apache.tomcat.util.buf.ByteChunk; import org.apache.tomcat.util.net.ApplicationBufferHandler; +import org.apache.tomcat.util.res.StringManager; /** * Input filter responsible for reading and buffering the request body, so that @@ -33,6 +34,8 @@ import org.apache.tomcat.util.net.ApplicationBufferHandler; */ public class BufferedInputFilter implements InputFilter, ApplicationBufferHandler { + private static final StringManager sm = StringManager.getManager(BufferedInputFilter.class); + private static final String ENCODING_NAME = "buffered"; private static final ByteChunk ENCODING = new ByteChunk(); @@ -91,7 +94,7 @@ public class BufferedInputFilter implements InputFilter, ApplicationBufferHandle swallowed += read; if (maxSwallowSize > -1 && swallowed > maxSwallowSize) { // No need for i18n - this isn't going to get logged - throw new IOException("Ignored body exceeded maxSwallowSize"); + throw new IOException(sm.getString("bufferedInputFilter.maxSwallowSize")); } } } else { @@ -102,8 +105,7 @@ public class BufferedInputFilter implements InputFilter, ApplicationBufferHandle } } catch(IOException | BufferOverflowException ioe) { // No need for i18n - this isn't going to get logged anywhere - throw new IllegalStateException( - "Request body too large for buffer"); + throw new IllegalStateException(sm.getString("bufferedInputFilter.bodySize", ioe.getMessage())); } } diff --git a/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java b/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java index 33d7feef10..7fe17f7b9d 100644 --- a/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java +++ b/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java @@ -41,8 +41,7 @@ import org.apache.tomcat.util.res.StringManager; */ public class ChunkedInputFilter implements InputFilter, ApplicationBufferHandler { - private static final StringManager sm = StringManager.getManager( - ChunkedInputFilter.class.getPackage().getName()); + private static final StringManager sm = StringManager.getManager(ChunkedInputFilter.class); // -------------------------------------------------------------- Constants diff --git a/java/org/apache/coyote/http11/filters/LocalStrings.properties b/java/org/apache/coyote/http11/filters/LocalStrings.properties index c0dc9d1b10..72dc788bc5 100644 --- a/java/org/apache/coyote/http11/filters/LocalStrings.properties +++ b/java/org/apache/coyote/http11/filters/LocalStrings.properties @@ -13,6 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +bufferedInputFilter.bodySize=Request body too large for buffer: [{0}] +bufferedInputFilter.maxSwallowSize=Ignored body exceeded maxSwallowSize + chunkedInputFilter.eos=Unexpected end of stream while reading request body chunkedInputFilter.eosTrailer=Unexpected end of stream while reading trailer headers chunkedInputFilter.error=No data available due to previous error diff --git a/java/org/apache/jasper/runtime/PageContextImpl.java b/java/org/apache/jasper/runtime/PageContextImpl.java index 7da2825ccb..e3e83acc50 100644 --- a/java/org/apache/jasper/runtime/PageContextImpl.java +++ b/java/org/apache/jasper/runtime/PageContextImpl.java @@ -257,7 +257,7 @@ public class PageContextImpl extends PageContext { break; default: - throw new IllegalArgumentException("Invalid scope"); + throw new IllegalArgumentException(Localizer.getMessage("jsp.error.page.invalid.scope")); } } } diff --git a/java/org/apache/tomcat/util/buf/LocalStrings.properties b/java/org/apache/tomcat/util/buf/LocalStrings.properties index b4d5a4eccb..576eea58a8 100644 --- a/java/org/apache/tomcat/util/buf/LocalStrings.properties +++ b/java/org/apache/tomcat/util/buf/LocalStrings.properties @@ -30,6 +30,7 @@ hexUtils.fromHex.oddDigits=The input must consist of an even number of hex digit messageBytes.illegalCharacter=The Unicode character [{0}] at code point [{1}] cannot be encoded as it is outside the permitted range of 0 to 255 uDecoder.eof=End of file (EOF) +uDecoder.isHexDigit=The hexadecimal encoding is invalid uDecoder.noSlash=The encoded slash character is not allowed uDecoder.urlDecode.conversionError=Failed to decode [{0}] using character set [{1}] uDecoder.urlDecode.missingDigit=Failed to decode [{0}] because the % character must be followed by two hexadecimal digits diff --git a/java/org/apache/tomcat/util/buf/UDecoder.java b/java/org/apache/tomcat/util/buf/UDecoder.java index 10f605fb59..937b441fc3 100644 --- a/java/org/apache/tomcat/util/buf/UDecoder.java +++ b/java/org/apache/tomcat/util/buf/UDecoder.java @@ -57,10 +57,10 @@ public final class UDecoder { private static final IOException EXCEPTION_EOF = new DecodeException(sm.getString("uDecoder.eof")); /** %xx with not-hex digit */ - private static final IOException EXCEPTION_NOT_HEX_DIGIT = new DecodeException("isHexDigit"); + private static final IOException EXCEPTION_NOT_HEX_DIGIT = new DecodeException(sm.getString("uDecoder.isHexDigit")); /** %-encoded slash is forbidden in resource path */ - private static final IOException EXCEPTION_SLASH = new DecodeException("noSlash"); + private static final IOException EXCEPTION_SLASH = new DecodeException(sm.getString("uDecoder.noSlash")); /** diff --git a/java/org/apache/tomcat/util/net/openssl/ciphers/LocalStrings.properties b/java/org/apache/tomcat/util/net/openssl/ciphers/LocalStrings.properties index 7de7e453ad..27c7e49d52 100644 --- a/java/org/apache/tomcat/util/net/openssl/ciphers/LocalStrings.properties +++ b/java/org/apache/tomcat/util/net/openssl/ciphers/LocalStrings.properties @@ -15,3 +15,4 @@ opensslCipherConfigurationParser.effectiveCiphers=Ciphers used: [{0}] opensslCipherConfigurationParser.unknownElement=Unknown element in cipher string: [{0}] +opensslCipherConfigurationParser.unknownProfile=Cannot use OpenSSL to resolve profile [{0}], it will be passed along as the cipher suite diff --git a/java/org/apache/tomcat/util/threads/LocalStrings.properties b/java/org/apache/tomcat/util/threads/LocalStrings.properties index 312449119d..4b28c96f84 100644 --- a/java/org/apache/tomcat/util/threads/LocalStrings.properties +++ b/java/org/apache/tomcat/util/threads/LocalStrings.properties @@ -15,5 +15,7 @@ taskQueue.notRunning=Executor not running, can't force a command into the queue +threadPoolExecutor.invalidKeepAlive=Core threads must have positive keep alive times threadPoolExecutor.queueFull=Queue capacity is full +threadPoolExecutor.taskRejected=Task [{0}] rejected from [{1}] threadPoolExecutor.threadStoppedToAvoidPotentialLeak=Stopping thread [{0}] to avoid potential memory leaks after a context was stopped. diff --git a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java index 7ea4c91ad7..6f6f381578 100644 --- a/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java +++ b/java/org/apache/tomcat/util/threads/ThreadPoolExecutor.java @@ -1762,7 +1762,7 @@ public class ThreadPoolExecutor extends AbstractExecutorService { */ public void allowCoreThreadTimeOut(boolean value) { if (value && keepAliveTime <= 0) { - throw new IllegalArgumentException("Core threads must have nonzero keep alive times"); + throw new IllegalArgumentException(sm.getString("threadPoolExecutor.invalidKeepAlive")); } if (value != allowCoreThreadTimeOut) { allowCoreThreadTimeOut = value; @@ -1822,10 +1822,10 @@ public class ThreadPoolExecutor extends AbstractExecutorService { */ public void setKeepAliveTime(long time, TimeUnit unit) { if (time < 0) { - throw new IllegalArgumentException(); + throw new IllegalArgumentException(sm.getString("threadPoolExecutor.invalidKeepAlive")); } if (time == 0 && allowsCoreThreadTimeOut()) { - throw new IllegalArgumentException("Core threads must have nonzero keep alive times"); + throw new IllegalArgumentException(sm.getString("threadPoolExecutor.invalidKeepAlive")); } long keepAliveTime = unit.toNanos(time); long delta = keepAliveTime - this.keepAliveTime; @@ -2290,9 +2290,8 @@ public class ThreadPoolExecutor extends AbstractExecutorService { */ @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor e) { - throw new RejectedExecutionException("Task " + r.toString() + - " rejected from " + - e.toString()); + throw new RejectedExecutionException( + sm.getString("threadPoolExecutor.taskRejected", r.toString(), e.toString())); } } diff --git a/java/org/apache/tomcat/websocket/DigestAuthenticator.java b/java/org/apache/tomcat/websocket/DigestAuthenticator.java index 54d8aa579d..dd67f3faed 100644 --- a/java/org/apache/tomcat/websocket/DigestAuthenticator.java +++ b/java/org/apache/tomcat/websocket/DigestAuthenticator.java @@ -23,12 +23,15 @@ import java.security.SecureRandom; import java.util.Map; import org.apache.tomcat.util.buf.HexUtils; +import org.apache.tomcat.util.res.StringManager; /** * Authenticator supporting the DIGEST authentication method. */ public class DigestAuthenticator extends Authenticator { + private static final StringManager sm = StringManager.getManager(DigestAuthenticator.class); + public static final String schemeName = "digest"; private static final Object cnonceGeneratorLock = new Object(); private static volatile SecureRandom cnonceGenerator; @@ -80,7 +83,7 @@ public class DigestAuthenticator extends Authenticator { } catch (NoSuchAlgorithmException e) { - throw new AuthenticationException("Unable to generate request digest " + e.getMessage()); + throw new AuthenticationException(sm.getString("digestAuthenticator.algorithm", e.getMessage())); } challenge.append("algorithm=" + algorithm + ","); diff --git a/java/org/apache/tomcat/websocket/LocalStrings.properties b/java/org/apache/tomcat/websocket/LocalStrings.properties index e7123980b0..47af443304 100644 --- a/java/org/apache/tomcat/websocket/LocalStrings.properties +++ b/java/org/apache/tomcat/websocket/LocalStrings.properties @@ -40,6 +40,8 @@ caseInsensitiveKeyMap.nullKey=Null keys are not permitted clientEndpointHolder.instanceCreationFailed=Failed to create WebSocketEndpoint clientEndpointHolder.instanceRegistrationFailed=Failed to register Endpoint instance with the InstanceManager +digestAuthenticator.algorithm=Unable to generate request digest [{0}] + futureToSendHandler.timeout=Operation timed out after waiting [{0}] [{1}] to complete perMessageDeflate.alreadyClosed=The transformer has been closed and may no longer be used diff --git a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java index e605105013..b8031526d0 100644 --- a/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java +++ b/java/org/apache/tomcat/websocket/WsRemoteEndpointImplBase.java @@ -1231,11 +1231,6 @@ public abstract class WsRemoteEndpointImplBase implements RemoteEndpoint { // NO-OP. Leave state as is. } else if (state == State.STREAM_WRITING) { // NO-OP. Leave state as is. - } else { - // Should never happen - // The if ... else ... blocks above should cover all states - // permitted by the preceding checkState() call - throw new IllegalStateException("BUG: This code should never be called"); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org