You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by lu...@apache.org on 2002/04/27 02:00:21 UTC
cvs commit: jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt ParseNumberSupport.java
luehe 02/04/26 17:00:21
Modified: standard/src/org/apache/taglibs/standard/tag/common/fmt
ParseNumberSupport.java
Log:
<fmt:parseNumber>: Implemented same change as for <fmt:formatNumber>, that is, if 'pattern' is specified, 'type' is ignored
Revision Changes Path
1.13 +12 -9 jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java
Index: ParseNumberSupport.java
===================================================================
RCS file: /home/cvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ParseNumberSupport.java 16 Apr 2002 18:17:51 -0000 1.12
+++ ParseNumberSupport.java 27 Apr 2002 00:00:21 -0000 1.13
@@ -150,20 +150,27 @@
* Set up parsing locale: Use locale specified via the 'parseLocale'
* attribute (if present), or else determine page's locale.
*/
- Locale locale = parseLocale;
- if (locale == null)
- locale = SetLocaleSupport.getFormattingLocale(
+ Locale loc = parseLocale;
+ if (loc == null)
+ loc = SetLocaleSupport.getFormattingLocale(
pageContext,
this,
false,
NumberFormat.getAvailableLocales());
- if (locale == null) {
+ if (loc == null) {
throw new JspException(
Resources.getMessage("PARSE_NUMBER_NO_PARSE_LOCALE"));
}
// Create parser
- NumberFormat parser = createParser(locale);
+ NumberFormat parser = null;
+ if ((pattern != null) && !pattern.equals("")) {
+ // if 'pattern' is specified, 'type' is ignored
+ DecimalFormatSymbols symbols = new DecimalFormatSymbols(loc);
+ parser = new DecimalFormat(pattern, symbols);
+ } else {
+ parser = createParser(loc);
+ }
// Configure parser
if (integerOnlySpecified)
@@ -206,10 +213,6 @@
if ((type == null) || NUMBER.equalsIgnoreCase(type)) {
parser = NumberFormat.getNumberInstance(loc);
- if (pattern != null) {
- DecimalFormat df = (DecimalFormat) parser;
- df.applyPattern(pattern);
- }
} else if (CURRENCY.equalsIgnoreCase(type)) {
parser = NumberFormat.getCurrencyInstance(loc);
} else if (PERCENT.equalsIgnoreCase(type)) {
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>