diff --git a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/handlers/ExceptionLoggingHandler.java b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/handlers/ExceptionLoggingHandler.java index 8bd4b8c1ad39..4d5eb643e563 100644 --- a/enterprise/core-edge/src/main/java/org/neo4j/coreedge/handlers/ExceptionLoggingHandler.java +++ b/enterprise/core-edge/src/main/java/org/neo4j/coreedge/handlers/ExceptionLoggingHandler.java @@ -38,14 +38,13 @@ public ExceptionLoggingHandler( Log log ) @Override public void exceptionCaught( ChannelHandlerContext ctx, Throwable cause ) throws Exception { - if ( ctx != null ) - { - log.error( format( "Failed to process message on channel %s.", ctx.channel() ), cause ); - } - else - { - log.error( format( "Failed to process message on a null channel." ), cause ); - } - ctx.fireExceptionCaught(cause); + log.error( message( ctx ), cause ); + ctx.fireExceptionCaught( cause ); + } + + private String message( ChannelHandlerContext ctx ) + { + return ctx != null ? format( "Failed to process message on channel %s.", ctx.channel() ) + : "Failed to process message on a null channel."; } }