Commons Logging
  1. Commons Logging
  2. LOGGING-33

getClassLoader() returns null at a critical point under certain conditions

    Details

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

      Operating System: All
      Platform: Macintosh

      Description

      launching jakarta-tomcat 5.0.28 using the JWS (java wrapper service) via the
      Bootstrap class leads to a critical null pointer exception which points to code
      in LogFactoryImpl.java which expects this.getClass().getClassLoader() to return
      a value that's not null. The javadocs for Class state that null can be returned
      in some implementations if the class was loaded by the bootstrap classloader. I
      have a patch file but am not sure how to submit it as an attachment so here it
      is below:

      Index: LogFactoryImpl.java
      ===================================================================
      RCS file:
      /home/cvspublic/jakarta-commons/logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v
      retrieving revision 1.33
      diff -u -u -r1.33 LogFactoryImpl.java
      — LogFactoryImpl.java 6 Mar 2004 21:52:59 -0000 1.33
      +++ LogFactoryImpl.java 13 Oct 2004 20:54:02 -0000
      @@ -371,8 +371,12 @@
      Class logClass = null;
      Class logInterface = null;
      try {

      • logInterface = this.getClass().getClassLoader().loadClass
      • (LOG_INTERFACE);
        + ClassLoader cl = this.getClass().getClassLoader();
        + // handle the case if getClassLoader() returns null
        + // It may mean this class was loaded from the bootstrap classloader
        + logInterface = (cl == null) ? loadClass(LOG_INTERFACE) :
        + cl.loadClass(LOG_INTERFACE);
        +
        logClass = loadClass(logClassName);
        if (logClass == null) {
        throw new LogConfigurationException

        Activity

        David Ferrero created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 31710 12341804
        Henri Yandell made changes -
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Project Commons [ 12310458 ] Commons Logging [ 12310484 ]
        Key COM-1652 LOGGING-33
        Component/s Logging [ 12311124 ]
        Affects Version/s 1.0.4 [ 12311678 ]
        Henri Yandell made changes -
        Affects Version/s 1.0.4 [ 12311713 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Dennis Lundberg made changes -
        Fix Version/s 1.1.0 [ 12311848 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            David Ferrero
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development