This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new f4fb5a923d Throw on bad scope error
f4fb5a923d is described below
commit f4fb5a923d061d45794dfa64eec91af213c77c8d
Author: remm <[email protected]>
AuthorDate: Wed Sep 20 17:39:32 2023 +0200
Throw on bad scope error
Just in case (it doesn't happen in the current code obviously). Also add
missing localization.
Found by coverity.
---
java/org/apache/jasper/compiler/Generator.java | 12 ++----------
java/org/apache/jasper/compiler/Node.java | 4 ++++
java/org/apache/jasper/resources/LocalStrings.properties | 2 ++
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/java/org/apache/jasper/compiler/Generator.java
b/java/org/apache/jasper/compiler/Generator.java
index 2ba69837e7..e99956a67e 100644
--- a/java/org/apache/jasper/compiler/Generator.java
+++ b/java/org/apache/jasper/compiler/Generator.java
@@ -1226,15 +1226,7 @@ class Generator {
+ property
+ "\")));");
} else {
- StringBuilder msg = new StringBuilder();
- msg.append("file:");
- msg.append(n.getStart());
- msg.append(" jsp:getProperty for bean with name '");
- msg.append(name);
- msg.append(
- "'. Name was not previously introduced as per
JSP.5.3");
-
- throw new JasperException(msg.toString());
+ throw new
JasperException(Localizer.getMessage("jsp.error.invalid.name", n.getStart(),
name));
}
n.setEndJavaLine(out.getJavaLine());
@@ -1359,7 +1351,7 @@ class Generator {
if (!Modifier.isPublic(modifiers) ||
Modifier.isAbstract(modifiers) ||
!constructor.canAccess(null) ) {
- throw new
Exception(Localizer.getMessage("jsp.error.invalid.bean",
+ throw new
JasperException(Localizer.getMessage("jsp.error.invalid.bean",
Integer.valueOf(modifiers)));
}
// At compile time, we have determined that the bean class
diff --git a/java/org/apache/jasper/compiler/Node.java
b/java/org/apache/jasper/compiler/Node.java
index 0de36d57f6..5a2d2a28ea 100644
--- a/java/org/apache/jasper/compiler/Node.java
+++ b/java/org/apache/jasper/compiler/Node.java
@@ -1597,6 +1597,8 @@ abstract class Node implements TagConstants {
case VariableInfo.NESTED:
this.nestedScriptingVars = vec;
break;
+ default:
+ throw new
IllegalArgumentException(Localizer.getMessage("jsp.error.page.invalid.varscope",
scope));
}
}
@@ -1617,6 +1619,8 @@ abstract class Node implements TagConstants {
case VariableInfo.NESTED:
vec = this.nestedScriptingVars;
break;
+ default:
+ throw new
IllegalArgumentException(Localizer.getMessage("jsp.error.page.invalid.varscope",
scope));
}
return vec;
diff --git a/java/org/apache/jasper/resources/LocalStrings.properties
b/java/org/apache/jasper/resources/LocalStrings.properties
index 9817f4a341..ce2f63704a 100644
--- a/java/org/apache/jasper/resources/LocalStrings.properties
+++ b/java/org/apache/jasper/resources/LocalStrings.properties
@@ -87,8 +87,10 @@ jsp.error.invalid.directive=Invalid directive
jsp.error.invalid.expression=[{0}] contains invalid expression(s): [{1}]
jsp.error.invalid.implicit=Invalid implicit TLD for tag file at [{0}]
jsp.error.invalid.implicit.version=Invalid JSP version defined in implicit TLD
for tag file at [{0}]
+jsp.error.invalid.name=File [{0}] uses name [{1}] in jsp:getProperty for a
bean that was not previously introduced as per JSP.5.3
jsp.error.invalid.scope=Illegal value of ''scope'' attribute: [{0}] (must be
one of "page", "request", "session", or "application")
jsp.error.invalid.tagdir=Tag file directory [{0}] does not start with
"/WEB-INF/tags"
+jsp.error.invalid.varscope=Invalid variable scope [{0}]
jsp.error.invalid.version=Invalid JSP version defined for tag file at [{0}]
jsp.error.ise_on_clear=Illegal to clear() when buffer size == 0
jsp.error.java.line.number=An error occurred at line: [{0}] in the generated
java file: [{1}]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]