issue #223: check if args is null in Ln.x(String format, Object... args)

Should be merged ASAP
No, if args is null it will print

"display string: null"


see the 2 tests I added for expected result.


2014-09-10 12:12 GMT-04:00 Mike Burton <notifications@github.com>:

> In roboguice/src/main/java/roboguice/util/LnImpl.java:
>
> > @@ -225,6 +223,18 @@ protected String getTag() {
> >
> >          return tag;
> >      }
> > +
> > +    //protected for testing.
> > +    protected String formatArgs(final String s, Object... args) {
> > +        //this is a bit tricky : if args is null, it is passed to formatting
> > +        //(and yes this can still break depending on conversion of the formatter, see String.format)
> > +        //else if there is no args, we return the message as-is, otherwise we pass args to formatting normally.
> > +        if( args != null && args.length == 0 ) {
> > +            return s;
>
> For Ln.i("display string: %s", null) it seems like we would print out:
>
> "display string: %s"
>
> in the logs. This seems confusing. What I've seen other systems do is
> print out "(null)", eg:
>
> display string: (null)
>
> This seems like it would be more clear to the reader of the log.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/roboguice/roboguice/pull/224/files#r17370918>.
>