Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
eventadmin-1.4.4
-
Patch
Description
If a log event contains an empty message, it raises an NPE in
https://github.com/apache/felix/blob/trunk/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java#L180
As a result the Karaf container will raise
'org.apache.felix.eventadmin.impl.adapter.LogEventAdapter$1@XXXXXX' is removed as a LogListener, since it threw an exception.
to stderr and remove this event admin instance.
An empty log message may sound like a stupid thing to do but may happen as a result of e.g. running a Camel route like this one deployed in a Karaf container:
public class LogExceptionRoute extends RouteBuilder { @Override public void configure() { onException(Throwable.class) .handled(true) .log(LoggingLevel.ERROR, "${exception.message}"); from("jetty:http://0.0.0.0:8005") .throwException(new Exception()); } }
The route raises an empty exception (i.e. no detail message) which then get logged in the onException() policy, causing the error above.