From 6f0bcdc18a8b0060c9842497045a9358f0920957 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 20 Apr 2015 18:44:48 +1200 Subject: Hide failed matches by default --- src/org/traccar/DetectorHandler.java | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/org/traccar/DetectorHandler.java b/src/org/traccar/DetectorHandler.java index 0f94235c0..d764412e5 100644 --- a/src/org/traccar/DetectorHandler.java +++ b/src/org/traccar/DetectorHandler.java @@ -18,14 +18,8 @@ package org.traccar; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.*; import org.jboss.netty.handler.codec.frame.FrameDecoder; -import org.jboss.netty.handler.codec.oneone.OneToOneDecoder; import org.jboss.netty.handler.codec.string.StringDecoder; -import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler; -import org.jboss.netty.handler.timeout.IdleStateEvent; -import org.traccar.database.DataManager; -import org.traccar.helper.ChannelBufferTools; import org.traccar.helper.Log; -import org.traccar.model.Position; import java.lang.reflect.Method; import java.net.SocketAddress; @@ -34,12 +28,14 @@ import java.util.List; public class DetectorHandler extends SimpleChannelHandler { private List serverList; + + private boolean showFailed; DetectorHandler(List serverList) { this.serverList = serverList; } - public static void checkPipeline(String protocol, ChannelPipeline pipeline, ChannelBuffer buf) throws Exception { + public void checkPipeline(String protocol, ChannelPipeline pipeline, ChannelBuffer buf) throws Exception { Object tmp = buf.duplicate(); // Frame decoder @@ -88,10 +84,8 @@ public class DetectorHandler extends SimpleChannelHandler { if (tmp != null) { Log.info("Protocol " + protocol + " possible match"); - System.out.println("Protocol " + protocol + " possible match"); - } else { + } else if (showFailed) { Log.info("Protocol " + protocol + " no match"); - System.out.println("Protocol " + protocol + " no match"); } } @@ -107,8 +101,9 @@ public class DetectorHandler extends SimpleChannelHandler { checkPipeline(server.getProtocol(), server.getPipelineFactory().getPipeline(), buf); } } catch(Exception error) { - Log.info("Protocol " + server.getProtocol() + " error"); - System.out.println("Protocol " + server.getProtocol() + " error"); + if (showFailed) { + Log.info("Protocol " + server.getProtocol() + " error"); + } } } } -- cgit v1.2.3