Uploaded image for project: 'Commons BeanUtils'
  1. Commons BeanUtils
  2. BEANUTILS-266

Log or throw exception in PropertyUtilsBean, not both

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.7.0
    • 1.8.0
    • Bean / Property Utils
    • None
    • all

    Description

      This commit (related to BEANUTILS-224):
      http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/PropertyUtilsBean.java?view=diff&r1=471989&r2=471990

      improved the error message for illegal arguments, but also introduced a log message for that same exception. Best practice is to log or throw but not both, since this often results in the error being logged multiple times - when it was created and when the exception is caught. In addition this is logging the problem as an error when it may in fact be handled by the caller, so at worst its a debug-level message.

      I switched up to 1.7 recently and this has been filling up my logs. I know I can work around it by disabling logging for this component but the existence of this log message seems like an oversight.

      Attachments

        Activity

          People

            niallp Niall Pemberton
            bazzargh Brian Ewins
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: