theigl opened a new issue, #2152: URL: https://github.com/apache/fury/issues/2152
### Search before asking - [x] I had searched in the [issues](https://github.com/apache/fury/issues) and found no similar issues. ### Version 0.10.1 ### Component(s) Java ### Minimal reproduce step I can't reproduce this at the moment because it happened on one of our test environments, but the stacktrace is quite clear. ### What did you expect to see? Logging an error should log the error instead of throwing an exception. ### What did you see instead? ``` java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1 at org.apache.fury.logging.FuryLogger.log(FuryLogger.java:153) at org.apache.fury.logging.FuryLogger.error(FuryLogger.java:133) at org.apache.fury.pool.ThreadPoolFury.execute(ThreadPoolFury.java:84) at org.apache.fury.pool.ThreadPoolFury.deserialize(ThreadPoolFury.java:138) ``` `ThreadPoolFury` has the following code: ```java } catch (Exception e) { LOG.error(e.getMessage(), e); throw new RuntimeException(e); } ``` In `FuryLogger` this method is called: ```java public void error(String msg, Throwable t) { if (LoggerFactory.getLogLevel() >= ERROR_LEVEL) { log(ERROR_LEVEL, msg, new Object[] {t}, true); } } ``` It passes the throwable as the sole `args` to the log function. Now if the exception message contains more than one placeholder like `{}`, the `ArrayIndexOutOfBoundsException` is thrown here: ```java char c = msg.charAt(i); if (c == '{' && msg.charAt(i + 1) == '}') { builder.append(args[count++]); i++; } else { builder.append(c); } ``` In my opinion, the logger should *not* attempt to interpolate random placeholders in messages of thrown exceptions. ### Anything Else? _No response_ ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
