[slf4j-dev] [Bug 12] New: NullPointerException in SLF4JLog.java (jcl104-over-slf4j.jar)

bugzilla-daemon at gil.qos.ch bugzilla-daemon at gil.qos.ch
Thu Jan 5 07:10:10 CET 2006


http://bugzilla.slf4j.org/show_bug.cgi?id=12

           Summary: NullPointerException in SLF4JLog.java (jcl104-over-
                    slf4j.jar)
           Product: SLF4J
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P5
         Component: Implementations
        AssignedTo: dev at slf4j.org
        ReportedBy: kenneth at netinfinium.com


Apache commons-logging replacement (jcl104-over-slf4j.jar)
throws a NPE on line 97 and others lines that rely on message parameter
to be non-null.

  public void debug(Object message) {
    logger.debug(message.toString());
  }

NPE occurs when the object passed into the logger is null.
Some struts tag libraries seems to be passing in null.

Suggest test the following change

  private String messageString (Object message) {
    return message==null?message.toString():"";
  }

  public void debug(Object message) {
    logger.debug(messageString(message));
  }



Without this, I cannot fully replace commons-logging out from my app.

-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the slf4j-dev mailing list