Camel accepts PRs. I think we should be able to do it. ICLAs still apply, though.
On 2 September 2014 12:12, Ralph Goers <ralph.go...@dslextreme.com> wrote: > That sounds reasonable. > > Ralph > > > On Sep 2, 2014, at 9:41 AM, Yogesh Rao <yog...@gmail.com> wrote: > > > Hi Ralph, > > > > IMO new Object[0] as a param value is valid and should behave similar to > a > > call to the method without param i.e. logger.error("Hello World {} in {} > "); > > > > In the above context adding a conditional check params.length > 0 with > then > > the "if" @ line 157 wouldn't end up throwing the error and print the > given > > message > > > > Regards, > > -Yogesh > > > > > > On Tue, Sep 2, 2014 at 9:45 PM, Ralph Goers <ralph.go...@dslextreme.com> > > wrote: > > > >> What will you do instead of throwing an ArrayIndexOutOfBoundsException? > >> This is obviously a user error. It would be misleading (but maybe > >> acceptable) to substitute “null” for the placeholders, but just > throwing a > >> different exception probably isn’t worth the trouble. > >> > >> Ralph > >> > >> On Sep 2, 2014, at 7:24 AM, Yogesh Rao <yog...@gmail.com> wrote: > >> > >>> Hi, > >>> > >>> There seems to be an issue with SimpleLogger implementation provided by > >>> log4j2. The issue seems to be in the new improved API supporting > >>> placeholders and var args when called with an Object Array of size 0. > >>> > >>> for e.g logger.error("Hello World {} in {} " , new Object[0]); > >>> > >>> A statement above results in an error as shown below > >>> > >>> ERROR StatusLogger Unable to locate a logging implementation, using > >>> SimpleLogger > >>> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1 > >>> at > >>> > >> > org.apache.logging.log4j.simple.SimpleLogger.logMessage(SimpleLogger.java:157) > >>> at > >>> > >> > org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1347) > >>> at > >>> > >> > org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1312) > >>> at > >>> > >> > org.apache.logging.log4j.spi.AbstractLogger.error(AbstractLogger.java:539) > >>> at TestError.main(TestError.java:21) > >>> > >>> > >>> > >>> I managed to look at the code as well and it looks like a condition to > >>> check of the var arg param array size is missing in SimpleLogger > >>> > >>> 155 final Object[] params = msg.getParameters(); > >>> 156 Throwable t; > >>> 157 if (throwable == null && params != null && > >>> params[params.length - 1] instanceof Throwable) { > >>> 158 t = (Throwable) params[params.length - 1]; > >>> 159 } else { > >>> 160 t = throwable; > >>> 161 } > >>> 162 if (t != null) { > >>> 163 sb.append(SPACE); > >>> 164 final ByteArrayOutputStream baos = new > >>> ByteArrayOutputStream(); > >>> 165 t.printStackTrace(new PrintStream(baos)); > >>> 166 sb.append(baos.toString()); > >>> 167 } > >>> 168 stream.println(sb.toString()); > >>> > >>> > >>> I can raise a JIRA issue and provide a fix with failing unit testcase. > >> Let > >>> me know if i can proceed ahead on this. > >>> > >>> Details of the environment are :- > >>> Version used > >>> > >>> 1. JDK - Oracle JDK version 1.7 > >>> 2. Log4j2 API - 2.0.1 > >>> > >>> > >>> To reproduce following java class can be used : > >>> > >>> TestError.java > >>> ------------------------ > >>> > >>> import org.apache.logging.log4j.LogManager; > >>> import org.apache.logging.log4j.Logger; > >>> > >>> > >>> > >>> public class TestError { > >>> > >>> private static final Logger logger = LogManager.getLogger("TestError"); > >>> /** > >>> * @param args > >>> */ > >>> public static void main(String[] args) { > >>> Object[] arr = null; > >>> logger.error("Hello World {} in {} " , new Object[0]); > >>> > >>> } > >>> > >>> } > >>> > >>> Jars in Classpath > >>> -------------------------- > >>> Log4j2 API - 2.0.1 > >>> > >>> > >>> Regards, > >>> -Yogesh > >> > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > >> For additional commands, e-mail: log4j-user-h...@logging.apache.org > >> > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org > For additional commands, e-mail: log4j-user-h...@logging.apache.org > > -- Matt Sicker <boa...@gmail.com>