X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FNetconfClientSessionNegotiator.java;h=3c2e814d899aea8c170795106b786e26063b6871;hp=3340dde883f09cfb077c6c1dcc6b6ea1b0ca8592;hb=950be361f30f0dc9df109c1c649deb92d9cebb05;hpb=38dbf4451a20bee38ccb5a9c685dcf9fa9d6fb33 diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java index 3340dde883..3c2e814d89 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java @@ -8,11 +8,17 @@ package org.opendaylight.controller.netconf.client; -import com.google.common.base.Function; -import com.google.common.collect.Collections2; import io.netty.channel.Channel; import io.netty.util.Timer; import io.netty.util.concurrent.Promise; + +import java.util.Collection; +import java.util.List; + +import javax.annotation.Nullable; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; + import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.NetconfSessionPreferences; import org.opendaylight.controller.netconf.util.AbstractNetconfSessionNegotiator; @@ -20,22 +26,19 @@ import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil; import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.util.xml.XmlUtil; -import org.opendaylight.protocol.framework.SessionListener; import org.w3c.dom.Document; import org.w3c.dom.Node; -import javax.annotation.Nullable; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import java.util.Collection; -import java.util.List; +import com.google.common.base.Function; +import com.google.common.collect.Collections2; public class NetconfClientSessionNegotiator extends - AbstractNetconfSessionNegotiator { + AbstractNetconfSessionNegotiator { protected NetconfClientSessionNegotiator(NetconfSessionPreferences sessionPreferences, - Promise promise, Channel channel, Timer timer, SessionListener sessionListener) { - super(sessionPreferences, promise, channel, timer, sessionListener); + Promise promise, Channel channel, Timer timer, NetconfClientSessionListener sessionListener, + long connectionTimeoutMillis) { + super(sessionPreferences, promise, channel, timer, sessionListener, connectionTimeoutMillis); } private static Collection getCapabilities(Document doc) { @@ -48,7 +51,8 @@ public class NetconfClientSessionNegotiator extends @Nullable @Override public String apply(@Nullable XmlElement input) { - return input.getTextContent(); + // Trim possible leading/tailing whitespace + return input.getTextContent().trim(); } }); } @@ -67,7 +71,7 @@ public class NetconfClientSessionNegotiator extends } @Override - protected NetconfClientSession getSession(SessionListener sessionListener, Channel channel, NetconfMessage message) { + protected NetconfClientSession getSession(NetconfClientSessionListener sessionListener, Channel channel, NetconfMessage message) { return new NetconfClientSession(sessionListener, channel, extractSessionId(message.getDocument()), getCapabilities(message.getDocument())); }