Use direct conversion 78/85978/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 26 Nov 2019 15:12:31 +0000 (16:12 +0100)
committerRobert Varga <nite@hq.sk>
Fri, 29 Nov 2019 14:40:54 +0000 (14:40 +0000)
Uint types have utility converters for simple conversion among them,
use toUint16() without going through an int (and related checks).

Change-Id: I68927011a5eb933cc67fb1afba258b5d254973d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPSessionState.java

index ce5dd96852b28298adda651912b3840289263aeb..74756d1202983e99ad9fb5ee2e32ffbda209d28b 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.pcep.impl;
 
 import static java.util.Objects.requireNonNull;
@@ -78,7 +77,7 @@ final class PCEPSessionState {
                 .setDeadtimer(open.getDeadTimer())
                 .setKeepalive(open.getKeepalive())
                 .setIpAddress(((InetSocketAddress) channel.localAddress()).getAddress().getHostAddress())
-                .setSessionId(Uint16.valueOf(open.getSessionId().intValue()));
+                .setSessionId(open.getSessionId().toUint16());
         return peerBuilder.build();
     }
 
@@ -119,7 +118,7 @@ final class PCEPSessionState {
         peerBuilder.setDeadtimer(open.getDeadTimer())
             .setKeepalive(open.getKeepalive())
             .setIpAddress(((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress())
-            .setSessionId(Uint16.valueOf(open.getSessionId().intValue()));
+            .setSessionId(open.getSessionId().toUint16());
         return peerBuilder.build();
     }