[tomcat] 01/02: Align with 8.5.x/9.0.x
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 661f583a14dd509e39d084dc50c7c94ffc7993fd Author: Mark Thomas AuthorDate: Fri Nov 8 22:10:46 2019 + Align with 8.5.x/9.0.x --- .../apache/catalina/tribes/util/StringManager.java | 177 + 1 file changed, 145 insertions(+), 32 deletions(-) diff --git a/java/org/apache/catalina/tribes/util/StringManager.java b/java/org/apache/catalina/tribes/util/StringManager.java index 2204245..53caf03 100644 --- a/java/org/apache/catalina/tribes/util/StringManager.java +++ b/java/org/apache/catalina/tribes/util/StringManager.java @@ -18,11 +18,15 @@ package org.apache.catalina.tribes.util; import java.text.MessageFormat; +import java.util.Enumeration; import java.util.Hashtable; +import java.util.LinkedHashMap; import java.util.Locale; +import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; + /** * An internationalization / localization helper class which reduces * the bother of handling ResourceBundles and takes care of the @@ -49,11 +53,14 @@ import java.util.ResourceBundle; */ public class StringManager { +private static int LOCALE_CACHE_SIZE = 10; + /** * The ResourceBundle for this StringManager. */ -private ResourceBundle bundle; -private Locale locale; +private final ResourceBundle bundle; +private final Locale locale; + /** * Creates a new StringManager for a given package. This is a @@ -63,53 +70,67 @@ public class StringManager { * * @param packageName Name of package to create StringManager for. */ -private StringManager(String packageName) { +private StringManager(String packageName, Locale locale) { String bundleName = packageName + ".LocalStrings"; +ResourceBundle bnd = null; try { -bundle = ResourceBundle.getBundle(bundleName, Locale.getDefault()); -} catch( MissingResourceException ex ) { +bnd = ResourceBundle.getBundle(bundleName, locale); +} catch (MissingResourceException ex) { // Try from the current loader (that's the case for trusted apps) // Should only be required if using a TC5 style classloader structure // where common != shared != server ClassLoader cl = Thread.currentThread().getContextClassLoader(); -if( cl != null ) { +if (cl != null) { try { -bundle = ResourceBundle.getBundle( -bundleName, Locale.getDefault(), cl); -} catch(MissingResourceException ex2) { +bnd = ResourceBundle.getBundle(bundleName, locale, cl); +} catch (MissingResourceException ex2) { // Ignore } } } +bundle = bnd; // Get the actual locale, which may be different from the requested one if (bundle != null) { -locale = bundle.getLocale(); +Locale bundleLocale = bundle.getLocale(); +if (bundleLocale.equals(Locale.ROOT)) { +this.locale = Locale.ENGLISH; +} else { +this.locale = bundleLocale; +} +} else { +this.locale = null; } } -/** -Get a string from the underlying resource bundle or return -null if the String is not found. -@param key to desired resource String -@return resource String matching key from underlying -bundle or null if not found. -@throws IllegalArgumentException if key is null. +/** + * Get a string from the underlying resource bundle or return null if the + * String is not found. + * + * @param key to desired resource String + * + * @return resource String matching key from underlying bundle or + * null if not found. + * + * @throws IllegalArgumentException if key is null */ public String getString(String key) { -if(key == null){ +if (key == null){ String msg = "key may not have a null value"; - throw new IllegalArgumentException(msg); } String str = null; try { -str = bundle.getString(key); -} catch(MissingResourceException mre) { +// Avoid NPE if bundle is null and treat it like an MRE +if (bundle != null) { +str = bundle.getString(key); +} +} catch (MissingResourceException mre) { //bad: shouldn't mask an exception the following way: -// str = "[cannot find message associated with key '" + key + "' due to " + mre + "]"; +// str = "[cannot find message associated with key '" + key + +
[tomcat] 01/02: Align with 8.5.x
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 78803c53f4ffa4eebe68faa4bf0d283145ff94f7 Author: Mark Thomas AuthorDate: Mon Sep 9 12:55:46 2019 +0100 Align with 8.5.x --- .../coyote/http11/filters/ChunkedOutputFilter.java | 23 +- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java index 6e2c7f9..d6ef494 100644 --- a/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java +++ b/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.coyote.http11.filters; import java.io.IOException; @@ -122,7 +121,6 @@ public class ChunkedOutputFilter implements OutputFilter { buffer.doWrite(chunkHeader, res); return result; - } @@ -134,46 +132,27 @@ public class ChunkedOutputFilter implements OutputFilter { // --- OutputFilter Methods - -/** - * Some filters need additional parameters from the response. All the - * necessary reading can occur in that method, as this method is called - * after the response header processing is complete. - */ @Override public void setResponse(Response response) { // NOOP: No need for parameters from response in this filter } -/** - * Set the next buffer in the filter pipeline. - */ @Override public void setBuffer(OutputBuffer buffer) { this.buffer = buffer; } -/** - * End the current request. It is acceptable to write extra bytes using - * buffer.doWrite during the execution of this method. - */ @Override -public long end() -throws IOException { - +public long end() throws IOException { // Write end chunk buffer.doWrite(END_CHUNK, null); return 0; - } -/** - * Make the filter ready to process the next request. - */ @Override public void recycle() { // NOOP: Nothing to recycle - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Align with 8.5.x.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 9bc20a26655809be0af2d93f840baacb6e4b2225 Author: Mark Thomas AuthorDate: Fri Aug 2 10:04:07 2019 +0100 Align with 8.5.x. --- test/org/apache/catalina/startup/TestListener.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/org/apache/catalina/startup/TestListener.java b/test/org/apache/catalina/startup/TestListener.java index 3d873e3..cfd62b7 100644 --- a/test/org/apache/catalina/startup/TestListener.java +++ b/test/org/apache/catalina/startup/TestListener.java @@ -31,7 +31,7 @@ import org.apache.catalina.Context; public class TestListener extends TomcatBaseTest { -/** +/* * Check that a ServletContainerInitializer can install a * {@link ServletContextListener} and that it gets initialized. * @throws Exception @@ -48,9 +48,9 @@ public class TestListener extends TomcatBaseTest { Assert.assertTrue(SCL.initialized); } -/** +/* * Check that a {@link ServletContextListener} cannot install a - * {@link javax.servlet.ServletContainerInitializer}. + * {@link ServletContainerInitializer}. * @throws Exception */ @Test - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Align with 8.5.x
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 019a21d1d6302a0d02bf514af78a039d3649459b Author: Mark Thomas AuthorDate: Tue Jul 30 16:24:22 2019 +0100 Align with 8.5.x --- test/org/apache/catalina/filters/TestRemoteIpFilter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/org/apache/catalina/filters/TestRemoteIpFilter.java b/test/org/apache/catalina/filters/TestRemoteIpFilter.java index f6c14eb..3db2d24 100644 --- a/test/org/apache/catalina/filters/TestRemoteIpFilter.java +++ b/test/org/apache/catalina/filters/TestRemoteIpFilter.java @@ -648,7 +648,7 @@ public class TestRemoteIpFilter extends TomcatBaseTest { actualRequest.getAttribute(Globals.REQUEST_FORWARDED_ATTRIBUTE)); } -/** +/* * Test {@link RemoteIpFilter} in Tomcat standalone server */ @Test - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Align with 8.5.x. Use i18n.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit d2f21d52a6d10f711e685aaae577c1663bd3d661 Author: Mark Thomas AuthorDate: Tue Jul 2 13:52:04 2019 +0100 Align with 8.5.x. Use i18n. --- java/org/apache/catalina/servlets/DefaultServlet.java| 2 +- java/org/apache/catalina/servlets/LocalStrings.properties| 1 + java/org/apache/catalina/servlets/LocalStrings_fr.properties | 1 + java/org/apache/catalina/servlets/LocalStrings_ja.properties | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/java/org/apache/catalina/servlets/DefaultServlet.java b/java/org/apache/catalina/servlets/DefaultServlet.java index 6821f66..5a5eddd 100644 --- a/java/org/apache/catalina/servlets/DefaultServlet.java +++ b/java/org/apache/catalina/servlets/DefaultServlet.java @@ -1449,7 +1449,7 @@ public class DefaultServlet extends HttpServlet { osWriter.flush(); return new ByteArrayInputStream(stream.toByteArray()); } catch (TransformerException e) { -throw new ServletException("XSL transformer error", e); +throw new ServletException(sm.getString("defaultServlet.xslError"), e); } finally { if (Globals.IS_SECURITY_ENABLED) { PrivilegedSetTccl pa = new PrivilegedSetTccl(original); diff --git a/java/org/apache/catalina/servlets/LocalStrings.properties b/java/org/apache/catalina/servlets/LocalStrings.properties index 22adaa8..13a9d40 100644 --- a/java/org/apache/catalina/servlets/LocalStrings.properties +++ b/java/org/apache/catalina/servlets/LocalStrings.properties @@ -41,6 +41,7 @@ defaultServlet.blockExternalSubset=Blocked access to external subset with name [ defaultServlet.missingResource=The requested resource [{0}] is not available defaultServlet.noResources=No static resources were found defaultServlet.skipfail=Read failed because only [{0}] bytes were available but needed to skip [{1}] bytes to reach the start of the requested range +defaultServlet.xslError=XSL transformer error directory.filename=Filename directory.lastModified=Last Modified diff --git a/java/org/apache/catalina/servlets/LocalStrings_fr.properties b/java/org/apache/catalina/servlets/LocalStrings_fr.properties index 4ee5781..fdcb2ec 100644 --- a/java/org/apache/catalina/servlets/LocalStrings_fr.properties +++ b/java/org/apache/catalina/servlets/LocalStrings_fr.properties @@ -41,6 +41,7 @@ defaultServlet.blockExternalSubset=L''accès au sous-ensemble externe de nom [{0 defaultServlet.missingResource=La ressource demandée [{0}] n''est pas disponible defaultServlet.noResources=Pas de ressources statiques defaultServlet.skipfail=La lecture a échouée parce que seuls [{0}] octets étaient disponibles alors qu''il était nécessaire d''en sauter [{1}] pour atteindre le début de la plage demandée +defaultServlet.xslError=Erreur de transformation XSL directory.filename=Nom de fichier directory.lastModified=Dernière modification diff --git a/java/org/apache/catalina/servlets/LocalStrings_ja.properties b/java/org/apache/catalina/servlets/LocalStrings_ja.properties index 7105faf..e3a35af 100644 --- a/java/org/apache/catalina/servlets/LocalStrings_ja.properties +++ b/java/org/apache/catalina/servlets/LocalStrings_ja.properties @@ -39,6 +39,7 @@ defaultServlet.blockExternalSubset=名前[{0}]およびベースURI [{1}]を持 defaultServlet.missingResource=要求されたリソース [{0}] は利用できません。 defaultServlet.noResources=静的リソースが見つかりません。 defaultServlet.skipfail=[{0}]バイトしか利用できなかったため、[{1}]バイトをスキップして要求された範囲の先頭に到達する必要があったため、読み取りに失敗しました。 +defaultServlet.xslError=XSL変換エラー directory.filename=ファイル名 directory.lastModified=最終更新 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[tomcat] 01/02: Align with 8.5.x. Add additional translations
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 7adb47ae0c29034e0d3a8ec38655fa6aaef6e711 Author: Mark Thomas AuthorDate: Mon Jul 1 09:03:54 2019 +0100 Align with 8.5.x. Add additional translations --- .../catalina/servlets/LocalStrings_es.properties | 9 + .../catalina/servlets/LocalStrings_fr.properties | 22 ++ .../catalina/servlets/LocalStrings_ja.properties | 20 ...gs_fr.properties => LocalStrings_ru.properties} | 15 ++- 4 files changed, 53 insertions(+), 13 deletions(-) diff --git a/java/org/apache/catalina/servlets/LocalStrings_es.properties b/java/org/apache/catalina/servlets/LocalStrings_es.properties index 02b3014..af9bceb 100644 --- a/java/org/apache/catalina/servlets/LocalStrings_es.properties +++ b/java/org/apache/catalina/servlets/LocalStrings_es.properties @@ -13,6 +13,15 @@ # See the License for the specific language governing permissions and # limitations under the License. +cgiServlet.expandFail=Fallo al expandir el script [{0}] en [{1}]\n +cgiServlet.expandOk=Expandiendo script en el path [{0}] hacia [{1}]\n +cgiServlet.find.location=Buscando archivo en [{0}]\n +cgiServlet.runHeaderReaderFail=Problemas de I/O cerrando la cabecera del lector +cgiServlet.runInvalidStatus=Estado inválido [{0}] +cgiServlet.runOutputStreamFail=Errores I/O cerrando el flujo de salida +cgiServlet.runReaderInterrupt=Detenido esperando por el hilo lector stderr +cgiServlet.runStdErrFail=Problemas de I/O con stderr + defaultServlet.missingResource=El recurso requerido {0} no se encuentra disponible defaultservlet.directorylistingfor=Listado de Directorio para: diff --git a/java/org/apache/catalina/servlets/LocalStrings_fr.properties b/java/org/apache/catalina/servlets/LocalStrings_fr.properties index 8845a4f..fba2435 100644 --- a/java/org/apache/catalina/servlets/LocalStrings_fr.properties +++ b/java/org/apache/catalina/servlets/LocalStrings_fr.properties @@ -13,6 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. +cgiServlet.emptyEnvVarName=la nom de variable d'environnement est vide dans le paramètre d'initialisation [environment-variable-] +cgiServlet.expandCloseFail=Impossible de fermer le flux d''entrée du script avec le chemin [{0}] +cgiServlet.expandCreateDirFail=Echec de la création du répertoire de destination [{0}] pour la décompression du script +cgiServlet.expandDeleteFail=Impossible d''effacer le fichier [{0}] suite à une IOException pendant la décompression +cgiServlet.expandFail=Impossible de faire l''expansion du script au chemin [{0}] vers [{1}] +cgiServlet.expandNotFound=Impossible de décompresser [{0}] car il n''a pas été trouvé +cgiServlet.expandOk=Extrait le script du chemin [{0}] vers [{1}] +cgiServlet.find.found=Trouvé le CGI: nom [{0}], chemin [{1}], nom de script [{2}] et nom du CGI [{3}] +cgiServlet.find.location=Recherche d''un fichier en [{0}] +cgiServlet.find.path=Script CGI demandé au chemin [{0}] relatif au CGI à [{1}] +cgiServlet.invalidArgumentDecoded=Les paramètres de ligne de commande décodés [{0}] ne correspondent pas au modèle cmdLineArgumentsDecoded configuré [{1}] +cgiServlet.invalidArgumentEncoded=Les paramètres de ligne de commande encodés [{0}] ne correspondent pas au modèle cmdLineArgumentsEncoded configuré [{1}] +cgiServlet.runBadHeader=Mauvaise ligne d''en-tête [{0}] +cgiServlet.runFail=Problèmes d'IO lors de l'exécution du CGI +cgiServlet.runHeaderReaderFail=Problème d'E/S lors de la fermeture du lecteur de headers +cgiServlet.runInvalidStatus=Statut invalide [{0}] +cgiServlet.runOutputStreamFail=Problème d'E/S à la fermeture du flux de sortie +cgiServlet.runReaderInterrupt=Interrompu pendant l'attente du thread de lecture de la sortie d'erreur (stderr reader thread) +cgiServlet.runStdErr=ligne stderr: [{0}] +cgiServlet.runStdErrCount=Reçues [{0}] lignes sur le stderr +cgiServlet.runStdErrFail=Problème d'entrée sortie pour le stderr + defaultservlet.directorylistingfor=Liste du répertoire pour : defaultservlet.files=Fichiers: defaultservlet.subdirectories=Sous-répertoires: diff --git a/java/org/apache/catalina/servlets/LocalStrings_ja.properties b/java/org/apache/catalina/servlets/LocalStrings_ja.properties index 45e7ae9..85ad7c0 100644 --- a/java/org/apache/catalina/servlets/LocalStrings_ja.properties +++ b/java/org/apache/catalina/servlets/LocalStrings_ja.properties @@ -13,6 +13,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +cgiServlet.emptyEnvVarName=初期化パラメータの空の環境変数名[環境変数] +cgiServlet.expandCloseFail=パス[{0}]のスクリプトの入力ストリームを閉じることができませんでした。 +cgiServlet.expandCreateDirFail=スクリプトの展開先ディレクトリ[{0}]の作成に失敗しました。 +cgiServlet.expandDeleteFail=拡張中にIOExceptionの後に[{0}]でファイルを削除できませんでした
[tomcat] 01/02: Align with 8.5.x.
This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git commit 45170f0138845e609869afb70564b1023ff21711 Author: Mark Thomas AuthorDate: Sun Jun 30 23:41:22 2019 +0100 Align with 8.5.x. --- .../apache/tomcat/websocket/server/Constants.java | 7 -- .../server/DefaultServerEndpointConfigurator.java | 6 +++-- .../websocket/server/LocalStrings.properties | 3 +-- .../tomcat/websocket/server/UpgradeUtil.java | 12 +++--- .../tomcat/websocket/server/UriTemplate.java | 3 +-- .../apache/tomcat/websocket/server/WsFilter.java | 2 -- .../tomcat/websocket/server/WsFrameServer.java | 5 - .../websocket/server/WsHandshakeRequest.java | 4 +--- .../server/WsRemoteEndpointImplServer.java | 4 ++-- java/org/apache/tomcat/websocket/server/WsSci.java | 6 ++--- .../tomcat/websocket/server/WsServerContainer.java | 26 +++--- .../tomcat/websocket/server/WsWriteTimeout.java| 5 + 12 files changed, 38 insertions(+), 45 deletions(-) diff --git a/java/org/apache/tomcat/websocket/server/Constants.java b/java/org/apache/tomcat/websocket/server/Constants.java index 8a86d70..4afb1a7 100644 --- a/java/org/apache/tomcat/websocket/server/Constants.java +++ b/java/org/apache/tomcat/websocket/server/Constants.java @@ -21,8 +21,11 @@ package org.apache.tomcat.websocket.server; */ public class Constants { -protected static final String PACKAGE_NAME = -Constants.class.getPackage().getName(); +/** + * @deprecated. Will be removed in 8.5.x onwards. + */ +@Deprecated +protected static final String PACKAGE_NAME = Constants.class.getPackage().getName(); public static final String BINARY_BUFFER_SIZE_SERVLET_CONTEXT_INIT_PARAM = "org.apache.tomcat.websocket.binaryBufferSize"; diff --git a/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java b/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java index 64ac8ca..c6cbbd6 100644 --- a/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java +++ b/java/org/apache/tomcat/websocket/server/DefaultServerEndpointConfigurator.java @@ -33,8 +33,10 @@ public class DefaultServerEndpointConfigurator public T getEndpointInstance(Class clazz) throws InstantiationException { try { -return clazz.newInstance(); -} catch (IllegalAccessException e) { +return clazz.getConstructor().newInstance(); +} catch (InstantiationException e) { +throw e; +} catch (ReflectiveOperationException e) { InstantiationException ie = new InstantiationException(); ie.initCause(e); throw ie; diff --git a/java/org/apache/tomcat/websocket/server/LocalStrings.properties b/java/org/apache/tomcat/websocket/server/LocalStrings.properties index c987458..85cedd6 100644 --- a/java/org/apache/tomcat/websocket/server/LocalStrings.properties +++ b/java/org/apache/tomcat/websocket/server/LocalStrings.properties @@ -17,9 +17,8 @@ sci.noWebSocketSupport=JSR 356 WebSocket (Java WebSocket 1.1) support is not ava serverContainer.addNotAllowed=No further Endpoints may be registered once an attempt has been made to use one of the previously registered endpoints serverContainer.configuratorFail=Failed to create configurator of type [{0}] for POJO of type [{1}] -serverContainer.duplicatePaths=Multiple Endpoints may not be deployed to the same path [{0}] : existing endpoint was {1} and new endpoint is {2} +serverContainer.duplicatePaths=Multiple Endpoints may not be deployed to the same path [{0}] : existing endpoint was [{1}] and new endpoint is [{2}] serverContainer.encoderFail=Unable to create encoder of type [{0}] -serverContainer.endpointDeploy=Endpoint class [{0}] deploying to path [{1}] in ServletContext [{2}] serverContainer.failedDeployment=Deployment of WebSocket Endpoints to the web application with path [{0}] is not permitted due to the failure of a previous deployment serverContainer.missingAnnotation=Cannot deploy POJO class [{0}] as it is not annotated with @ServerEndpoint serverContainer.missingEndpoint=An Endpoint instance has been request for path [{0}] but no matching Endpoint class was found diff --git a/java/org/apache/tomcat/websocket/server/UpgradeUtil.java b/java/org/apache/tomcat/websocket/server/UpgradeUtil.java index 7a752ff..36dfbc5 100644 --- a/java/org/apache/tomcat/websocket/server/UpgradeUtil.java +++ b/java/org/apache/tomcat/websocket/server/UpgradeUtil.java @@ -50,8 +50,8 @@ import org.apache.tomcat.websocket.pojo.PojoEndpointServer; public class UpgradeUtil { -private static final StringManager sm = StringManager - .getManager(org.apache.tomcat.websocket.server.Constants.PACKAGE_NAME); +private static final