[ 
https://issues.apache.org/jira/browse/MATH-542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003186#comment-13003186
 ] 

Luc Maisonobe commented on MATH-542:
------------------------------------

{quote}
Do you really want to allow "String" keys?
{quote}

I would even allow Object keys.

{quote}
My understanding was that we would allow the addition of "Localizable"s. This 
is a direct adaptation of the concept but satisfying the requirement of CM.
{quote}
This is more cumbersome for users. If they only want to have a key, requiring 
them to implement the Localizable interface is overkill.

{quote}
The "getValue" is not useful for CM because the intended goal is the display of 
the message (as a localized string). We don't need the added flexibility of 
retrieving unprocessed patterns. Those should remain implementation details.
{quote}
My understanding was that the intended goal was not to display message (of 
course it could be used for that), but rather to get some values. In fact I saw 
it as a more fine grained version of our existing getArguments() method from 
MathThrowable, with the additional benefit to retrieve a specific argument from 
its key.

{quote}
The map feature enhances the stack trace by indeed allowing to provide 
additional messages when the exception travels up the stack. Similarly to the 
stack trace, this info should remain ordered with respect to the call chain, 
resulting in a final message such as
—
original cause: more info added: some more info added by an intermediate call: 
last message added before display
—
[The ": " is the separator inserted between each bit of info added through 
"addMessage".]
{quote}
With this behaviour, the key-values pairs would only be used for messages 
building. I think the ExceptionContext feature from [lang] goes beyond that.

> Allow the addition of multiple messages to the exceptions generated by CM
> -------------------------------------------------------------------------
>
>                 Key: MATH-542
>                 URL: https://issues.apache.org/jira/browse/MATH-542
>             Project: Commons Math
>          Issue Type: New Feature
>            Reporter: Gilles
>            Assignee: Gilles
>            Priority: Minor
>              Labels: api-change
>             Fix For: 3.0
>
>
> Borrowing on the idea of "ExceptionContext" implemented in [Lang], 
> "MathRuntimeException" (base class of all exceptions generated from CM) will 
> be enhanced so that an unlimited number of (localized) messages can be added 
> to an exception object.
> The "MathThrowable" interface (implemented by "MathRuntimeException") will 
> contain the following new method:
> {code}
> /**
>   * Sets a message.
>   *
>   * @param pattern Message pattern.
>   * @param arguments Values for replacing the placeholders in the message
>   * pattern.
>   */
>   public void addMessage(Localizable pattern,
>                          Object ... arguments);
> {code}

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to