You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2007/10/26 23:50:50 UTC

[jira] Created: (LANG-366) add MultiFormat

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


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.


[jira] Commented: (LANG-366) add MultiFormat

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12538115 ] 

Matt Benson commented on LANG-366:
----------------------------------

Still need unit tests

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


[jira] Resolved: (LANG-366) add MultiFormat

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson resolved LANG-366.
------------------------------

    Resolution: Fixed

Committed w/ tests + additional comment

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


[jira] Reopened: (LANG-366) add MultiFormat

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Resolved: (LANG-366) add MultiFormat

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson resolved LANG-366.
------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: 2.4)

Reworking of LANG-362 means this is no longer necessary; removing.

> add MultiFormat
> ---------------
>
>                 Key: LANG-366
>                 URL: https://issues.apache.org/jira/browse/LANG-366
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Matt Benson
>         Attachments: multiFormat.patch.txt, MultiFormat2.java
>
>
> 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.


[jira] Updated: (LANG-366) add MultiFormat

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson updated LANG-366:
-----------------------------

    Attachment: multiFormat.patch.txt

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


[jira] Commented: (LANG-366) add MultiFormat

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565264#action_12565264 ] 

Niall Pemberton commented on LANG-366:
--------------------------------------

Something I missed earlier was the fact that MultiFormat is being used as a core part of EMF - I saw it originally as just another format implementation for users. Since date and number are the most commonly used, then the fact that it doesn't work is still an issue. Even if my proposal is dismissed (I actually think that having something that works that doesn't fully adhere strictly to the API is preferable than the reverse) then providing a broken implementation is not a good idea. I agree we need to see the outcome of EMF - but if this remains in its current state and still required by EMF then perhaps it shouldn't be part of the public API

> 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, MultiFormat2.java
>
>
> 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.


[jira] Commented: (LANG-366) add MultiFormat

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564088#action_12564088 ] 

Matt Benson commented on LANG-366:
----------------------------------

Thanks, Niall.  I'll try to have a look at this today or tomorrow.

> 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, MultiFormat2.java
>
>
> 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.


[jira] Commented: (LANG-366) add MultiFormat

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12565104#action_12565104 ] 

Matt Benson commented on LANG-366:
----------------------------------

:|  Here we are again and again I am forced to disagree with you, Niall.  On your second issue, regarding consuming all the input, again I defer to the Format API.  parseObject(String, ParsePosition) is specifically declared to consume only as much of the incoming String as necessary, so forcing all input to be consumed would defeat the goals of the API at least in part.  This is why ParsePosition has an updatable index; otherwise returning an Object vs. throwing an Exception would be sufficient behavior.  On the first issue I don't exactly have a problem except for the fact that I can't see how it would be compatible with the part of my EMF code in which it's used (and which dictated the creation of MultiFormat).  We can defer that discussion until we reach consensus on the EMF issue, but perhaps a TypeKeyedFormat or some such might be an option.

Thanks,
Matt

> 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, MultiFormat2.java
>
>
> 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.


[jira] Updated: (LANG-366) add MultiFormat

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-366?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Niall Pemberton updated LANG-366:
---------------------------------

    Attachment: MultiFormat2.java

Attaching an alternative implementation that resolves the issues I raised. Its not properly tested - but it works with the current MutliFormat test without the GuardedFormat and whichever way round the formats are specified. Also clone is implemented.

> 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, MultiFormat2.java
>
>
> 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.