X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2Fssh%2Fvirtualsocket%2FChannelInputStream.java;h=b8f13699ba06d49876c6002fc27f297eceded04c;hp=07c81b0ccb7127aad1a5ffc14a3e6d6412dd1446;hb=1ded3b4311dc761d39c132f9f38fcceb761ea997;hpb=7d2f3fcb2fb4192434900449baf527d7590887fc diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java index 07c81b0ccb..b8f13699ba 100644 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java +++ b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/ssh/virtualsocket/ChannelInputStream.java @@ -12,7 +12,6 @@ import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandler; - import java.io.IOException; import java.io.InputStream; @@ -39,7 +38,9 @@ public class ChannelInputStream extends InputStream implements ChannelInboundHan b[off] = (byte)c; - if(this.bb.readableBytes() == 0) return bytesRead; + if(this.bb.readableBytes() == 0) { + return bytesRead; + } int ltr = len-1; ltr = (ltr <= bb.readableBytes()) ? ltr : bb.readableBytes(); @@ -57,7 +58,8 @@ public class ChannelInputStream extends InputStream implements ChannelInboundHan try { lock.wait(); } catch (InterruptedException e) { - throw new RuntimeException(e); + Thread.currentThread().interrupt(); + throw new IllegalStateException(e); } } return this.bb.readByte() & 0xFF; @@ -71,28 +73,23 @@ public class ChannelInputStream extends InputStream implements ChannelInboundHan } } - public void channelRegistered(ChannelHandlerContext ctx) - throws Exception { + public void channelRegistered(ChannelHandlerContext ctx) { ctx.fireChannelRegistered(); } - public void channelUnregistered(ChannelHandlerContext ctx) - throws Exception { + public void channelUnregistered(ChannelHandlerContext ctx) { ctx.fireChannelUnregistered(); } - public void channelActive(ChannelHandlerContext ctx) - throws Exception { + public void channelActive(ChannelHandlerContext ctx) { ctx.fireChannelActive(); } - public void channelInactive(ChannelHandlerContext ctx) - throws Exception { + public void channelInactive(ChannelHandlerContext ctx) { ctx.fireChannelInactive(); } - public void channelRead(ChannelHandlerContext ctx, Object o) - throws Exception { + public void channelRead(ChannelHandlerContext ctx, Object o) { synchronized(lock) { this.bb.discardReadBytes(); this.bb.writeBytes((ByteBuf) o); @@ -100,31 +97,25 @@ public class ChannelInputStream extends InputStream implements ChannelInboundHan } } - public void channelReadComplete(ChannelHandlerContext ctx) - throws Exception { + public void channelReadComplete(ChannelHandlerContext ctx) { ctx.fireChannelReadComplete(); } - public void userEventTriggered(ChannelHandlerContext ctx, Object o) - throws Exception { + public void userEventTriggered(ChannelHandlerContext ctx, Object o) { ctx.fireUserEventTriggered(o); } - public void channelWritabilityChanged(ChannelHandlerContext ctx) - throws Exception { + public void channelWritabilityChanged(ChannelHandlerContext ctx) { ctx.fireChannelWritabilityChanged(); } - public void handlerAdded(ChannelHandlerContext ctx) - throws Exception { + public void handlerAdded(ChannelHandlerContext ctx) { } - public void handlerRemoved(ChannelHandlerContext ctx) - throws Exception { + public void handlerRemoved(ChannelHandlerContext ctx) { } - public void exceptionCaught(ChannelHandlerContext ctx, Throwable throwable) - throws Exception { + public void exceptionCaught(ChannelHandlerContext ctx, Throwable throwable) { ctx.fireExceptionCaught(throwable); } }