jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tlv JstlFmtTLV.java
Date Tue, 18 Dec 2001 04:05:54 GMT
luehe       01/12/17 20:05:54

  Modified:    standard/src/org/apache/taglibs/standard/tlv JstlFmtTLV.java
  Log:
  Enforce rule that <messageFormat> with 'messageArgs' attribute must not have any <messageArg>
subtags
  
  Revision  Changes    Path
  1.2       +18 -11    jakarta-taglibs/standard/src/org/apache/taglibs/standard/tlv/JstlFmtTLV.java
  
  Index: JstlFmtTLV.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tlv/JstlFmtTLV.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JstlFmtTLV.java	2001/12/18 01:53:15	1.1
  +++ JstlFmtTLV.java	2001/12/18 04:05:54	1.2
  @@ -73,8 +73,9 @@
    * <ul>
    *   <li>Expression syntax validation, with full support for
    *      &lt;jx:expressionLanguage&gt;</li>
  - *   <li><message> with 'messageArgs' attribute must not have any <messageArg>
  - *      subtags as its direct children.</li>
  + *   <li>Any <message> or <messageFormat> action with a 'messageArgs'
  + *      attribute must not have any <messageArg> subtags as its direct
  + *      children.</li>
    *   <li>Tag bodies that must either be empty or non-empty given
    *      particular attributes.</li>
    * </ul>
  @@ -115,6 +116,7 @@
       private final String MESSAGE = "message";
       private final String MESSAGE_ARG = "messageArg";
       private final String MESSAGE_FORMAT = "messageFormat";
  +    private final String MESSAGE_OR_MESSAGE_FORMAT = "message(Format)";
       private final String FORMAT_NUMBER = "formatNumber";
       private final String PARSE_NUMBER = "parseNumber";
       private final String PARSE_DATE = "parseDate";
  @@ -207,21 +209,26 @@
                   fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
                       SCOPE, qn, a.getValue(SCOPE)));
   
  -	    // check invariants for <message>
  +	    // check invariants for <message> and <messageFormat>
   	    if (isTag(qn, MESSAGE_ARG) && messageChild()
   		&& ((Boolean) messageHasMessageArgs.peek()).booleanValue()) {
   		/*
  -		 * we're a <messageArg> tag and the direct child of
  -		 * <message messageArgs="...">, which is illegal
  +		 * we're a <messageArg> tag and the direct child of a
  +		 * <message> or <messageFormat> tag with a 'messageArgs'
  +		 * attribute, which is illegal
   		 */
   		fail(Resources.getMessage("TLV_ILLEGAL_PARAM",
  -	            prefix, MESSAGE_ARG, MESSAGE, MESSAGE_ARGS));
  +	            prefix, MESSAGE_ARG, MESSAGE_OR_MESSAGE_FORMAT,
  +					  MESSAGE_ARGS));
   	    }
   
   	    // now, modify state
   
  -	    // if we're in a <message>, record relevant state
  -	    if (isTag(qn, MESSAGE)) {
  +	    /*
  +	     * if we're in a <message> or <messageFormat>, record relevant
  +	     * state
  +	     */
  +	    if (isTag(qn, MESSAGE) || isTag(qn, MESSAGE_FORMAT)) {
   		messageDepths.push(new Integer(depth));
   		if (hasAttribute(a, MESSAGE_ARGS))
   		    messageHasMessageArgs.push(new Boolean(true));
  @@ -280,8 +287,8 @@
   		    lastElementName));
   	    bodyIllegal = false;	// reset: we've left the tag
   
  -	    // update <message>-related state
  -	    if (isTag(qn, MESSAGE)) {
  +	    // update <message>- or <messageFormat>-related state
  +	    if (isTag(qn, MESSAGE) || isTag(qn, MESSAGE_FORMAT)) {
   		messageDepths.pop();
   		messageHasMessageArgs.pop();
   	    }
  @@ -294,7 +301,7 @@
   	    depth--;
   	}
   
  -	// are we directly under a <message>
  +	// are we directly under a <message> or <messageFormat>?
   	private boolean messageChild() {
   	    return (!messageDepths.empty()
   		&& (depth - 1) == ((Integer) messageDepths.peek()).intValue());
  
  
  

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message