You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Derek C. Ashmore (JIRA)" <ji...@apache.org> on 2009/04/25 11:33:30 UTC

[jira] Created: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Addition of ContextedException and ContextedRuntimeException
------------------------------------------------------------

                 Key: LANG-497
                 URL: https://issues.apache.org/jira/browse/LANG-497
             Project: Commons Lang
          Issue Type: New Feature
            Reporter: Derek C. Ashmore
             Fix For: 3.0


This is a proposal for a feature addition.

These additional exceptions (checked and unchecked versions) provide an easier and safer 
way for developers to provide context when generating checked exceptions.  Often, 
additional information, besides what's embedded in the exception cause, is needed 
for developers to debug and correct a bug.  Often, this additional information can 
reduce the time it takes to replicate and fix a bug.

ContextedException are easier as developers don't need to be concerned 
with formatting the exception message to include additional information 
with the exception.  Additional information is automatically included
in the message and printed stack trace.  This often thins out exception
handling code.

ContextedException is safer as the additional code needed to embed additional
information in a normal exception tends to be tested less and is more vulnerable
to errors such as null pointer exceptions.

An unchecked version of this exception is provided by ContextedRuntimeException.

To use this class write code as follows:
 
  try {

  ...

  } catch (Throwable e) {
    throw new ContextedException("Error posting account transaction", e)
         .addLabeledValue("accountNumber", accountNumber)
         .addLabeledValue("amountPosted", amountPosted)
         .addLabeledValue("previousBalance", previousBalance)
  }
}

The value of the context information is automatically included in the exception message and
when the stack trace is printed in the log.

My motivation for contributing is that I've previous versions of this running
at four clients now -- I'm tiered of copying this from client to client.

I've attached the two exceptions themselves along with working test cases. Every effort has been made
to adhere to your existing style, conventions, and standards.  No changes are needed for any
existing files.

I ran the site generation -- These additions pass your checkstyle reports.

To streamline the committers time, I'll be happy to make any needed changes to to get this
into 3.0.

I know you're busy -- thanks for taking the time to at least review this proposal.


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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: DefaultExceptionContext.java
                ContextedRuntimeException.java
                ContextedException.java

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedRuntimeException.java, DefaultExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Issue Comment Edited: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Derek C. Ashmore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741079#action_12741079 ] 

Derek C. Ashmore edited comment on LANG-497 at 8/9/09 6:45 AM:
---------------------------------------------------------------

Thanks for the feedback and discussion.  Weather your writing an application or publishing an API, I'd recommend extending either ContextedException or ContextedRuntimeException as a first step and not throw these exceptions directly.

Down the road, you may need additional features, beyond what's provided in these exceptions, and the extension would allow to add those features to your application or API easily at a later date.  If you throw these exceptions directly, you loose that flexibility.

Like Joerg, I'm also confused by the intended purpose of the ContextedExceptionUtils.  Are you seeking to make it easier for people to write custom Contexted exceptions but not have to extend ContextedException to get the benefit?

      was (Author: dashmore):
    Thanks for the feedback and discussion.  Weather your writing an application or publishing an API, I'd recommend extending either ContextedException or ContextedRuntimeException as a first step and not throw these exceptions directly.

Down the road, you may need additional features, beyond what's provided in these exceptions, and the extension would allow to add those features to your application or API easily at a later date.  If you throw these exceptions directly, you loose that flexibility.

Like Joerg, I'm also confused by the intended purpose of the ContextedExceptionUtils.  Are you seeking to make it easier for people to write custom Contexted exceptions but have to extend ContextedException to get the benefit?
  
> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Derek C. Ashmore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703078#action_12703078 ] 

Derek C. Ashmore commented on LANG-497:
---------------------------------------

Hi Joerg,

I've made modifications along the lines we discussed.  I kept the original 'ExceptionContext' name as there is something in it that specifically pertains to exceptions.

When you get a chance, please take a gander and tell me if I missed the boat.  If I got it right or close to -- I'll enhance the unit tests to include the new DefaultExceptionContext class and make sure it meets the checkstyle tests.

Thanks for spending time on this.

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Derek C. Ashmore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741079#action_12741079 ] 

Derek C. Ashmore commented on LANG-497:
---------------------------------------

Thanks for the feedback and discussion.  Weather your writing an application or publishing an API, I'd recommend extending either ContextedException or ContextedRuntimeException as a first step and not throw these exceptions directly.

Down the road, you may need additional features, beyond what's provided in these exceptions, and the extension would allow to add those features to your application or API easily at a later date.  If you throw these exceptions directly, you loose that flexibility.

Like Joerg, I'm also confused by the intended purpose of the ContextedExceptionUtils.  Are you seeking to make it easier for people to write custom Contexted exceptions but have to extend ContextedException to get the benefit?

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702819#action_12702819 ] 

Joerg Schaible commented on LANG-497:
-------------------------------------

bq. May I suggest 'EmbeddedContext', or something like that?

Sounds good :)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Derek C. Ashmore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703378#action_12703378 ] 

Derek C. Ashmore commented on LANG-497:
---------------------------------------

Hi Joerg,

My apologies, my IDE puts those copyright notices in automatically.   I'll remove them, put in the appropriate header and fill out the remaining unit tests.  You'll see a resubmission from me with these items within 48 hrs.

Thanks for working with me on this.

Derek

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedException.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedExceptionTest.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContextTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Derek C. Ashmore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703493#action_12703493 ] 

Derek C. Ashmore commented on LANG-497:
---------------------------------------

Hi Joerg, 

I've replaced the copyright notices with ASF 2.0 license text.  I've made minor modifications to the javadoc and testcases to meet the checkstyle requirements and ensure test coverage.

I don't think you'll see any trouble with these, but feel free to update this JIRA with any problems/issues you have with this submission.  I'll be happy to field problems, issues, comments, or questions regarding this submision.

Thanks for taking the time to help with this.

Derek

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: DefaultExceptionContext.java
                ContextedRuntimeException.java
                ContextedException.java

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Derek C. Ashmore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702709#action_12702709 ] 

Derek C. Ashmore commented on LANG-497:
---------------------------------------

I like the idea of publishing an interface along with an implementation of it.

I also like the idea of providing the capability to retrieve the underlying context name/value pairs as
somebody might want to do something with that information besides use it in the error report.

Also, somebody might not like the reporting style provided in a particular implementation -- this would
give developers freedom to supply their own style with a custom implementation.

I'm happy to do the work to factor out an interface and a supporting implementation class.  Could we call it 
something else, though?  As you describe ExceptionContext, it really could be applied to other types 
of objects.  There is nothing in that interface that forces a developer to use it for exception processing.  
Having 'Exception' in the title really is a lie.  May I suggest 'EmbeddedContext', or something like that?

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Issue Comment Edited: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Matt Benson edited comment on LANG-497 at 8/8/09 7:37 AM:
----------------------------------------------------------

I'm guessing you typically do not create a new ContextedFooException subclass for every FooException you may have been accustomed to programming with, so have you seen no downside to publishing APIs that declare "throws ContextedException"?  I wonder, when this is added to [lang], if it might be appropriate to create a sandbox component (one utility class?  :| ) that could dynamically generate Contexted subclasses.  You'd need another interface to support this, though.  Then you could use APIs that are still familiar to developers but still provide context.  You could also include convenience code in this utility like:

(assume our interface is Contexted)
{code:title=ContextedExceptionUtils.java|borderStyle=solid}
public static ExceptionContext getExceptionContext(Exception e) {
  return e instanceof Contexted ? ((Contexted) e).getExceptionContext() : EMPTY_CONTEXT;
}

private static final ExceptionContext EMPTY_CONTEXT = new ExceptionContext() {

  public ExceptionContext addLabeledValue(String label, Serializable value) {
    throw new UnsupportedOperationException();
  }

  public Serializable getLabeledValue(String label) {
    return null;
  }

  public Set<String> getLabelSet() {
    return Collections.<String> emptySet();
  }

  public String getFormattedExceptionMessage(String baseMessage) {
    return baseMessage;
  }

};
{code}
WDYT?

      was (Author: mbenson):
    I'm guessing you typically do not create a new ContextedFooException subclass for every FooException you may have been accustomed to programming with, so have you seen no downside to publishing APIs that declare "throws ContextedException"?  I wonder, when this is added to [lang], if it might be appropriate to create a sandbox component (one utility class?  :| ) that could dynamically generate Contexted subclasses.  You'd need another interface to support this, though.  Then you could use APIs that are still familiar to developers but still provide context.  You could also include convenience code in this utility like:

(assume our interface is Contexted)

public static ExceptionContext getExceptionContext(Exception e) {
  return e instanceof Contexted ? ((Contexted) e).getExceptionContext() : EMPTY_CONTEXT;
}

private static final ExceptionContext EMPTY_CONTEXT = new ExceptionContext() {

  public ExceptionContext addLabeledValue(String label, Serializable value) {
    throw new UnsupportedOperationException();
  }

  public Serializable getLabeledValue(String label) {
    return null;
  }

  public Set<String> getLabelSet() {
    return Collections.<String> emptySet();
  }

  public String getFormattedExceptionMessage(String baseMessage) {
    return baseMessage;
  }

};

WDYT?
  
> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702678#action_12702678 ] 

Joerg Schaible commented on LANG-497:
-------------------------------------

Hi Derek,

it seems different people have the same needs :)

We did something similar in XStream with the [ErrorWriter|http://xstream.codehaus.org/javadoc/com/thoughtworks/xstream/converters/ErrorWriter.html]. While this name is really questionnable, it is nevertheless a fine thing to factor out the interesting methods into an interface that can be implemented by any Exception without the need to derive from a special one. What about an interface (e.g. ExceptionContext) with combined functionality:

{code:java}
interface ExceptionContext {
    ExceptionContext addLabeledValue(String, Serializable);
    Serializable getLabeledValue(String);
    Iterator<String> getLabels();
}
{code}

You might then expose ContextExceptionUtils as top level class (maybe now with a name like MemoryExceptionContext) also implementing this interface. Then you can use it in Contexted(Runtime)Exception a simple delegate - as everybody else can do also for other exceptions.

Opinions?


> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: DefaultExceptionContext.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedRuntimeException.java, DefaultExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Matt Benson commented on LANG-497:
----------------------------------

I was speaking from the perspective of writing familiar-seeming APIs while providing context.  Hence, the idea of being able to dynamically throw a contexted IOException, NullPointerException, etc., etc.  is that clearer?

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12741010#action_12741010 ] 

Henri Yandell commented on LANG-497:
------------------------------------

I like :)

+1.

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedExceptionTest.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedRuntimeException.java, DefaultExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: ContextedExceptionTest.java
                ContextedRuntimeException.java
                ContextedException.java

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedRuntimeExceptionTest.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedRuntimeException.java, DefaultExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedRuntimeException.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedExceptionTest.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703339#action_12703339 ] 

Joerg Schaible commented on LANG-497:
-------------------------------------

Hi Derek,

the implementation looks fine from my side and your modifications met what I had in mind.

However, I've recognized that most of the files have a copyright notice. Although it looks like a boilerplate template, we have to take this serious. As long as these copyrights are kept or your company holds any IP rights, we cannot add this code to our code base. If it is your code and you are in the position to relicense these files with an ASF 2.0 license, I kindly ask for a new submission with the appropriate license header.

Thanks,
Jörg

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedRuntimeException.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedRuntimeException.java, DefaultExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12740949#action_12740949 ] 

Joerg Schaible commented on LANG-497:
-------------------------------------

bq. I'm guessing you typically do not create a new ContextedFooException subclass for every FooException you may have been accustomed to programming with, so have you seen no downside to publishing APIs that declare "throws ContextedException"?

Well, that's exactly what we do in XStream. We derive a lot of exceptions from one root exception with this functionality. All of those are used somewhere in the marshalling/unmarshalling code i.e. they suite everywhere where you have a bigger context in a deeply nested, recursive application flow. The type of the exception still tells you what kind of problem happened (e.g. parser error, unresolved object reference, ...) and the context is completed with information that allows you to identify the appropriate location in your object graph or XML structure.

bq. I wonder, when this is added to [lang], if it might be appropriate to create a sandbox component (one utility class? :| ) that could dynamically generate Contexted subclasses. You'd need another interface to support this, though. Then you could use APIs that are still familiar to developers but still provide context.

Please try to rephrase, I am not getting what you try to tell me here.

bq. Then you could use APIs that are still familiar to developers but still provide context. You could also include convenience code in this utility like:

Well, why not ? ;-)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

Posted by "Derek C. Ashmore (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12738089#action_12738089 ] 

Derek C. Ashmore commented on LANG-497:
---------------------------------------

Hi Joerg,

When you get a chance, what's the next step in the proposal process?  I would be happy to contribute time and effort to further this cause.

Thanks, agains, for your help with this.

Derek

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: ExceptionContext.java

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: ContextedException.java

Version 2 -- April 27, 2009

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Commented: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Matt Benson commented on LANG-497:
----------------------------------

I'm guessing you typically do not create a new ContextedFooException subclass for every FooException you may have been accustomed to programming with, so have you seen no downside to publishing APIs that declare "throws ContextedException"?  I wonder, when this is added to [lang], if it might be appropriate to create a sandbox component (one utility class?  :| ) that could dynamically generate Contexted subclasses.  You'd need another interface to support this, though.  Then you could use APIs that are still familiar to developers but still provide context.  You could also include convenience code in this utility like:

(assume our interface is Contexted)

public static ExceptionContext getExceptionContext(Exception e) {
  return e instanceof Contexted ? ((Contexted) e).getExceptionContext() : EMPTY_CONTEXT;
}

private static final ExceptionContext EMPTY_CONTEXT = new ExceptionContext() {

  public ExceptionContext addLabeledValue(String label, Serializable value) {
    throw new UnsupportedOperationException();
  }

  public Serializable getLabeledValue(String label) {
    return null;
  }

  public Set<String> getLabelSet() {
    return Collections.<String> emptySet();
  }

  public String getFormattedExceptionMessage(String baseMessage) {
    return baseMessage;
  }

};

WDYT?

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedRuntimeException.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedExceptionTest.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContextTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Resolved: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Joerg Schaible resolved LANG-497.
---------------------------------

    Resolution: Fixed

I've committed this now (802566 & 802566). However, I changes one detail: The two exceptions implement now ExceptionContext. This allows to write

{code:java}
...
} catch(RuntimeException e) {
  if (e instanceof ExceptionContext) {
    // do/add something
  }
}
...
{code}

This also targets Matt's method in the ExceptionUtils. I've also added the EMPTY_CONTEXT to the ExceptionUtils.

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, DefaultExceptionContextTest.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: DefaultExceptionContextTest.java
                ContextedRuntimeExceptionTest.java
                ContextedExceptionTest.java

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedExceptionTest.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContextTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedException.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedExceptionTest.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: DefaultExceptionContext.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedExceptionTest.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContextTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: ExceptionContext.java
                DefaultExceptionContext.java
                ContextedRuntimeException.java

Version 2 -- April 27, 2009

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java, DefaultExceptionContext.java, ExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ExceptionContext.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedRuntimeException.java, DefaultExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment:     (was: ContextedException.java)

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedRuntimeException.java, DefaultExceptionContext.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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


[jira] Updated: (LANG-497) Addition of ContextedException and ContextedRuntimeException

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

Derek C. Ashmore updated LANG-497:
----------------------------------

    Attachment: ContextedRuntimeExceptionTest.java

> Addition of ContextedException and ContextedRuntimeException
> ------------------------------------------------------------
>
>                 Key: LANG-497
>                 URL: https://issues.apache.org/jira/browse/LANG-497
>             Project: Commons Lang
>          Issue Type: New Feature
>            Reporter: Derek C. Ashmore
>             Fix For: 3.0
>
>         Attachments: ContextedException.java, ContextedExceptionTest.java, ContextedRuntimeException.java, ContextedRuntimeExceptionTest.java
>
>
> This is a proposal for a feature addition.
> These additional exceptions (checked and unchecked versions) provide an easier and safer 
> way for developers to provide context when generating checked exceptions.  Often, 
> additional information, besides what's embedded in the exception cause, is needed 
> for developers to debug and correct a bug.  Often, this additional information can 
> reduce the time it takes to replicate and fix a bug.
> ContextedException are easier as developers don't need to be concerned 
> with formatting the exception message to include additional information 
> with the exception.  Additional information is automatically included
> in the message and printed stack trace.  This often thins out exception
> handling code.
> ContextedException is safer as the additional code needed to embed additional
> information in a normal exception tends to be tested less and is more vulnerable
> to errors such as null pointer exceptions.
> An unchecked version of this exception is provided by ContextedRuntimeException.
> To use this class write code as follows:
>  
>   try {
>   ...
>   } catch (Throwable e) {
>     throw new ContextedException("Error posting account transaction", e)
>          .addLabeledValue("accountNumber", accountNumber)
>          .addLabeledValue("amountPosted", amountPosted)
>          .addLabeledValue("previousBalance", previousBalance)
>   }
> }
> The value of the context information is automatically included in the exception message and
> when the stack trace is printed in the log.
> My motivation for contributing is that I've previous versions of this running
> at four clients now -- I'm tiered of copying this from client to client.
> I've attached the two exceptions themselves along with working test cases. Every effort has been made
> to adhere to your existing style, conventions, and standards.  No changes are needed for any
> existing files.
> I ran the site generation -- These additions pass your checkstyle reports.
> To streamline the committers time, I'll be happy to make any needed changes to to get this
> into 3.0.
> I know you're busy -- thanks for taking the time to at least review this proposal.

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