Added more ignorable files to .gitignore
[ovsdb.git] / ovsdb / src / main / java / org / opendaylight / ovsdb / lib / jsonrpc / ExceptionHandler.java
1 /*
2  * Copyright (C) 2013 EBay Software Foundation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Authors : Ashwin Raveendran
9  */
10 package org.opendaylight.ovsdb.lib.jsonrpc;
11
12 import io.netty.channel.ChannelHandlerAdapter;
13 import io.netty.channel.ChannelHandlerContext;
14 import io.netty.handler.codec.TooLongFrameException;
15
16 public class ExceptionHandler extends ChannelHandlerAdapter {
17
18     @Override
19     public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
20         if ((cause instanceof InvalidEncodingException)
21                 || (cause instanceof TooLongFrameException)) {
22
23             ctx.channel().disconnect();
24         }
25     }
26 }