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

commit 05d62f67eb9bf9d65ff9846cd777538bb4908cd6
Author: Mark Thomas <[email protected]>
AuthorDate: Mon Mar 29 17:18:58 2021 +0100

    No functional change. Align 10.0.x, 9.0.x and 8.5.x
---
 java/org/apache/jasper/compiler/Validator.java     |  8 ++++---
 .../jasper/resources/LocalStrings.properties       |  4 ++++
 .../jasper/resources/LocalStrings_de.properties    |  3 +++
 .../jasper/resources/LocalStrings_fr.properties    |  4 ++++
 .../jasper/resources/LocalStrings_ja.properties    |  4 ++++
 .../jasper/resources/LocalStrings_ko.properties    |  4 ++++
 .../jasper/resources/LocalStrings_zh_CN.properties |  4 ++++
 .../org/apache/jasper/runtime/BodyContentImpl.java |  5 +++-
 .../jasper/runtime/InstanceManagerFactory.java     |  3 ++-
 .../jasper/runtime/JspApplicationContextImpl.java  | 12 +++++-----
 java/org/apache/jasper/runtime/JspWriterImpl.java  | 28 +++++-----------------
 .../apache/jasper/security/SecurityClassLoad.java  | 27 +++++++++------------
 12 files changed, 57 insertions(+), 49 deletions(-)

diff --git a/java/org/apache/jasper/compiler/Validator.java 
b/java/org/apache/jasper/compiler/Validator.java
index a903bd1..7805cd6 100644
--- a/java/org/apache/jasper/compiler/Validator.java
+++ b/java/org/apache/jasper/compiler/Validator.java
@@ -22,7 +22,9 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Locale;
+import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -1662,7 +1664,7 @@ class Validator {
                 throws JasperException {
             FunctionInfo funcInfo = func.getFunctionInfo();
             String signature = funcInfo.getFunctionSignature();
-            ArrayList<String> params = new ArrayList<>();
+            List<String> params = new ArrayList<>();
             // Signature is of the form
             // <return-type> S <method-name S? '('
             // < <arg-type> ( ',' <arg-type> )* )? ')'
@@ -1695,7 +1697,7 @@ class Validator {
 
             class ValidateFunctionMapper extends FunctionMapper {
 
-                private HashMap<String, Method> fnmap = new HashMap<>();
+                private Map<String, Method> fnmap = new HashMap<>();
 
                 @Override
                 public void mapFunction(String prefix, String localName,
@@ -1821,7 +1823,7 @@ class Validator {
         PageInfo pageInfo = compiler.getPageInfo();
         String contentType = pageInfo.getContentType();
 
-        if (contentType == null || contentType.indexOf("charset=") < 0) {
+        if (contentType == null || !contentType.contains("charset=")) {
             boolean isXml = page.getRoot().isXmlSyntax();
             String defaultType;
             if (contentType == null) {
diff --git a/java/org/apache/jasper/resources/LocalStrings.properties 
b/java/org/apache/jasper/resources/LocalStrings.properties
index 60fc4ad..96a8c8c 100644
--- a/java/org/apache/jasper/resources/LocalStrings.properties
+++ b/java/org/apache/jasper/resources/LocalStrings.properties
@@ -44,6 +44,7 @@ jsp.error.beans.property.conversion=Unable to convert string 
[{0}] to class [{1}
 jsp.error.beans.propertyeditor.notregistered=Property Editor not registered 
with the PropertyEditorManager
 jsp.error.beans.setproperty.noindexset=Cannot set indexed property
 jsp.error.bug48498=Unable to display JSP extract. Probably due to an XML 
parser bug (see Tomcat bug 48498 for details).
+jsp.error.cannotAddResolver=Cannot call addELResolver after the first request 
has been made
 jsp.error.classname=Cannot determine classname from .class file
 jsp.error.coerce_to_type=Cannot coerce value [{2}] to type [{1}] for attribute 
[{0}].
 jsp.error.compilation=Error compiling file: [{0}] [{1}]
@@ -118,6 +119,7 @@ jsp.error.missing_attribute=According to the TLD or the tag 
file, attribute [{0}
 jsp.error.missing_var_or_varReader=Missing 'var' or 'varReader' attribute
 jsp.error.namedAttribute.invalidUse=jsp:attribute must be the subelement of a 
standard or custom action
 jsp.error.needAlternateJavaEncoding=Default java encoding [{0}] is invalid on 
your java platform. An alternate can be specified via the ''javaEncoding'' 
parameter of JspServlet.
+jsp.error.negativeBufferSize=The buffer size is negative
 jsp.error.nested.jspattribute=A jsp:attribute standard action cannot be nested 
within another jsp:attribute standard action
 jsp.error.nested.jspbody=A jsp:body standard action cannot be nested within 
another jsp:body or jsp:attribute standard action
 jsp.error.nested_jsproot=Nested &lt;jsp:root&gt;
@@ -128,8 +130,10 @@ jsp.error.no.scratch.dir=The JSP engine is not configured 
with a scratch dir.\n\
 jsp.error.no.scriptlets=Scripting elements ( &lt;%!, &lt;jsp:declaration, 
&lt;%=, &lt;jsp:expression, &lt;%, &lt;jsp:scriptlet ) are disallowed here.
 jsp.error.noFunction=The function [{0}] cannot be located with the specified 
prefix
 jsp.error.noFunctionMethod=Method [{0}] for function [{1}] not found in class 
[{2}]
+jsp.error.noInstanceManager=No org.apache.tomcat.InstanceManager set in 
ServletContext
 jsp.error.non_null_tei_and_var_subelems=Tag [{0}] has one or more variable 
subelements and a TagExtraInfo class that returns one or more VariableInfo
 jsp.error.not.in.template=[{0}] not allowed in a template text body.
+jsp.error.nullArgument=Null argument
 jsp.error.outputfolder=No output folder
 jsp.error.overflow=Error: JSP Buffer overflow
 jsp.error.page.conflict.autoflush=Page directive: illegal to have multiple 
occurrences of ''autoFlush'' with different values (old: [{0}], new: [{1}])
diff --git a/java/org/apache/jasper/resources/LocalStrings_de.properties 
b/java/org/apache/jasper/resources/LocalStrings_de.properties
index 01088f9..9081b85 100644
--- a/java/org/apache/jasper/resources/LocalStrings_de.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_de.properties
@@ -21,6 +21,7 @@ jsp.error.attribute.duplicate=Qualifizierte Attributnamen 
müssen innerhalb eine
 jsp.error.attribute.noequal=Gleichheitszeichen erwartet
 jsp.error.attribute.nowhitespace=Die JSP Spezifikation verlangt, dass einem 
Attribut Namen ein Leerzeichen vorangeht.
 jsp.error.backgroundCompilationFailed=Die Hintergrundübersetzung schlug fehl.
+jsp.error.cannotAddResolver=Ein ELResolver kann nur hinzugefügt werden, bevor 
der erste Request gestellt wurde.
 jsp.error.compilation.source=Fehler beim Laden der Quelldatei [{0}]
 jsp.error.compiler=Keine Java-Compiler verfügbar
 jsp.error.data.file.processing=Fehler beim Verarbeiten der Datei [{0}]
@@ -39,9 +40,11 @@ jsp.error.jspbody.required=jsp:body muss für den Tag Inhalt 
für [{0}] genutzt
 jsp.error.jspelement.missing.name=Das erforderliche XML Attribut 'name' fehlt
 jsp.error.location=Zeile: [{0}], Spalte: [{1}]
 jsp.error.mandatory.attribute=[{0}]: Zwingend anzugebendes Attribut [{1}] fehlt
+jsp.error.negativeBufferSize=Die Puffergröße ist negativ
 jsp.error.no.scratch.dir=Die JSP-Engine ist nicht mir einem leeren Verzeichnis 
konfiguriert. Bitte fügen Sie "jsp.initparams=scratchdir=<verzeichnisname>" in 
die servlets.properties Datei für diesen Kontext.
 jsp.error.no.scriptlets=Die Skript-Elemente ( &lt;%!, &lt;jsp:declaration, 
&lt;%=, &lt;jsp:expression, &lt;%, &lt;jsp:scriptlet ) sind hier nicht erlaubt.
 jsp.error.noFunction=Die Funktion [{0}] kann mit dem angegebenen Prefix nicht 
gefunden werden
+jsp.error.noInstanceManager=Es
 jsp.error.not.in.template=[{0}] ist nicht im Body des Template Textes erlaubt
 jsp.error.outputfolder=kein Ausgabeordner
 jsp.error.parse.xml=Fehler bei der Verarbeitung der XML Datei [{0}]
diff --git a/java/org/apache/jasper/resources/LocalStrings_fr.properties 
b/java/org/apache/jasper/resources/LocalStrings_fr.properties
index c648401..059595d 100644
--- a/java/org/apache/jasper/resources/LocalStrings_fr.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_fr.properties
@@ -44,6 +44,7 @@ jsp.error.beans.property.conversion=Impossible de convertir 
la string [{0}] vers
 jsp.error.beans.propertyeditor.notregistered=L'éditeur de propriétés n'est pas 
enregistré avec le PropertyEditorManager
 jsp.error.beans.setproperty.noindexset=Impossible de renseigner la propriété 
indéxée
 jsp.error.bug48498=Impossible d'afficher un extrait du JSP, ce qui peut être 
causé par un problème du parser XML (voir le bug 48498 de Tomcat)
+jsp.error.cannotAddResolver=Impossible d'appeler addELResolver après qu'une 
première requête ait été effectuée
 jsp.error.classname=Impossible de déterminer le nom de classe d'après le 
fichier .class
 jsp.error.coerce_to_type=Impossible de convertir la valeur [{2}] de 
l''attribut [{0}] vers le type [{1}]
 jsp.error.compilation=Erreur de compilation du fichier : [{0}] [{1}]
@@ -118,6 +119,7 @@ jsp.error.missing_attribute=D''après le TLD l''attribut 
[{0}] est obligatoire p
 jsp.error.missing_var_or_varReader=L'attribut "var" ou "varReader" est manquant
 jsp.error.namedAttribute.invalidUse=Le jsp:attribute doit être un sous élément 
d'une action standard ou personnalisée
 jsp.error.needAlternateJavaEncoding=L''encodage java par défaut [{0}] est 
incorrect sur votre environnement java. Une alternative peut être indiquée via 
le paramêtre ''javaEncoding'' de la JspServlet.
+jsp.error.negativeBufferSize=La taille du tampon est négative
 jsp.error.nested.jspattribute=Une action standard jsp:attribute ne peut pas 
être nichée dans une autre
 jsp.error.nested.jspbody=Une action standard jsp:body ne peut être incluse 
dans une autre action standard jsp:body ou jsp:attribute
 jsp.error.nested_jsproot=&lt;jsp:root&gt; imbriqué
@@ -128,8 +130,10 @@ jsp.error.no.scratch.dir=Le moteur de JSP engine n'est pas 
configuré avec un r
 jsp.error.no.scriptlets=Les éléments de scripting ( <%!, <jsp:declaration, 
<%=, <jsp:expression, <%, <jsp:scriptlet ) ne sont pas autorisés ici.
 jsp.error.noFunction=La fonction [{0}] ne peut être trouvée pour le préfixe 
spécifié
 jsp.error.noFunctionMethod=La méthode [{0}] pour la fonction [{1}] n''a pas 
été trouvée dans la classe [{2}]
+jsp.error.noInstanceManager=Pas de org.apache.tomcat.InstanceManager défini 
dans le ServletContext
 jsp.error.non_null_tei_and_var_subelems=Le tag [{0}] possède une ou plusieurs 
variables subelements et une classe TagExtraInfo qui retourne une ou plusieurs 
VariableInfo
 jsp.error.not.in.template=[{0}] n''est pas autorisé dans le corps de texte de 
template.
+jsp.error.nullArgument=Argument null
 jsp.error.outputfolder=Pas de répertoire de sortie
 jsp.error.overflow=Erreur : Dépassement de capacité du tampon JSP
 jsp.error.page.conflict.autoflush=Directive de page : il est illégal d''avoir 
plusieurs occurrences de "autoFlush" avec des valeurs différentes (ancienne : 
[{0}], nouvelle [{1}])
diff --git a/java/org/apache/jasper/resources/LocalStrings_ja.properties 
b/java/org/apache/jasper/resources/LocalStrings_ja.properties
index e5af200..607241c 100644
--- a/java/org/apache/jasper/resources/LocalStrings_ja.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_ja.properties
@@ -44,6 +44,7 @@ jsp.error.beans.property.conversion=属性[{2}]:[{3}]の文字列[{0}]をク
 
jsp.error.beans.propertyeditor.notregistered=PropertyEditorManagerに登録されていないプロパティエディタ
 jsp.error.beans.setproperty.noindexset=インデックス付きのプロパティを設定できません
 jsp.error.bug48498=JSP抽出を表示できません。 
XMLパーサーのバグが原因である可能性があります(詳細は、Tomcatバグ48498を参照してください)。
+jsp.error.cannotAddResolver=最初のリクエストが行われた後にaddELResolverを呼び出せません。
 jsp.error.classname=.classファイルからクラス名を決定できません
 jsp.error.coerce_to_type=属性[{0}]の値[{2}]をタイプ[{1}]に変換できません。
 jsp.error.compilation=ファイルのコンパイル中にエラーが発生しました:[{0}] [{1}]
@@ -119,6 +120,7 @@ jsp.error.missing_attribute=TLD又はタグファイルによると、属性 [{0
 jsp.error.missing_var_or_varReader='var'又は'varReader'属性がありません
 jsp.error.namedAttribute.invalidUse=jsp:attributeは標準又はカスタムアクションの副要素でなければいけません
 jsp.error.needAlternateJavaEncoding=デフォルトのJavaエンコーディング [{0}] 
はあなたのプラットフォームでは無効です。JspServletの ''javaEncoding'' パラメータで別の値を指定することができます。
+jsp.error.negativeBufferSize=バッファーサイズが負です。
 
jsp.error.nested.jspattribute=jsp:attribute標準アクションは別のjsp:attribute標準アクションの範囲内でネストすることはできません
 
jsp.error.nested.jspbody=jsp:body標準アクションは別のjsp:body又はjsp:attribute標準アクションの範囲内でネストすることはできません
 jsp.error.nested_jsproot=入れ子になった &lt;jsp:root&gt; です
@@ -129,8 +131,10 @@ jsp.error.no.scratch.dir=JSPエンジンにデフォルトのscratchDirが設定
 jsp.error.no.scriptlets=スクリプティング要素 ( 
&lt;%!、&lt;jsp:declaration、&lt;%=、&lt;jsp:expression、&lt;%、&lt;jsp:scriptlet ) 
はここでは許されません
 jsp.error.noFunction=関数 [{0}] を指定されたプリフィクスで配置できません
 jsp.error.noFunctionMethod=関数 [{1}] のメソッド [{0}] が クラス[{2}] 中で見つかりません。
+jsp.error.noInstanceManager=ServletContextにorg.apache.tomcat.InstanceManagerが設定されていません
 jsp.error.non_null_tei_and_var_subelems=タグ [{0}] 
は一つ以上のvariable副要素と一つ以上のVariableInfoを返すTagExtraInfoクラスを持っています
 jsp.error.not.in.template=テンプレートテキストボディ中では [{0}] は許されません
+jsp.error.nullArgument=Null 引数
 jsp.error.outputfolder=出力フォルダがありません
 jsp.error.overflow=エラー: JSPバッファがオーバーフローしました
 jsp.error.page.conflict.autoflush=Pageディレクティブ: 
''autoFlush''を異なる値で複数回指定するのは無効です (旧: [{0}], 新: [{1}])
diff --git a/java/org/apache/jasper/resources/LocalStrings_ko.properties 
b/java/org/apache/jasper/resources/LocalStrings_ko.properties
index 8b84275..6cbd583 100644
--- a/java/org/apache/jasper/resources/LocalStrings_ko.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_ko.properties
@@ -44,6 +44,7 @@ jsp.error.beans.property.conversion=속성 [{2}]에 설정된 문자열 [{0}]을
 jsp.error.beans.propertyeditor.notregistered=PropertyEditorManager에 
PropertyEditor가 등록되어 있지 않습니다.
 jsp.error.beans.setproperty.noindexset=인덱스화된 프로퍼티를 설정할 수 없습니다.
 jsp.error.bug48498=JSP extract를 표시할 수 없습니다. XML 파서의 버그 때문일 수 있습니다 (상세 정보는 
Tomcat 버그 48498을 참조).
+jsp.error.cannotAddResolver=처음 요청이 한번 이루어진 이후에는, addELResolver를 호출할 수 없습니다.
 jsp.error.classname=.class 파일로부터 클래스명을 결정할 수 없습니다.
 jsp.error.coerce_to_type=속성 [{0}]을(를) 위한 값 [{2}]을(를), 타입 [{1}](으)로 강제 변환 시킬 수 
없습니다.
 jsp.error.compilation=파일 컴파일 중 오류 발생: [{0}] [{1}]
@@ -119,6 +120,7 @@ jsp.error.missing_attribute=해당 TLD 또는 태그 파일에 의하면, 속성
 jsp.error.missing_var_or_varReader='var' 또는 'varReader' 속성이 없습니다.
 jsp.error.namedAttribute.invalidUse=jsp:attribute는 반드시 표준 또는 커스텀 액션의 하위 
엘리먼트이어야 합니다.
 jsp.error.needAlternateJavaEncoding=기본 자바 인코딩 [{0}]은(는) 귀하의 자바 플랫폼에서 유효하지 
않습니다. JspServlet의 ''javaEncoding'' 파라미터를 통해, 대안적 인코딩을 설정할 수 있습니다.
+jsp.error.negativeBufferSize=버퍼 크기가 음수입니다.
 jsp.error.nested.jspattribute=jsp:attribute 표준 액션은 또 다른 jsp:attribute 표준 액션 내에 
포함될 수 없습니다.
 jsp.error.nested.jspbody=jsp:body 표준 액션은, 또 다른 jsp:body 또는 jsp:attribute 표준 액션 
내에 포함될 수 없습니다.
 jsp.error.nested_jsproot=Nested &lt;jsp:root&gt;
@@ -127,8 +129,10 @@ jsp.error.no.scratch.dir=JSP 엔진에 scratch 디렉토리가 설정되지 않
 jsp.error.no.scriptlets=스크립팅 엘리먼트들은 ( &lt;%!, &lt;jsp:declaration, &lt;%=, 
&lt;jsp:expression, &lt;%, &lt;jsp:scriptlet ) 이곳에서 허용되지 않습니다.
 jsp.error.noFunction=지정된 prefix를 사용하여 function [{0}]의 위치를 결정할 수 없습니다.
 jsp.error.noFunctionMethod=클래스 [{2}] 내에서, function [{1}]을(를) 위한 메소드 [{0}]을(를) 
찾을 수 없습니다.
+jsp.error.noInstanceManager=ServletContext에 org.apache.tomcat.InstanceManager가 
설정되지 않았습니다.
 jsp.error.non_null_tei_and_var_subelems=태그 [{0}]이(가) 하나 이상의 variable 하위 
엘리먼트들과, 하나 이상의 VariableInfo들을 반환하는 TagExtraInfo 클래스를 포함하고 있습니다.
 jsp.error.not.in.template=JSP 템플릿 텍스트의 body에서, [{0}]은(는) 허용되지 않습니다.
+jsp.error.nullArgument=널 아규먼트
 jsp.error.outputfolder=출력 폴더가 없음
 jsp.error.overflow=오류: JSP 버퍼 오버플로우
 jsp.error.page.conflict.autoflush=페이지 지시어: ''autoFlush''가 다른 값들로 여러 번 나타나는 것은 
불허됩니다. (이전 값: [{0}], 신규 값: [{1}])
diff --git a/java/org/apache/jasper/resources/LocalStrings_zh_CN.properties 
b/java/org/apache/jasper/resources/LocalStrings_zh_CN.properties
index 3888bfb..6891812 100644
--- a/java/org/apache/jasper/resources/LocalStrings_zh_CN.properties
+++ b/java/org/apache/jasper/resources/LocalStrings_zh_CN.properties
@@ -44,6 +44,7 @@ jsp.error.beans.property.conversion=无法将字符串[{0}]转换为属性[{2}]
 jsp.error.beans.propertyeditor.notregistered=属性编辑器未注册到属性编辑管理器
 jsp.error.beans.setproperty.noindexset=无法设置索引属性。
 jsp.error.bug48498=无法显示JSP提取。可能是由于XML解析器错误(有关详细信息,请参阅TomcatBug48498)。
+jsp.error.cannotAddResolver=在第一次请求发生之后不能调用addELResolver
 jsp.error.classname=无法从.class文件确定类名
 jsp.error.coerce_to_type=无法将值[{2}]强制为属性[{0}]的类型[{1}]。
 jsp.error.compilation=编译文件时出错:[{0}[{1}]
@@ -118,6 +119,7 @@ jsp.error.missing_attribute=根据TLD或标记文件,标记[{1}]必须使用
 jsp.error.missing_var_or_varReader=缺少“var”或“varReader”属性
 jsp.error.namedAttribute.invalidUse=jsp:属性必须是标准或自定义操作的子元素
 
jsp.error.needAlternateJavaEncoding=默认java编码[{0}]在java平台上无效。可以通过JspServlet的“javaEncoding”参数指定备用项。
+jsp.error.negativeBufferSize=缓存大小是负数
 jsp.error.nested.jspattribute=jsp:attribute标准操作不能嵌套在另一个jsp:attribute标准操作中
 jsp.error.nested.jspbody=JSP:体标准动作不能嵌套在另一个jsp:body 或者 jsp:属性标准动作中
 jsp.error.nested_jsproot=嵌套的&lt;jsp:root&gt;
@@ -127,8 +129,10 @@ jsp.error.no.scratch.dir=JSP引擎未配置scratch文件夹。\n\
 jsp.error.no.scriptlets=脚本( &lt;%!, &lt;jsp声明, &lt;%=, &lt;jsp表达式, &lt;%, 
&lt;jsp脚本变量 )不允许出现在这里
 jsp.error.noFunction=无法使用指定的前缀找到函数[{0}]
 jsp.error.noFunctionMethod=在类{2}中找不到函数{1}的方法{0}]
+jsp.error.noInstanceManager=ServletContext中没有org.apache.tomcat.InstanceManager集
 
jsp.error.non_null_tei_and_var_subelems=标记{0}有一个或多个变量子元素和返回一个或多个变量信息的TagExtraInfo类
 jsp.error.not.in.template=在模板文本体中, [{0}] 是不允许的.
+jsp.error.nullArgument=空参数
 jsp.error.outputfolder=无输出目录
 jsp.error.overflow=错误:JSP缓冲区溢出
 jsp.error.page.conflict.autoflush=页面指令:“ autoFlush”非法多次出现不同值(旧值: [{0}], 新值: 
[{1}])
diff --git a/java/org/apache/jasper/runtime/BodyContentImpl.java 
b/java/org/apache/jasper/runtime/BodyContentImpl.java
index 95dc65b..0f3c11a 100644
--- a/java/org/apache/jasper/runtime/BodyContentImpl.java
+++ b/java/org/apache/jasper/runtime/BodyContentImpl.java
@@ -28,6 +28,7 @@ import javax.servlet.jsp.JspWriter;
 import javax.servlet.jsp.tagext.BodyContent;
 
 import org.apache.jasper.Constants;
+import org.apache.jasper.compiler.Localizer;
 
 /**
  * Write text to a character-output stream, buffering characters so as
@@ -680,7 +681,9 @@ public class BodyContentImpl extends BodyContent {
     }
 
     private void ensureOpen() throws IOException {
-        if (closed) throw new IOException("Stream closed");
+        if (closed) {
+            throw new 
IOException(Localizer.getMessage("jsp.error.stream.closed"));
+        }
     }
 
     /**
diff --git a/java/org/apache/jasper/runtime/InstanceManagerFactory.java 
b/java/org/apache/jasper/runtime/InstanceManagerFactory.java
index af144d1..0188c63 100644
--- a/java/org/apache/jasper/runtime/InstanceManagerFactory.java
+++ b/java/org/apache/jasper/runtime/InstanceManagerFactory.java
@@ -18,6 +18,7 @@ package org.apache.jasper.runtime;
 
 import javax.servlet.ServletConfig;
 
+import org.apache.jasper.compiler.Localizer;
 import org.apache.tomcat.InstanceManager;
 
 public class InstanceManagerFactory {
@@ -29,7 +30,7 @@ public class InstanceManagerFactory {
         InstanceManager instanceManager =
                 (InstanceManager) 
config.getServletContext().getAttribute(InstanceManager.class.getName());
         if (instanceManager == null) {
-            throw new IllegalStateException("No 
org.apache.tomcat.InstanceManager set in ServletContext");
+            throw new 
IllegalStateException(Localizer.getMessage("jsp.error.noInstanceManager"));
         }
         return instanceManager;
     }
diff --git a/java/org/apache/jasper/runtime/JspApplicationContextImpl.java 
b/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
index 66690ad..0d8b68f 100644
--- a/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
+++ b/java/org/apache/jasper/runtime/JspApplicationContextImpl.java
@@ -32,6 +32,7 @@ import javax.servlet.jsp.JspApplicationContext;
 import javax.servlet.jsp.JspContext;
 
 import org.apache.jasper.Constants;
+import org.apache.jasper.compiler.Localizer;
 import org.apache.jasper.el.ELContextImpl;
 import org.apache.jasper.el.JasperELResolver;
 
@@ -62,14 +63,14 @@ public class JspApplicationContextImpl implements 
JspApplicationContext {
     @Override
     public void addELContextListener(ELContextListener listener) {
         if (listener == null) {
-            throw new IllegalArgumentException("ELContextListener was null");
+            throw new 
IllegalArgumentException(Localizer.getMessage("jsp.error.nullArgument"));
         }
         this.contextListeners.add(listener);
     }
 
     public static JspApplicationContextImpl getInstance(ServletContext 
context) {
         if (context == null) {
-            throw new IllegalArgumentException("ServletContext was null");
+            throw new 
IllegalArgumentException(Localizer.getMessage("jsp.error.nullArgument"));
         }
         JspApplicationContextImpl impl = (JspApplicationContextImpl) context
                 .getAttribute(KEY);
@@ -82,7 +83,7 @@ public class JspApplicationContextImpl implements 
JspApplicationContext {
 
     public ELContextImpl createELContext(JspContext context) {
         if (context == null) {
-            throw new IllegalArgumentException("JspContext was null");
+            throw new 
IllegalArgumentException(Localizer.getMessage("jsp.error.nullArgument"));
         }
 
         // create ELContext for JspContext
@@ -127,11 +128,10 @@ public class JspApplicationContextImpl implements 
JspApplicationContext {
     @Override
     public void addELResolver(ELResolver resolver) throws 
IllegalStateException {
         if (resolver == null) {
-            throw new IllegalArgumentException("ELResolver was null");
+            throw new 
IllegalArgumentException(Localizer.getMessage("jsp.error.nullArgument"));
         }
         if (this.instantiated) {
-            throw new IllegalStateException(
-                    "cannot call addELResolver after the first request has 
been made");
+            throw new 
IllegalStateException(Localizer.getMessage("jsp.error.cannotAddResolver"));
         }
         this.resolvers.add(resolver);
     }
diff --git a/java/org/apache/jasper/runtime/JspWriterImpl.java 
b/java/org/apache/jasper/runtime/JspWriterImpl.java
index ad1ffed..60cab2f 100644
--- a/java/org/apache/jasper/runtime/JspWriterImpl.java
+++ b/java/org/apache/jasper/runtime/JspWriterImpl.java
@@ -19,15 +19,12 @@ package org.apache.jasper.runtime;
 
 import java.io.IOException;
 import java.io.Writer;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
 
 import javax.servlet.ServletResponse;
 import javax.servlet.jsp.JspWriter;
 
 import org.apache.jasper.Constants;
 import org.apache.jasper.compiler.Localizer;
-import org.apache.jasper.security.SecurityUtil;
 
 /**
  * Write text to a character-output stream, buffering characters so as
@@ -69,7 +66,7 @@ public class JspWriterImpl extends JspWriter {
             boolean autoFlush) {
         super(sz, autoFlush);
         if (sz < 0)
-            throw new IllegalArgumentException("Buffer size <= 0");
+            throw new 
IllegalArgumentException(Localizer.getMessage("jsp.error.negativeBufferSize"));
         this.response = response;
         cb = sz == 0 ? null : new char[sz];
         nextChar = 0;
@@ -119,19 +116,6 @@ public class JspWriterImpl extends JspWriter {
         }
     }
 
-    private String getLocalizeMessage(final String message){
-        if (SecurityUtil.isPackageProtectionEnabled()){
-            return AccessController.doPrivileged(new 
PrivilegedAction<String>(){
-                @Override
-                public String run(){
-                    return Localizer.getMessage(message);
-                }
-            });
-        } else {
-            return Localizer.getMessage(message);
-        }
-    }
-
     /**
      * Discard the output buffer.
      */
@@ -140,10 +124,10 @@ public class JspWriterImpl extends JspWriter {
         if ((bufferSize == 0) && (out != null))
             // clear() is illegal after any unbuffered output (JSP.5.5)
             throw new IllegalStateException(
-                    getLocalizeMessage("jsp.error.ise_on_clear"));
+                    Localizer.getMessage("jsp.error.ise_on_clear"));
         if (flushed)
             throw new IOException(
-                    
getLocalizeMessage("jsp.error.attempt_to_clear_flushed_buffer"));
+                    
Localizer.getMessage("jsp.error.attempt_to_clear_flushed_buffer"));
         ensureOpen();
         nextChar = 0;
     }
@@ -152,13 +136,13 @@ public class JspWriterImpl extends JspWriter {
     public void clearBuffer() throws IOException {
         if (bufferSize == 0)
             throw new IllegalStateException(
-                    getLocalizeMessage("jsp.error.ise_on_clear"));
+                    Localizer.getMessage("jsp.error.ise_on_clear"));
         ensureOpen();
         nextChar = 0;
     }
 
     private final void bufferOverflow() throws IOException {
-        throw new IOException(getLocalizeMessage("jsp.error.overflow"));
+        throw new IOException(Localizer.getMessage("jsp.error.overflow"));
     }
 
     /**
@@ -200,7 +184,7 @@ public class JspWriterImpl extends JspWriter {
     /** check to make sure that the stream has not been closed */
     private void ensureOpen() throws IOException {
         if (response == null || closed)
-            throw new IOException("Stream closed");
+            throw new 
IOException(Localizer.getMessage("jsp.error.stream.closed"));
     }
 
 
diff --git a/java/org/apache/jasper/security/SecurityClassLoad.java 
b/java/org/apache/jasper/security/SecurityClassLoad.java
index 7172b14..9fe4c1f 100644
--- a/java/org/apache/jasper/security/SecurityClassLoad.java
+++ b/java/org/apache/jasper/security/SecurityClassLoad.java
@@ -14,18 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.jasper.security;
 
+import org.apache.jasper.compiler.Localizer;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 
 /**
- * Static class used to preload java classes when using the Java 
SecurityManager
- * so that the defineClassInPackage RuntimePermission does not trigger an
- * AccessControlException.
+ * Static class used to preload java classes when using the
+ * Java SecurityManager so that the defineClassInPackage
+ * RuntimePermission does not trigger an AccessControlException.
  */
-
 public final class SecurityClassLoad {
 
     public static void securityClassLoad(ClassLoader loader) {
@@ -39,31 +38,27 @@ public final class SecurityClassLoad {
             // Ensure XMLInputFactory is loaded with Tomcat's class loader
             loader.loadClass(basePackage + "compiler.EncodingDetector");
 
+            loader.loadClass(basePackage + "runtime.JspContextWrapper");
             loader.loadClass(basePackage + 
"runtime.JspFactoryImpl$PrivilegedGetPageContext");
             loader.loadClass(basePackage + 
"runtime.JspFactoryImpl$PrivilegedReleasePageContext");
-
-            loader.loadClass(basePackage + "runtime.JspRuntimeLibrary");
-
-            loader.loadClass(basePackage + 
"runtime.ServletResponseWrapperInclude");
-            loader.loadClass(basePackage + "runtime.TagHandlerPool");
             loader.loadClass(basePackage + "runtime.JspFragmentHelper");
 
-            loader.loadClass(basePackage + "runtime.ProtectedFunctionMapper");
+            loader.loadClass(basePackage + "runtime.JspRuntimeLibrary");
 
             loader.loadClass(basePackage + "runtime.PageContextImpl");
             loadAnonymousInnerClasses(loader, basePackage + 
"runtime.PageContextImpl");
 
-            loader.loadClass(basePackage + "runtime.JspContextWrapper");
+            loader.loadClass(basePackage + "runtime.ProtectedFunctionMapper");
+            loader.loadClass(basePackage + 
"runtime.ServletResponseWrapperInclude");
+            loader.loadClass(basePackage + "runtime.TagHandlerPool");
 
             // Trigger loading of class and reading of property
             SecurityUtil.isPackageProtectionEnabled();
 
             loader.loadClass(basePackage + "servlet.JspServletWrapper");
-
-            loadAnonymousInnerClasses(loader, "runtime.JspWriterImpl");
-        } catch (ClassNotFoundException ex) {
+        } catch (Exception ex) {
             Log log = LogFactory.getLog(SecurityClassLoad.class);
-            log.error("SecurityClassLoad", ex);
+            log.error(Localizer.getMessage("jsp.error.securityPreload"), ex);
         }
     }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to