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/06/19 17:43:37 UTC
[tomcat] branch 8.5.x updated: Code clean-up. No functional change.
This is an automated email from the ASF dual-hosted git repository.
markt 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 85c4f5f5e3 Code clean-up. No functional change.
85c4f5f5e3 is described below
commit 85c4f5f5e3d1fb14eb2f3ba6740ec38f2e6aa88d
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Mon Jun 19 18:43:30 2023 +0100
Code clean-up. No functional change.
Align with 9.0.x/10.1.x/11.0.x
---
.../catalina/core/ApplicationContextFacade.java | 1 -
.../catalina/core/ApplicationHttpRequest.java | 21 +--------
java/org/apache/catalina/core/ContainerBase.java | 14 +++---
.../core/JreMemoryLeakPreventionListener.java | 2 +
.../apache/catalina/core/LocalStrings.properties | 9 ++++
.../catalina/core/LocalStrings_fr.properties | 9 ++++
.../catalina/core/LocalStrings_ja.properties | 9 ++++
.../catalina/core/LocalStrings_ko.properties | 9 ++++
java/org/apache/catalina/core/StandardContext.java | 50 +++++++---------------
java/org/apache/catalina/core/StandardEngine.java | 6 +--
java/org/apache/catalina/core/StandardServer.java | 13 +++---
java/org/apache/catalina/core/StandardWrapper.java | 1 -
12 files changed, 67 insertions(+), 77 deletions(-)
diff --git a/java/org/apache/catalina/core/ApplicationContextFacade.java b/java/org/apache/catalina/core/ApplicationContextFacade.java
index cde889a013..aa28ddac97 100644
--- a/java/org/apache/catalina/core/ApplicationContextFacade.java
+++ b/java/org/apache/catalina/core/ApplicationContextFacade.java
@@ -71,7 +71,6 @@ public class ApplicationContextFacade implements ServletContext {
// ----------------------------------------------------------- Constructors
-
/**
* Construct a new instance of this class, associated with the specified Context instance.
*
diff --git a/java/org/apache/catalina/core/ApplicationHttpRequest.java b/java/org/apache/catalina/core/ApplicationHttpRequest.java
index 20c0bd74b9..c7f61d816b 100644
--- a/java/org/apache/catalina/core/ApplicationHttpRequest.java
+++ b/java/org/apache/catalina/core/ApplicationHttpRequest.java
@@ -43,6 +43,7 @@ import org.apache.catalina.Manager;
import org.apache.catalina.Session;
import org.apache.catalina.connector.RequestFacade;
import org.apache.catalina.util.ParameterMap;
+import org.apache.catalina.util.RequestUtil;
import org.apache.catalina.util.URLEncoder;
import org.apache.tomcat.util.buf.B2CConverter;
import org.apache.tomcat.util.buf.MessageBytes;
@@ -469,25 +470,7 @@ class ApplicationHttpRequest extends HttpServletRequestWrapper {
*/
@Override
public StringBuffer getRequestURL() {
-
- StringBuffer url = new StringBuffer();
- String scheme = getScheme();
- int port = getServerPort();
- if (port < 0) {
- port = 80; // Work around java.net.URL bug
- }
-
- url.append(scheme);
- url.append("://");
- url.append(getServerName());
- if ((scheme.equals("http") && (port != 80)) || (scheme.equals("https") && (port != 443))) {
- url.append(':');
- url.append(port);
- }
- url.append(getRequestURI());
-
- return (url);
-
+ return RequestUtil.getRequestURL(this);
}
diff --git a/java/org/apache/catalina/core/ContainerBase.java b/java/org/apache/catalina/core/ContainerBase.java
index da690e37cd..610baf054c 100644
--- a/java/org/apache/catalina/core/ContainerBase.java
+++ b/java/org/apache/catalina/core/ContainerBase.java
@@ -148,7 +148,6 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
// ----------------------------------------------------- Instance Variables
-
/**
* The child Containers belonging to this Container, keyed by name.
*/
@@ -430,7 +429,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
this.cluster = cluster;
// Stop the old component if necessary
- if (getState().isAvailable() && (oldCluster != null) && (oldCluster instanceof Lifecycle)) {
+ if (getState().isAvailable() && (oldCluster instanceof Lifecycle)) {
try {
((Lifecycle) oldCluster).stop();
} catch (LifecycleException e) {
@@ -443,7 +442,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
cluster.setContainer(this);
}
- if (getState().isAvailable() && (cluster != null) && (cluster instanceof Lifecycle)) {
+ if (getState().isAvailable() && (cluster instanceof Lifecycle)) {
try {
((Lifecycle) cluster).start();
} catch (LifecycleException e) {
@@ -633,7 +632,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
this.realm = realm;
// Stop the old component if necessary
- if (getState().isAvailable() && (oldRealm != null) && (oldRealm instanceof Lifecycle)) {
+ if (getState().isAvailable() && (oldRealm instanceof Lifecycle)) {
try {
((Lifecycle) oldRealm).stop();
} catch (LifecycleException e) {
@@ -645,7 +644,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
if (realm != null) {
realm.setContainer(this);
}
- if (getState().isAvailable() && (realm != null) && (realm instanceof Lifecycle)) {
+ if (getState().isAvailable() && (realm instanceof Lifecycle)) {
try {
((Lifecycle) realm).start();
} catch (LifecycleException e) {
@@ -1032,7 +1031,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
}
AccessLogAdapter adapter = null;
- Valve valves[] = getPipeline().getValves();
+ Valve[] valves = getPipeline().getValves();
for (Valve valve : valves) {
if (valve instanceof AccessLog) {
if (adapter == null) {
@@ -1278,8 +1277,7 @@ public abstract class ContainerBase extends LifecycleMBeanBase implements Contai
return sb.toString();
}
-
- // -------------------------------------- ContainerExecuteDelay Inner Class
+ // ------------------------------- ContainerBackgroundProcessor Inner Class
/**
* Private runnable class to invoke the backgroundProcess method of this container and its children after a fixed
diff --git a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
index 02a4b73f26..d4f56ee3c2 100644
--- a/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
+++ b/java/org/apache/catalina/core/JreMemoryLeakPreventionListener.java
@@ -402,6 +402,8 @@ public class JreMemoryLeakPreventionListener implements LifecycleListener {
* Those libraries/components known to trigger this issue include: - log4j versions 1.2.15 and earlier -
* javax.xml.bind.JAXBContext.newInstance()
*
+ * https://bugs.openjdk.java.net/browse/JDK-8163449
+ *
* Java 9 onwards disables caching for JAR URLConnections Java 8 and earlier disables caching for all
* URLConnections
*/
diff --git a/java/org/apache/catalina/core/LocalStrings.properties b/java/org/apache/catalina/core/LocalStrings.properties
index e881233f6e..98accac8e3 100644
--- a/java/org/apache/catalina/core/LocalStrings.properties
+++ b/java/org/apache/catalina/core/LocalStrings.properties
@@ -179,9 +179,13 @@ standardContext.backgroundProcess.instanceManager=Exception processing instance
standardContext.backgroundProcess.loader=Exception processing loader [{0}] background process
standardContext.backgroundProcess.manager=Exception processing manager [{0}] background process
standardContext.backgroundProcess.resources=Exception processing resources [{0}] background process
+standardContext.cluster.managerError=Error creating new cluster session manager
standardContext.cluster.noManager=No manager found. Checking if cluster manager should be used. Cluster configured: [{0}], Application distributable: [{1}]
standardContext.configurationFail=One or more components marked the context as not correctly configured
standardContext.cookieProcessor.null=It is not permitted to set the CookieProcessor for a Context to null
+standardContext.createWrapper.containerListenerError=Error creating container listener for the wrapper
+standardContext.createWrapper.error=Error creating new wrapper
+standardContext.createWrapper.listenerError=Error creating lifecycle listener for the wrapper
standardContext.duplicateListener=The listener [{0}] is already configured for this context. The duplicate definition has been ignored.
standardContext.errorPage.error=Error page location [{0}] must start with a ''/''
standardContext.errorPage.required=ErrorPage cannot be null
@@ -229,10 +233,15 @@ standardContext.securityConstraint.pattern=Invalid <url-pattern> [{0}] in securi
standardContext.servletFail=One or more Servlets failed to load on startup. Full details will be found in the appropriate container log file
standardContext.servletMap.name=Servlet mapping specifies an unknown servlet name [{0}]
standardContext.servletMap.pattern=Invalid <url-pattern> [{0}] in servlet mapping
+standardContext.setLoader.start=Error starting new loader
+standardContext.setLoader.stop=Error stopping old loader
+standardContext.setManager.start=Error starting new manager
+standardContext.setManager.stop=Error stopping old manager
standardContext.startFailed=Context [{0}] startup failed due to previous errors
standardContext.startingContext=Exception starting Context with name [{0}]
standardContext.stop.asyncWaitInterrupted=Interrupt received while waiting unloadDelay milliseconds for in-flight asynchronous requests to complete. Context stop will continue without further delay.
standardContext.stoppingContext=Exception stopping Context with name [{0}]
+standardContext.suspiciousUrl=Suspicious URL pattern: [{0}] in context [{1}], see sections 12.1 and 12.2 of the Servlet specification
standardContext.threadBindingListenerError=An error occurred in the thread binding listener configured for Context [{0}]
standardContext.urlPattern.patternWarning=WARNING: URL pattern [{0}] must start with a ''/'' in Servlet 2.4
standardContext.workCreateException=Failed to determine absolute work directory from directory [{0}] and CATALINA_HOME [{1}] for context [{2}]
diff --git a/java/org/apache/catalina/core/LocalStrings_fr.properties b/java/org/apache/catalina/core/LocalStrings_fr.properties
index 2ca959298c..9383eaab32 100644
--- a/java/org/apache/catalina/core/LocalStrings_fr.properties
+++ b/java/org/apache/catalina/core/LocalStrings_fr.properties
@@ -175,9 +175,13 @@ standardContext.backgroundProcess.instanceManager=Exception lors du traitement d
standardContext.backgroundProcess.loader=Exception lors du traitement d''arrière plan du loader [{0}]
standardContext.backgroundProcess.manager=Exception lors du traitement d''arrière plan du gestionnaire de sessions [{0}]
standardContext.backgroundProcess.resources=Exception lors du traitement d''arrière plan des ressources [{0}]
+standardContext.cluster.managerError=Erreur lors de la création d'un nouveau gestionnaire de session du cluster
standardContext.cluster.noManager=Aucun gestionnaire de session trouvé, vérification de l''utilisation éventuelle du gestionnaire de session fourni par le cluster ; cluster configuré : [{0}], application distribuable : [{1}]
standardContext.configurationFail=Un ou plusieurs composants ont marqué ce contexte comme n'étant pas correctement configuré
standardContext.cookieProcessor.null=Il est interdit de mettre un CookieProcessor null pour un contexte
+standardContext.createWrapper.containerListenerError=Erreur lors de la création de l'écouteur de container de l'enrobeur
+standardContext.createWrapper.error=Erreur de la création d'un nouvel enrobeur
+standardContext.createWrapper.listenerError=Erreur lors de la création d'un écouteur de cycle de vie de l'enrobeur
standardContext.duplicateListener=L''écouteur [{0}] est déjà configuré pour le contexte, la double déclaration a été ignorée
standardContext.errorPage.error=La position de la page d''erreur (ErrorPage) [{0}] doit commencer par un ''/''
standardContext.errorPage.required=La page d'erreur (ErrorPage) ne peut être nulle
@@ -225,10 +229,15 @@ standardContext.securityConstraint.pattern=<url-pattern> [{0}] invalide d''aprè
standardContext.servletFail=Un ou plusieurs Servlets n'ont pas pu démarrer, les détails sont dans le fichier log du conteneur
standardContext.servletMap.name=L''association de servlet (servlet mapping) indique un nom de servlet inconnu [{0}]
standardContext.servletMap.pattern=<url-pattern> [{0}] invalide dans l''association de servlet (servlet mapping)
+standardContext.setLoader.start=Erreur lors du démarrage du nouveau chargeur
+standardContext.setLoader.stop=Erreur lors de l'arrêt de l'ancien chargeur
+standardContext.setManager.start=Erreur lors du démarrage du nouveau gestionnaire de sessions
+standardContext.setManager.stop=Erreur lors de l'arrêt de l'ancien gestionnaire de sessions
standardContext.startFailed=Erreur de démarrage du contexte [{0}] suite aux erreurs précédentes
standardContext.startingContext=Exception lors du démarrage du contexte [{0}]
standardContext.stop.asyncWaitInterrupted=Une interruption a été reçue en attendant unloadDelay millisecondes pour permettre aux requêtes asynchrones en cours de se terminer, l'arrêt du contexte va se poursuivre sans délai supplémentaire
standardContext.stoppingContext=Exception à l''arrêt du Context [{0}]
+standardContext.suspiciousUrl=Modèle d''URL suspect : [{0}] dans le contexte [{1}], voir les sections 12.1 et 12.2 de la spécification Servlets
standardContext.threadBindingListenerError=Une erreur s''est produite dans l''écouteur de l’''association de thread configuré pour le contexte [{0}]
standardContext.urlPattern.patternWarning=WARNING : Le modèle (pattern) d''URL [{0}] doit commencer par un ''/'' dans l''API Servlet 2.4
standardContext.workCreateException=Impossible de déterminer le chemin absolu pour le répertoire de travail à partir du répertoire [{0}] et de CATALINA_HOME [{1}] pour le contexte [{2}]
diff --git a/java/org/apache/catalina/core/LocalStrings_ja.properties b/java/org/apache/catalina/core/LocalStrings_ja.properties
index ace03b32e2..dea726ccc6 100644
--- a/java/org/apache/catalina/core/LocalStrings_ja.properties
+++ b/java/org/apache/catalina/core/LocalStrings_ja.properties
@@ -175,9 +175,13 @@ standardContext.backgroundProcess.instanceManager=インスタンスマネージ
standardContext.backgroundProcess.loader=Loader[{0}]のバックグラウンドプロセス処理中に例外が発生
standardContext.backgroundProcess.manager=マネージャ [{0}] のバックグラウンドプロセス処理中の例外
standardContext.backgroundProcess.resources=リソース [{0}] バックグラウンドプロセス処理中の例外
+standardContext.cluster.managerError=新規クラスターセッションマネージャ生成中のエラー
standardContext.cluster.noManager=Managerが見つかりませんでした。 ClusterManagerを使用するかどうかの確認。 クラスタ構成:[{0}]、アプリケーション配布可能:[{1}]
standardContext.configurationFail=コンテキストが正しく設定されていないとマークされた1つ以上のコンポーネント
standardContext.cookieProcessor.null=コンテキストの CookieProcessor には null を指定できません。
+standardContext.createWrapper.containerListenerError=Wrapperのコンテナリスナー生成中のエラー
+standardContext.createWrapper.error=新規Wrapper作成中のエラー
+standardContext.createWrapper.listenerError=Wrapperのライフサイクルリスナー生成中のエラー
standardContext.duplicateListener=リスナー[{0}]は、すでにこのコンテキストに構成されています。重複定義は無視されました。
standardContext.errorPage.error=エラーページの位置 [{0}] は''/''で始まらなければいけません
standardContext.errorPage.required=ErrorPage は null にできません
@@ -225,10 +229,15 @@ standardContext.securityConstraint.pattern=セキュリティの制約の中に
standardContext.servletFail=起動時に一つ以上のサーブレットの読み込みが失敗しました。詳細は適切なコンテナーのログファイルを確認してください。
standardContext.servletMap.name=サーブレットマッピングは未知のサーブレット名 [{0}] を指定しています
standardContext.servletMap.pattern=サーブレットマッピング中に無効な <url-pattern> [{0}] があります
+standardContext.setLoader.start=新しいクラスローダーを開始できません。
+standardContext.setLoader.stop=古いクラスローダーの停止中のエラー
+standardContext.setManager.start=新規マネージャー開始中のエラー
+standardContext.setManager.stop=古いマネージャーを停止できません。
standardContext.startFailed=以前のエラーのためにコンテキストの起動が失敗しました [{0}]
standardContext.startingContext=名前[{0}]のコンテキストを開始する際の例外
standardContext.stop.asyncWaitInterrupted=実行中の非同期要求が完了するのをunloadDelayミリ秒待っている間に割り込みを受信しました。 コンテキスト停止はさらに遅れることなく続行されます。
standardContext.stoppingContext=ローダを停止中の例外です
+standardContext.suspiciousUrl=コンテキスト [{1}] に不審な URL パターン [{0}] があります。サーブレット仕様の 12.1 および 12.2 を参照してください。
standardContext.threadBindingListenerError=コンテキスト [{0}] に構成されたリスナーを束縛するスレッドで異常が発生しました。
standardContext.urlPattern.patternWarning=警告: Servlet 2.4ではURLパターン [{0}] は''/''で始まらなければいけません
standardContext.workCreateException=コンテキスト [{2}] のディレクトリ [{0}] とCATALINA_HOME [{1}] からの絶対workディレクトリを特定できませんでした
diff --git a/java/org/apache/catalina/core/LocalStrings_ko.properties b/java/org/apache/catalina/core/LocalStrings_ko.properties
index 829ef374ba..7b79a004ce 100644
--- a/java/org/apache/catalina/core/LocalStrings_ko.properties
+++ b/java/org/apache/catalina/core/LocalStrings_ko.properties
@@ -175,9 +175,13 @@ standardContext.backgroundProcess.instanceManager=인스턴스 매니저 [{0}]
standardContext.backgroundProcess.loader=로더 [{0}]을(를) 백그라운드 프로세스로 처리 중 예외 발생
standardContext.backgroundProcess.manager=매니저 [{0}]을(를) 백그라운드 프로세스로 처리하는 중 예외 발생
standardContext.backgroundProcess.resources=리소스 [{0}]을(를) 백그라운드 프로세스로 처리하는 중 예외 발생
+standardContext.cluster.managerError=새로운 클러스터 세션 매니저를 생성하는 중 오류 발생
standardContext.cluster.noManager=매니저가 발견되지 않습니다. 클러스터 매니저가 사용되어야 하는지 점검합니다. 설정된 클러스터: [{0}], 배포할 수 있는 애플리케이션: [{1}]
standardContext.configurationFail=하나 이상의 구성요소(들)이, 해당 컨텍스트가 올바로 설정되지 않았다고 표시했습니다.
standardContext.cookieProcessor.null=컨텍스트를 위한 CookieProcessor를 널로 설정하는 것은 허용되지 않습니다.
+standardContext.createWrapper.containerListenerError=Wrapper를 위한 컨테이너 리스너를 생성하는 중 오류 발생
+standardContext.createWrapper.error=새로운 wrapper를 생성하는 중 오류 발생
+standardContext.createWrapper.listenerError=Wrapper를 위해 Lifecycle 리스너를 생성하는 중 오류 발생
standardContext.duplicateListener=리스너 [{0}]이(가) 이미 이 컨텍스트를 위해 설정되어 있습니다. 중복된 정의는 무시되었습니다.
standardContext.errorPage.error=오류 페이지 위치 [{0}]은(는) 반드시 ''/''로 시작해야 합니다.
standardContext.errorPage.required=ErrorPage는 널이어서는 안됩니다.
@@ -224,10 +228,15 @@ standardContext.securityConstraint.pattern=Security constraint 엘리먼트에
standardContext.servletFail=하나 이상의 서블릿들이 시작 시에 제대로 로드되지 않았습니다. 상세 정보는 적절한 컨테이너 로그 파일에서 찾을 수 있습니다.
standardContext.servletMap.name=서블릿 매핑이 알 수 없는 서블릿 이름 [{0}]을(를) 지정하고 있습니다.
standardContext.servletMap.pattern=서블릿 매핑에서 유효하지 않은 <url-pattern> [{0}]
+standardContext.setLoader.start=새로운 로더를 시작하는 중 오류 발생
+standardContext.setLoader.stop=이전 로더를 중지시키는 중 오류 발생
+standardContext.setManager.start=새로운 매니저를 시작하는 중 오류 발생
+standardContext.setManager.stop=이전 매니저를 중지시키는 중 오류 발생
standardContext.startFailed=이전 오류들로 인해 컨텍스트 [{0}]의 시작이 실패했습니다.
standardContext.startingContext=이름이 [{0}]인 컨텍스트를 시작하는 중 예외 발생
standardContext.stop.asyncWaitInterrupted=처리 중인 비동기 요청이 완료되기를 기다리기 위해 unloadDelay 밀리초를 대기하는 동안 인터럽트를 받았습니다. 더 이상의 지체 없이 컨텍스트 중지 작업을 계속할 것입니다.
standardContext.stoppingContext=이름이 [{0}]인 컨텍스트를 중지시키는 중 예외 발생
+standardContext.suspiciousUrl=의심스러운 URL 패턴: 컨텍스트 [{1}] 내의 [{0}]. 서블릿 스펙의 12.1장과 12.2장을 참조하십시오.
standardContext.threadBindingListenerError=컨텍스트 [{0}]을(를) 위해 설정된 쓰레드 바인딩 리스너에서 오류가 발생했습니다.
standardContext.urlPattern.patternWarning=경고: Servlet 2.4에서 URL 패턴 [{0}]은(는) 반드시 ''/''로 시작해야 합니다.
standardContext.workCreateException=디렉토리 [{0}]와(과) CATALINA_HOME [{1}](으)로부터, 컨텍스트 [{2}]을(를) 위한 작업 디렉토리의 절대 경로를 결정하지 못했습니다.
diff --git a/java/org/apache/catalina/core/StandardContext.java b/java/org/apache/catalina/core/StandardContext.java
index 6228132444..428aaa702c 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -358,7 +358,6 @@ public class StandardContext extends ContainerBase implements Context, Notificat
private final ErrorPageSupport errorPageSupport = new ErrorPageSupport();
-
/**
* The set of filter configurations (and associated filter instances) we have initialized, keyed by filter name.
*/
@@ -1760,7 +1759,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
try {
((Lifecycle) oldLoader).stop();
} catch (LifecycleException e) {
- log.error("StandardContext.setLoader: stop: ", e);
+ log.error(sm.getString("standardContext.setLoader.stop"), e);
}
}
@@ -1772,7 +1771,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
try {
((Lifecycle) loader).start();
} catch (LifecycleException e) {
- log.error("StandardContext.setLoader: start: ", e);
+ log.error(sm.getString("standardContext.setLoader.start"), e);
}
}
} finally {
@@ -1816,7 +1815,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
((Lifecycle) oldManager).stop();
((Lifecycle) oldManager).destroy();
} catch (LifecycleException e) {
- log.error("StandardContext.setManager: stop-destroy: ", e);
+ log.error(sm.getString("standardContext.setManager.stop"), e);
}
}
@@ -1828,7 +1827,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
try {
((Lifecycle) manager).start();
} catch (LifecycleException e) {
- log.error("StandardContext.setManager: start: ", e);
+ log.error(sm.getString("standardContext.setManager.start"), e);
}
}
} finally {
@@ -2750,10 +2749,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
// Add this constraint to the set for our web application
synchronized (constraintsLock) {
- SecurityConstraint results[] = new SecurityConstraint[constraints.length + 1];
- for (int i = 0; i < constraints.length; i++) {
- results[i] = constraints[i];
- }
+ SecurityConstraint[] results = Arrays.copyOf(constraints, constraints.length + 1);
results[constraints.length] = constraint;
constraints = results;
}
@@ -2976,10 +2972,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
public void addSecurityRole(String role) {
synchronized (securityRolesLock) {
- String results[] = new String[securityRoles.length + 1];
- for (int i = 0; i < securityRoles.length; i++) {
- results[i] = securityRoles[i];
- }
+ String[] results = Arrays.copyOf(securityRoles, securityRoles.length + 1);
results[securityRoles.length] = role;
securityRoles = results;
}
@@ -3045,10 +3038,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
public void addWatchedResource(String name) {
synchronized (watchedResourcesLock) {
- String results[] = new String[watchedResources.length + 1];
- for (int i = 0; i < watchedResources.length; i++) {
- results[i] = watchedResources[i];
- }
+ String[] results = Arrays.copyOf(watchedResources, watchedResources.length + 1);
results[watchedResources.length] = name;
watchedResources = results;
}
@@ -3072,10 +3062,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
welcomeFiles = new String[0];
setReplaceWelcomeFiles(false);
}
- String results[] = new String[welcomeFiles.length + 1];
- for (int i = 0; i < welcomeFiles.length; i++) {
- results[i] = welcomeFiles[i];
- }
+ String[] results = Arrays.copyOf(welcomeFiles, welcomeFiles.length + 1);
results[welcomeFiles.length] = name;
welcomeFiles = results;
}
@@ -3094,10 +3081,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
public void addWrapperLifecycle(String listener) {
synchronized (wrapperLifecyclesLock) {
- String results[] = new String[wrapperLifecycles.length + 1];
- for (int i = 0; i < wrapperLifecycles.length; i++) {
- results[i] = wrapperLifecycles[i];
- }
+ String[] results = Arrays.copyOf(wrapperLifecycles, wrapperLifecycles.length + 1);
results[wrapperLifecycles.length] = listener;
wrapperLifecycles = results;
}
@@ -3115,10 +3099,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
public void addWrapperListener(String listener) {
synchronized (wrapperListenersLock) {
- String results[] = new String[wrapperListeners.length + 1];
- for (int i = 0; i < wrapperListeners.length; i++) {
- results[i] = wrapperListeners[i];
- }
+ String[] results = Arrays.copyOf(wrapperListeners, wrapperListeners.length + 1);
results[wrapperListeners.length] = listener;
wrapperListeners = results;
}
@@ -3141,7 +3122,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
wrapper = (Wrapper) wrapperClass.getConstructor().newInstance();
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error("createWrapper", t);
+ log.error(sm.getString("standardContext.createWrapper.error"), t);
return null;
}
} else {
@@ -3156,7 +3137,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
wrapper.addLifecycleListener(listener);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error("createWrapper", t);
+ log.error(sm.getString("standardContext.createWrapper.listenerError"), t);
return null;
}
}
@@ -3170,7 +3151,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
wrapper.addContainerListener(listener);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log.error("createWrapper", t);
+ log.error(sm.getString("standardContext.createWrapper.containerListenerError"), t);
return null;
}
}
@@ -4879,7 +4860,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
try {
contextManager = getCluster().createManager(getName());
} catch (Exception ex) {
- log.error("standardContext.clusterFail", ex);
+ log.error(sm.getString("standardContext.cluster.managerError"), ex);
ok = false;
}
} else {
@@ -5911,8 +5892,7 @@ public class StandardContext extends ContainerBase implements Context, Notificat
if ((urlPattern.endsWith("*") &&
(urlPattern.length() < 2 || urlPattern.charAt(urlPattern.length() - 2) != '/')) ||
urlPattern.startsWith("*.") && urlPattern.length() > 2 && urlPattern.lastIndexOf('.') > 1) {
- log.info("Suspicious url pattern: \"" + urlPattern + "\"" + " in context [" + getName() + "] - see" +
- " sections 12.1 and 12.2 of the Servlet specification");
+ log.info(sm.getString("standardContext.suspiciousUrl", urlPattern, getName()));
}
}
}
diff --git a/java/org/apache/catalina/core/StandardEngine.java b/java/org/apache/catalina/core/StandardEngine.java
index a88ae6f541..719d1db4ea 100644
--- a/java/org/apache/catalina/core/StandardEngine.java
+++ b/java/org/apache/catalina/core/StandardEngine.java
@@ -54,15 +54,13 @@ public class StandardEngine extends ContainerBase implements Engine {
private static final Log log = LogFactory.getLog(StandardEngine.class);
- // ----------------------------------------------------------- Constructors
+ // ----------------------------------------------------------- Constructors
/**
* Create a new StandardEngine component with the default basic Valve.
*/
public StandardEngine() {
-
- super();
pipeline.setBasic(new StandardEngineValve());
/* Set the jvmRoute using the system property jvmRoute */
try {
@@ -72,13 +70,11 @@ public class StandardEngine extends ContainerBase implements Engine {
}
// By default, the engine will hold the reloading thread
backgroundProcessorDelay = 10;
-
}
// ----------------------------------------------------- Instance Variables
-
/**
* Host name to use when no server host, or an unknown host, is specified in the request.
*/
diff --git a/java/org/apache/catalina/core/StandardServer.java b/java/org/apache/catalina/core/StandardServer.java
index e5708390bb..bd9c69d6b5 100644
--- a/java/org/apache/catalina/core/StandardServer.java
+++ b/java/org/apache/catalina/core/StandardServer.java
@@ -131,7 +131,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
/**
* The set of Services associated with this Server.
*/
- private Service services[] = new Service[0];
+ private Service[] services = new Service[0];
private final Object servicesLock = new Object();
@@ -568,7 +568,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
/**
- * @return the set of Services defined within this Server.
+ * @return The array of Services defined within this Server.
*/
@Override
public Service[] findServices() {
@@ -579,7 +579,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
* @return the JMX service names.
*/
public ObjectName[] getServiceNames() {
- ObjectName onames[] = new ObjectName[services.length];
+ ObjectName[] onames = new ObjectName[services.length];
for (int i = 0; i < services.length; i++) {
onames[i] = ((StandardService) services[i]).getObjectName();
}
@@ -612,7 +612,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
// Ignore
}
int k = 0;
- Service results[] = new Service[services.length - 1];
+ Service[] results = new Service[services.length - 1];
for (int i = 0; i < services.length; i++) {
if (i != j) {
results[k++] = services[i];
@@ -687,10 +687,7 @@ public final class StandardServer extends LifecycleMBeanBase implements Server {
*/
@Override
public String toString() {
- StringBuilder sb = new StringBuilder("StandardServer[");
- sb.append(getPort());
- sb.append(']');
- return sb.toString();
+ return "StandardServer[" + getPort() + ']';
}
diff --git a/java/org/apache/catalina/core/StandardWrapper.java b/java/org/apache/catalina/core/StandardWrapper.java
index 62fe8ad2f3..cb3dbcd596 100644
--- a/java/org/apache/catalina/core/StandardWrapper.java
+++ b/java/org/apache/catalina/core/StandardWrapper.java
@@ -1343,7 +1343,6 @@ public class StandardWrapper extends ContainerBase implements ServletConfig, Wra
unloading = false;
fireContainerEvent("unload", this);
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org