Committed by
Gerrit Code Review
added some null checks for device instance
Change-Id: I84ab4365513a61bac4a5e852c8589fae3c828710
Showing
3 changed files
with
5 additions
and
3 deletions
... | @@ -164,7 +164,9 @@ public class NetconfDevice { | ... | @@ -164,7 +164,9 @@ public class NetconfDevice { |
164 | + deviceInfo(), e); | 164 | + deviceInfo(), e); |
165 | } finally { | 165 | } finally { |
166 | log.debug("Closing the session after successful execution"); | 166 | log.debug("Closing the session after successful execution"); |
167 | - ssh.close(); | 167 | + if (ssh != null) { |
168 | + ssh.close(); | ||
169 | + } | ||
168 | } | 170 | } |
169 | } | 171 | } |
170 | 172 | ... | ... |
... | @@ -339,7 +339,7 @@ public class NetconfDeviceProvider extends AbstractProvider | ... | @@ -339,7 +339,7 @@ public class NetconfDeviceProvider extends AbstractProvider |
339 | + device.deviceInfo(), e); | 339 | + device.deviceInfo(), e); |
340 | } catch (Exception e) { | 340 | } catch (Exception e) { |
341 | log.error("Error while initializing session for the device: " | 341 | log.error("Error while initializing session for the device: " |
342 | - + device.deviceInfo(), e); | 342 | + + (device != null ? device.deviceInfo() : null), e); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ... | ... |
... | @@ -378,7 +378,7 @@ public class NetconfDeviceProviderTest { | ... | @@ -378,7 +378,7 @@ public class NetconfDeviceProviderTest { |
378 | throw e; | 378 | throw e; |
379 | } catch (Exception e) { | 379 | } catch (Exception e) { |
380 | log.error("Error while initializing session for the device: " | 380 | log.error("Error while initializing session for the device: " |
381 | - + device.deviceInfo(), e); | 381 | + + (device != null ? device.deviceInfo() : null), e); |
382 | } | 382 | } |
383 | } | 383 | } |
384 | 384 | ... | ... |
-
Please register or login to post a comment