Commons Logging
  1. Commons Logging
  2. LOGGING-90

[logging] org.apache.commons.logging.impl.LogFactoryImpl does not provide enough information on an InvocationTargetException in the newInstance() method.

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0.3
    • Fix Version/s: 1.0.4
    • Labels:
      None
    • Environment:

      Operating System: Solaris
      Platform: Sun

      Description

      Using version 1-0-3 I was getting an
      org.apache.commons.logging.LogConfigurationException while attempting to
      retrieve a Log instance from the LogFactory. This LogConfigurationException was
      wrapping an InvocationTargetException from the newInstance() method in
      org.apache.commons.logging.impl.LogFactoryImpl. An InvocationTargetException
      does not provide any information regarding the cause of the exception in its'
      stack trace so I had a difficult time determining the true cause of the error
      (A ClassNotFoundException).

      I would suggest adding a special case to the existing catch clause in
      newInstance() to catch an InvocationTargetException and throw a new
      LogConfigurationExeption constructed with the cause (not the
      InvocationTargetException object).

      The following would be the new catch clause:

      } catch (InvocationTargetException e)

      { throw new LogConfigurationException(e.getCause()); } catch (Throwable t) { throw new LogConfigurationException(t); }

      The modified newInstance() method would look like this:

      protected Log newInstance(String name) throws LogConfigurationException {

      Log instance = null;
      try {
      Object params[] = new Object[1];
      params[0] = name;
      instance = (Log) getLogConstructor().newInstance(params);
      if (logMethod != null) { params[0] = this; logMethod.invoke(instance, params); }
      return (instance);
      } catch (InvocationTargetException e) { throw new LogConfigurationException(e.getCause()); }

      catch (Throwable t)

      { throw new LogConfigurationException(t); }

      }

        Activity

        Brian Curnow created issue -
        Hide
        Dennis Lundberg added a comment -

        Since InvocationTargetException.getCause() was introduced in JDK 1.4 we should
        use InvocationTargetException.getTargetException() instead to retain
        compatibility with earlier JDKs.

        Show
        Dennis Lundberg added a comment - Since InvocationTargetException.getCause() was introduced in JDK 1.4 we should use InvocationTargetException.getTargetException() instead to retain compatibility with earlier JDKs.
        Hide
        Craig McClanahan added a comment -

        Fixed in nightly build 20040307 (and the upcoming 1.0.4 release).

        Show
        Craig McClanahan added a comment - Fixed in nightly build 20040307 (and the upcoming 1.0.4 release).
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 26598 12341235
        Henri Yandell made changes -
        Affects Version/s unspecified [ 12311647 ]
        Component/s Logging [ 12311124 ]
        Project Commons [ 12310458 ] Commons Logging [ 12310484 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Key COM-1084 LOGGING-90
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Dennis Lundberg made changes -
        Affects Version/s 1.0.4 [ 12311713 ]
        Dennis Lundberg made changes -
        Fix Version/s 1.0.4 [ 12311713 ]
        Affects Version/s 1.0.3 [ 12311839 ]
        Affects Version/s 1.0.4 [ 12311713 ]
        Joerg Schaible made changes -
        Comment [ I will be out of the office until Monday, January 4th

        If this is an emergency, please contact Becky Borek, or APPS Tools on-call.


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

        Dennis Lundberg updated LOGGING-90:
        -----------------------------------

            Affects Version/s: 1.0.4


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


        ]
        Joerg Schaible made changes -
        Comment [ I will be out of the office until Monday, January 4th

        If this is an emergency, please contact Becky Borek, or APPS Tools on-call.


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

        Dennis Lundberg updated LOGGING-90:
        -----------------------------------

            Affects Version/s: (was: 1.0.4)
                               1.0.3
                Fix Version/s: 1.0.4


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


        ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Resolved Resolved Closed Closed
        1429d 11h 42m 1 Henri Yandell 02/Jan/08 07:48

          People

          • Assignee:
            Unassigned
            Reporter:
            Brian Curnow
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development