[ 
https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Niall Pemberton reopened LANG-366:
----------------------------------


I've had a look at the new MultiFormat and IMO it needs work before its ready 
to be in a release (and I would probably vote -1 on a release if included in 
its current state).

The biggest issue IMO is that currently it doesn't always work:
 - Formatting: a special "GuardedFormat" had to be created in MultiFormatTest 
to get the "testFormatNumber" to pass because the date format can handle 
numbers. Looks to me like MultiFormat needs the logic in "GuardedFormat" 
otherwise users are going to hit exactly that problem.
 - Parsing: in certains situations, implementations such as DecimalFormat and 
SimpleDateFormat stop when they hit an invalid character and don't indicate an 
error. For example if I parse "1/1/1970" with an integer format, it doesn't 
cause an error and returns a number of value "1". So in the MultiFormatTest 
"testParseDate" only works when the date format is before the number format - 
reverse the order and the test fails. The solution IMO is to check that all of 
the parsed input String has been "consumed".

Other points are:
 - the tests for error conditions should be improved
 - Format implements Cloneable and therefore this implementation should 
implement the clone method and create a copy of the delegate array and clone 
each Format in it.

> add MultiFormat
> ---------------
>
>                 Key: LANG-366
>                 URL: https://issues.apache.org/jira/browse/LANG-366
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Matt Benson
>             Fix For: 2.4
>
>         Attachments: multiFormat.patch.txt
>
>
> this started as a part of LANG-362.  That PR depends on this one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to