luehe 2003/02/03 12:11:43 Modified: jasper2/src/share/org/apache/jasper/compiler JspUtil.java Validator.java jasper2/src/share/org/apache/jasper/resources messages.properties messages_fr.properties Log: Fixed 16728: Translation error not raised of jsp:attribute is provided an invalid value to the 'scope' attribute Revision Changes Path 1.29 +23 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java Index: JspUtil.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspUtil.java,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- JspUtil.java 22 Jan 2003 20:08:24 -0000 1.28 +++ JspUtil.java 3 Feb 2003 20:11:41 -0000 1.29 @@ -225,6 +225,26 @@ } /** + * Checks to see if the given scope is valid. + * + * @param scope The scope to be checked + * @param n The Node containing the 'scope' attribute whose value is to be + * checked + * @param err error dispatcher + * + * @throws JasperException if scope is not null and different from + * "page", "request", "session", and + * "application" + */ + public static void checkScope(String scope, Node n, ErrorDispatcher err) + throws JasperException { + if (scope != null && !scope.equals("page") && !scope.equals("request") + && !scope.equals("session") && !scope.equals("application")) { + err.jspError(n, "jsp.error.invalid.scope", scope); + } + } + + /** * Checks if all mandatory attributes are present and if all attributes * present have valid names. Checks attributes specified as XML-style * attributes as well as attributes specified using the jsp:attribute 1.71 +12 -3 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java Index: Validator.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Validator.java,v retrieving revision 1.70 retrieving revision 1.71 diff -u -r1.70 -r1.71 --- Validator.java 27 Jan 2003 23:15:34 -0000 1.70 +++ Validator.java 3 Feb 2003 20:11:42 -0000 1.71 @@ -542,6 +542,7 @@ String name = n.getTextAttribute ("id"); String scope = n.getTextAttribute ("scope"); + JspUtil.checkScope(scope, n, err); String className = n.getTextAttribute ("class"); String type = n.getTextAttribute ("type"); BeanRepository beanInfo = pageInfo.getBeanRepository(); @@ -941,6 +942,10 @@ public void visit(Node.InvokeAction n) throws JasperException { JspUtil.checkAttributes("Invoke", n, invokeAttrs, err); + + String scope = n.getTextAttribute ("scope"); + JspUtil.checkScope(scope, n, err); + if (n.getAttributeValue("var") != null && n.getAttributeValue("varReader") != null) { err.jspError(n, "jsp.error.invoke.varAndVarReader"); @@ -950,6 +955,10 @@ public void visit(Node.DoBodyAction n) throws JasperException { JspUtil.checkAttributes("DoBody", n, doBodyAttrs, err); + + String scope = n.getTextAttribute ("scope"); + JspUtil.checkScope(scope, n, err); + if (n.getAttributeValue("var") != null && n.getAttributeValue("varReader") != null) { err.jspError(n, "jsp.error.doBody.varAndVarReader"); 1.87 +2 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties Index: messages.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v retrieving revision 1.86 retrieving revision 1.87 diff -u -r1.86 -r1.87 --- messages.properties 1 Feb 2003 02:41:13 -0000 1.86 +++ messages.properties 3 Feb 2003 20:11:42 -0000 1.87 @@ -31,7 +31,7 @@ by jsp directive defined earlier: jsp.error.usebean.not.both=useBean: Can't specify both class and beanName attribute: jsp.error.usebean.bad.type.cast=useBean ({0}): Type ({1}) is not assignable from class ({2}) -jsp.error.usebean.invalid.scope=Invalid scope ({1}) in useBean: ({0}). +jsp.error.invalid.scope=Invalid value of 'scope' attribute: {0} (must be one of \"page\", \"request\", \"session\", or \"application\") jsp.error.classname=Can't determine classname from .class file jsp.warning.bad.type=Warning: bad type in .class file jsp.error.data.file.write=Error while writing data file 1.16 +1 -2 jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties Index: messages_fr.properties =================================================================== RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages_fr.properties,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- messages_fr.properties 1 Feb 2003 02:41:13 -0000 1.15 +++ messages_fr.properties 3 Feb 2003 20:11:43 -0000 1.16 @@ -31,7 +31,6 @@ par la directive jsp définie précédemment: jsp.error.usebean.not.both=useBean: Impossible de spécifier à la fois la classe et l''attribut beanName: jsp.error.usebean.bad.type.cast=useBean ({0}): Le type ({1}) n''est pas assignable depuis la classe ({2}) -jsp.error.usebean.invalid.scope=Portée incorrecte ({1}) dans le useBean: ({0}). jsp.error.classname=Impossible de déterminer le nom de classe d''après le fichier .class jsp.warning.bad.type=Attention: mauvais type dans le fichier .class jsp.error.data.file.write=Erreur lors de l''écriture du fichier de données
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]