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

           Summary: NullpointerException
           Product: SLF4J
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Core API
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


Logger logger = LoggerFactory.getLogger("com.mycompany");

String[] parameters = null;
logger.debug("Parameters are {}", parameters);

will throw a NullPointer exception as follows : 

Exception in thread "main" java.lang.NullPointerException
        at
org.slf4j.helpers.MessageFormatter.arrayFormat(MessageFormatter.java:136)
        at org.slf4j.impl.Log4jLoggerAdapter.debug(Log4jLoggerAdapter.java:223)

Obviously the compiler binds the debug method to : logger.debug(format, new
Object[])

and to get around this we have to force the other method by using a typecast :
 String[] parameters = null;
 logger.debug("Parameters are {}", (Object)parameters);

Is there some better way around this ambiguity?


-- 
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.
_______________________________________________
dev mailing list
[email protected]
http://www.slf4j.org/mailman/listinfo/dev

Reply via email to