Commons Logging
  1. Commons Logging
  2. LOGGING-42

[logging] setUpHandlers leaves handlers null pointer

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.4
    • Fix Version/s: 1.1.0
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      These errors occur because the "handler" field is null -

      [...]
      [java] There were 3 errors:
      [java] 1)
      testSerializable(org.apache.commons.logging.jdk14.CustomConfigTestCase)java.lang.NullPointerException
      [java] at
      org.apache.commons.logging.jdk14.CustomConfigTestCase.checkLogRecords
      (CustomConfigTestCase.java:215)
      [java] at
      org.apache.commons.logging.jdk14.CustomConfigTestCase.testExceptionMessages
      (CustomConfigTestCase.java:139)
      [java] at
      org.apache.commons.logging.jdk14.CustomConfigTestCase.testSerializable
      (CustomConfigTestCase.java:186)
      [java] at java.lang.reflect.Method.invoke0 (Method.java)
      [java] at java.lang.reflect.Method.invoke (Method.java:255)
      [...]

      The "handler" field is probably null due to an error in gnu classpath

      Anyway, a ClassCastException in setUpHandlers is probably more helpful than
      NullPointerExceptions in checkLogRecords -
      http://www.sfu.ca/~jdbates/tmp/commons-logging/patch

      Thanks for your work on these terrific tools!

      Jack

        Activity

        Hide
        Simon Kitching added a comment -

        Created an attachment (id=15120)
        patch to jdk14 test case to handle incorrect handler setup

        Here's an alternative solution to your problem (I hope). I've committed this
        patch as subversion revision 177867. If you have any issues with this, please
        let me know. Otherwise I will close this bug report in about a week's time.

        Regards, Simon

        Show
        Simon Kitching added a comment - Created an attachment (id=15120) patch to jdk14 test case to handle incorrect handler setup Here's an alternative solution to your problem (I hope). I've committed this patch as subversion revision 177867. If you have any issues with this, please let me know. Otherwise I will close this bug report in about a week's time. Regards, Simon
        Hide
        ms419 added a comment -

        (In reply to comment #1)
        > Here's an alternative solution to your problem (I hope)

        Sweet - with your patch I get this much improved error message -

        [...]
        [echo] Custom Configuration (JDK 1.4 Auto-Recognized)
        [java] .F.F.F.F.F.F.F
        [java] Time: 0.155
        [java] There were 7 failures:
        [java] 1)
        testExceptionMessages(org.apache.commons.logging.jdk14.CustomConfigTestCase)junit.framework.As
        sertionFailedError: Unexpected number of handlers for JDK14 logging expected:<1> but was:<0>
        [java] at org.apache.commons.logging.jdk14.CustomConfigTestCase.setUpHandlers
        (CustomConfigTestCase.java:293)
        [java] at org.apache.commons.logging.jdk14.CustomConfigTestCase.setUp
        (CustomConfigTestCase.java:108)
        [java] at java.lang.VirtualMachine.invokeMain (VirtualMachine.java)
        [java] at java.lang.VirtualMachine.main (VirtualMachine.java:108)
        [...]

        Your solution was far better than mine - many thanks!

        Jack

        Show
        ms419 added a comment - (In reply to comment #1) > Here's an alternative solution to your problem (I hope) Sweet - with your patch I get this much improved error message - [...] [echo] Custom Configuration (JDK 1.4 Auto-Recognized) [java] .F.F.F.F.F.F.F [java] Time: 0.155 [java] There were 7 failures: [java] 1) testExceptionMessages(org.apache.commons.logging.jdk14.CustomConfigTestCase)junit.framework.As sertionFailedError: Unexpected number of handlers for JDK14 logging expected:<1> but was:<0> [java] at org.apache.commons.logging.jdk14.CustomConfigTestCase.setUpHandlers (CustomConfigTestCase.java:293) [java] at org.apache.commons.logging.jdk14.CustomConfigTestCase.setUp (CustomConfigTestCase.java:108) [java] at java.lang.VirtualMachine.invokeMain (VirtualMachine.java) [java] at java.lang.VirtualMachine.main (VirtualMachine.java:108) [...] Your solution was far better than mine - many thanks! Jack

          People

          • Assignee:
            Simon Kitching
            Reporter:
            ms419
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development