return false;
}
+ public static boolean isJavaIdentifier(String key) {
+ // Should not be the case but check to be sure
+ if (key == null || key.length() == 0) {
+ return false;
+ }
+
+ if (isJavaKeyword(key)) {
+ return false;
+ }
+
+ // Check the start character that has more restrictions
+ if (!Character.isJavaIdentifierStart(key.charAt(0))) {
+ return false;
+ }
+
+ // Check each remaining character used is permitted
+ for (int idx = 1; idx < key.length(); idx++) {
+ if (!Character.isJavaIdentifierPart(key.charAt(idx))) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
static InputStreamReader getReader(String fname, String encoding,
JarFile jarFile, JspCompilationContext ctxt, ErrorDispatcher err)
throws JasperException, IOException {
*/
private void parseAttributeDirective(Node parent) throws JasperException {
Attributes attrs = parseAttributes();
+ // JSP.8.3 says the variable created for each attribute must have the
+ // same name as the attribute. Therefore, the names must be valid Java
+ // identifiers
+ if (attrs != null && attrs.getLength() > 0) {
+ for (int i = 0; i < attrs.getLength(); i++) {
+ if ("name".equals(attrs.getLocalName(i)) &&
+ !JspUtil.isJavaIdentifier(attrs.getValue(i))) {
+ err.jspError(start, "jsp.error.identifier",
+ attrs.getValue(i));
+ }
+ }
+ }
new Node.AttributeDirective(attrs, start, parent);
}
jsp.message.jsp_removed_idle=Removing idle JSP for path [{0}] in context [{1}] after {2} seconds");
jsp.message.jsp_unload_check=Checking JSPs for unload in context [{0}], JSP count: {1} queue length: {2}
+jsp.error.identifier=The attribute name [{0}] is invalid since it is not a valid Java identifier
+
xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream
Label JSP/tag file line and column numbers when reporting errors since
it may not be immediately obvious what the numbers represent. (markt)
</add>
+ <fix>
+ <bug>36362</bug>: Check that tag file attribute names are valid Java
+ identifiers. (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="Web applications">