Committed by
Gerrit Code Review
added some null checks for device instance
Change-Id: I84ab4365513a61bac4a5e852c8589fae3c828710
Showing
3 changed files
with
4 additions
and
2 deletions
| ... | @@ -164,9 +164,11 @@ public class NetconfDevice { | ... | @@ -164,9 +164,11 @@ 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 | + if (ssh != null) { | ||
| 167 | ssh.close(); | 168 | ssh.close(); |
| 168 | } | 169 | } |
| 169 | } | 170 | } |
| 171 | + } | ||
| 170 | 172 | ||
| 171 | private void processCapabilities(String xmlResponse) throws JNCException { | 173 | private void processCapabilities(String xmlResponse) throws JNCException { |
| 172 | if (xmlResponse.isEmpty()) { | 174 | if (xmlResponse.isEmpty()) { | ... | ... |
| ... | @@ -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