Merge "Bug 451 - Fix netconf exception handling"
authorTony Tkacik <ttkacik@cisco.com>
Fri, 25 Apr 2014 08:56:45 +0000 (08:56 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 25 Apr 2014 08:56:45 +0000 (08:56 +0000)
1  2 
opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java

index 3b280795fa94b87db8f4490273b8e2a4522e77ce,8a40bee994788c9931649e58b9d98e28df34165e..f8f73fc8e5296b9534e0759bc43f24bbf493521e
@@@ -8,10 -8,15 +8,15 @@@
  
  package org.opendaylight.controller.netconf.client;
  
- import javax.xml.xpath.XPathConstants;
- import javax.xml.xpath.XPathExpression;
+ import io.netty.channel.Channel;
+ import io.netty.channel.ChannelFuture;
+ import io.netty.channel.ChannelFutureListener;
+ import io.netty.channel.ChannelHandlerContext;
+ import io.netty.channel.ChannelInboundHandlerAdapter;
+ import io.netty.util.Timer;
+ import io.netty.util.concurrent.Promise;
  import org.opendaylight.controller.netconf.api.NetconfClientSessionPreferences;
+ import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
  import org.opendaylight.controller.netconf.api.NetconfMessage;
  import org.opendaylight.controller.netconf.util.AbstractChannelInitializer;
  import org.opendaylight.controller.netconf.util.AbstractNetconfSessionNegotiator;
@@@ -26,13 -31,8 +31,8 @@@ import org.w3c.dom.Document
  import org.w3c.dom.Node;
  import org.w3c.dom.NodeList;
  
- import io.netty.channel.Channel;
- import io.netty.channel.ChannelFuture;
- import io.netty.channel.ChannelFutureListener;
- import io.netty.channel.ChannelHandlerContext;
- import io.netty.channel.ChannelInboundHandlerAdapter;
- import io.netty.util.Timer;
- import io.netty.util.concurrent.Promise;
+ import javax.xml.xpath.XPathConstants;
+ import javax.xml.xpath.XPathExpression;
  
  public class NetconfClientSessionNegotiator extends
          AbstractNetconfSessionNegotiator<NetconfClientSessionPreferences, NetconfClientSession, NetconfClientSessionListener>
      }
  
      @Override
-     protected void handleMessage(NetconfHelloMessage netconfMessage) {
+     protected void handleMessage(NetconfHelloMessage netconfMessage) throws NetconfDocumentedException {
          NetconfClientSession session = super.getSessionForHelloMessage(netconfMessage);
  
          if (shouldUseExi(netconfMessage.getDocument())){
 -            logger.info("Netconf session: {} should use exi.", session);
 +            logger.debug("Netconf session: {} should use exi.", session);
              tryToStartExi(session);
          } else {
 -            logger.info("Netconf session {} isn't capable using exi.", session);
 +            logger.debug("Netconf session {} isn't capable using exi.", session);
              negotiationSuccessful(session);
          }
      }
      }
  
      @Override
-     protected NetconfClientSession getSession(NetconfClientSessionListener sessionListener, Channel channel, NetconfHelloMessage message) {
+     protected NetconfClientSession getSession(NetconfClientSessionListener sessionListener, Channel channel, NetconfHelloMessage message) throws NetconfDocumentedException {
          return new NetconfClientSession(sessionListener, channel, extractSessionId(message.getDocument()),
                  NetconfMessageUtil.extractCapabilitiesFromHello(message.getDocument()));
      }