> Please review this PR and associated 
> [CSR](https://bugs.openjdk.org/browse/JDK-8327703) which introduces strict 
> parsing for NumberFormat.
> 
> The concrete subclasses that will utilize this leniency value are 
> `DecimalFormat` and `CompactNumberFormat`. Strict leniency allows for parsing 
> to be used as an input validation technique for localized formatted numbers. 
> The default leniency mode will remain lenient, and can only be set to strict 
> through an intentional `setLenient(boolean)` method call. Leniency operates 
> differently based off the values returned by `isGroupingUsed()`, 
> `getGroupingSize()`, and `isParseIntegerOnly()`.
> 
> Below is an example of the change, the CSR can be viewed for further detail.
> 
> 
> DecimalFormat fmt = (DecimalFormat) NumberFormat.getNumberInstance(Locale.US);
> fmt.parse("1,,,0,,,00,.23Zabced45");  // returns 1000.23
> fmt.setLenient(false);
> fmt.parse("1,,,0,,,00,.23Zabced45"); // Now throws a ParseException
> fmt.setGroupingSize(2);
> fmt.parse("12,34,567"); // throws ParseException
> fmt.setParseIntegerOnly(true)
> fmt.parse("12,34.56"); // throws ParseException
> fmt.parse("12,34"); // successfully returns the Number 1234
> 
> 
> The associated tests are all localized, and the data is converted properly 
> during runtime.

Justin Lu has updated the pull request with a new target base due to a merge or 
a rebase. The incremental webrev excludes the unrelated changes brought in by 
the merge/rebase. The pull request contains 14 additional commits since the 
last revision:

 - Merge branch 'master' into JDK-8327640-NumberFormat-strictParsing
 - improve wording consistency and see tags
 - Merge branch 'master' into JDK-8327640-NumberFormat-strictParsing
 - revert cleanup changes; (to go into a separate change)
 - use directed 'inheritDoc' tag
 - update example for lenient parsing
 - replace protected field for private fields in subclasses for consistency
 - drop Format implNote as well
 - setStrict and isStrict should be optional in NumberFormat
   - specify and throw UOE as default
   - override and implement in dFmt and cmpctNFmt
   parseStrict should be protected, and utilized by subclasses. The public 
methods should just
   serve as API.
 - Re-work specification wording from Format down to subclasses
 - ... and 4 more: https://git.openjdk.org/jdk/compare/5de48d4a...aa1c284b

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/18339/files
  - new: https://git.openjdk.org/jdk/pull/18339/files/3f2b097a..aa1c284b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=18339&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=18339&range=04-05

  Stats: 32548 lines in 782 files changed: 14532 ins; 12719 del; 5297 mod
  Patch: https://git.openjdk.org/jdk/pull/18339.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18339/head:pull/18339

PR: https://git.openjdk.org/jdk/pull/18339

Reply via email to