List of usage examples for io.netty.handler.codec DecoderException DecoderException
public DecoderException(String message, Throwable cause)
From source file:cloudfoundry.norouter.f5.dropsonde.LineEventDecoder.java
License:Open Source License
@Override protected void decode(ChannelHandlerContext context, ByteBuf buffer, List<Object> out) throws Exception { buffer.markReaderIndex();//from w w w . java 2 s . c o m try { final String command = nextString(buffer); // Extract event type switch (command) { case "LOG": decodeLogEvent(context, buffer, out); break; default: throw new IllegalStateException("Unknown command " + command); } } catch (Exception e) { buffer.resetReaderIndex(); throw new DecoderException("Invalid line event: " + buffer.toString(StandardCharsets.UTF_8), e); } }