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/tag/rt/fmt ParseDateTag.java ParseNumberTag.java
Date Thu, 28 Mar 2002 01:24:08 GMT
luehe       02/03/27 17:24:08

  Modified:    standard/src/org/apache/taglibs/standard/tag/common/fmt
                        LocaleSupport.java
               standard/src/org/apache/taglibs/standard/tag/el/fmt
                        ParseDateTag.java ParseNumberTag.java
               standard/src/org/apache/taglibs/standard/tag/rt/fmt
                        ParseDateTag.java ParseNumberTag.java
  Log:
  Fixed 7423: ResourceBundle lookup algorithm is not working as spec'd.
  
  Revision  Changes    Path
  1.15      +14 -9     jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java
  
  Index: LocaleSupport.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/LocaleSupport.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- LocaleSupport.java	23 Mar 2002 01:33:50 -0000	1.14
  +++ LocaleSupport.java	28 Mar 2002 01:24:07 -0000	1.15
  @@ -125,7 +125,12 @@
       // Tag logic
   
       public int doEndTag() throws JspException {
  -	Locale locale = parseLocale(value, variant);
  +	Locale locale = null;
  +	if ((value == null) || "".equals(value)) {
  +	    locale = Locale.getDefault();
  +	} else {
  +	    locale = parseLocale(value, variant);
  +	}
   	pageContext.setAttribute(LOCALE + "." + scope, locale,
   				 Util.getScope(scope));
   	setResponseLocale(pageContext, locale);
  @@ -174,10 +179,6 @@
   	String country = null;
   	int index = -1;
   
  -	if ((locale == null) || locale.equals("")) {
  -	    return Locale.getDefault();
  -	}
  -
   	if (((index = locale.indexOf(HYPHEN)) > -1)
   	        || ((index = locale.indexOf(UNDERSCORE)) > -1)) {
   	    language = locale.substring(0, index);
  @@ -322,18 +323,22 @@
        */
       static Locale getLocale(PageContext pageContext, String name,
   			    boolean extend) {
  +	String loc = null;
   	Locale ret = null;
  +
   	if (extend) {
   	    ret = (Locale) Util.findAttribute(pageContext, name);
   	}
   	if (ret == null) {
  -	    ret = parseLocale((String) pageContext.findAttribute(name));
  +	    loc = (String) pageContext.findAttribute(name);
  +	    if (loc != null) {
  +		ret = parseLocale(loc);
  +	    }
   	}
   	if (ret == null) {
  -	    String loc =
  -		pageContext.getServletContext().getInitParameter(name);
  +	    loc = pageContext.getServletContext().getInitParameter(name);
   	    if (loc != null) {
  -		ret = parseLocale(loc, null);
  +		ret = parseLocale(loc);
   	    }
   	}
   
  
  
  
  1.8       +8 -6      jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java
  
  Index: ParseDateTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/fmt/ParseDateTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ParseDateTag.java	9 Mar 2002 00:55:59 -0000	1.7
  +++ ParseDateTag.java	28 Mar 2002 01:24:07 -0000	1.8
  @@ -212,12 +212,14 @@
   	        "timeZone", timeZone_, Object.class, this, pageContext);
   	}
   
  -	// 'parseLocale' attribute (if specified, must not be null)
  -	String pl = (String) ExpressionUtil.evalNotNull(
  -	    "parseDate", "parseLocale", parseLocale_, String.class, this,
  -	    pageContext);
  -	if (pl != null) {
  -	    parseLocale = LocaleSupport.parseLocale(pl, null);
  +	// 'parseLocale' attribute
  +	if (parseLocale_ != null) {
  +	    String pl = (String) ExpressionUtil.evalNotNull(
  +	        "parseDate", "parseLocale", parseLocale_, String.class, this,
  +		pageContext);
  +	    if ((pl != null) && !"".equals(pl)) {
  +		parseLocale = LocaleSupport.parseLocale(pl);
  +	    }
   	}
       }
   }
  
  
  
  1.6       +2 -2      jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java
  
  Index: ParseNumberTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/el/fmt/ParseNumberTag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ParseNumberTag.java	9 Mar 2002 00:55:59 -0000	1.5
  +++ ParseNumberTag.java	28 Mar 2002 01:24:07 -0000	1.6
  @@ -189,8 +189,8 @@
   	    obj = ExpressionUtil.evalNotNull(
   	        "parseNumber", "parseLocale", parseLocale_, String.class, this,
   		pageContext);
  -	    if (obj != null) {
  -		parseLocale = LocaleSupport.parseLocale((String) obj, null);
  +	    if ((obj != null) && !"".equals((String) obj)) {
  +		parseLocale = LocaleSupport.parseLocale((String) obj);
   	    }
   	}
   
  
  
  
  1.7       +3 -1      jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java
  
  Index: ParseDateTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ParseDateTag.java	1 Mar 2002 19:33:11 -0000	1.6
  +++ ParseDateTag.java	28 Mar 2002 01:24:07 -0000	1.7
  @@ -104,6 +104,8 @@
   
       // 'parseLocale' attribute
       public void setParseLocale(String parseLocale) throws JspTagException {
  -        this.parseLocale = LocaleSupport.parseLocale(parseLocale, null);
  +	if (! "".equals(parseLocale)) {
  +	    this.parseLocale = LocaleSupport.parseLocale(parseLocale);
  +	}
       }
   }
  
  
  
  1.5       +3 -1      jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java
  
  Index: ParseNumberTag.java
  ===================================================================
  RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ParseNumberTag.java	1 Mar 2002 02:13:27 -0000	1.4
  +++ ParseNumberTag.java	28 Mar 2002 01:24:07 -0000	1.5
  @@ -89,7 +89,9 @@
   
       // 'parseLocale' attribute
       public void setParseLocale(String parseLocale) throws JspTagException {
  -        this.parseLocale = LocaleSupport.parseLocale(parseLocale, null);
  +	if (! "".equals(parseLocale)) {
  +	    this.parseLocale = LocaleSupport.parseLocale(parseLocale);
  +	}
       }
   
       // 'integerOnly' attribute
  
  
  

--
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