diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-04 16:41:42 -0800 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-04 16:41:42 -0800 |
commit | a0bf6407c3e8b8a4dc3648d70dbdac0bd99cb852 (patch) | |
tree | d97d7272e1781e323705786cb9a31acdf099881a /src/org/traccar | |
parent | d7f6c53fd88635885914013649b6807ec53227bf (diff) | |
download | traccar-server-a0bf6407c3e8b8a4dc3648d70dbdac0bd99cb852.tar.gz traccar-server-a0bf6407c3e8b8a4dc3648d70dbdac0bd99cb852.tar.bz2 traccar-server-a0bf6407c3e8b8a4dc3648d70dbdac0bd99cb852.zip |
Log original exception
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/MainEventHandler.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/org/traccar/MainEventHandler.java b/src/org/traccar/MainEventHandler.java index 3032646c1..8ca73dd77 100644 --- a/src/org/traccar/MainEventHandler.java +++ b/src/org/traccar/MainEventHandler.java @@ -1,5 +1,5 @@ /* - * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org) + * Copyright 2012 - 2019 Anton Tananaev (anton@traccar.org) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter { } @Override - public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof Position) { Position position = (Position) msg; @@ -104,13 +104,16 @@ public class MainEventHandler extends ChannelInboundHandlerAdapter { } @Override - public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + while (cause.getCause() != null && cause.getCause() != cause) { + cause = cause.getCause(); + } LOGGER.warn(formatChannel(ctx.channel()) + " error", cause); closeChannel(ctx.channel()); } @Override - public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { + public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { if (evt instanceof IdleStateEvent) { LOGGER.info(formatChannel(ctx.channel()) + " timed out"); closeChannel(ctx.channel()); |