Skip to content

Commit e2c0a72

Browse files
committed
SMHE-1748 SF jasper to shared
fix sonar issue npe Signed-off-by: Natasja Nortier <natasja.nortier@alliander.com>
1 parent 2f3f501 commit e2c0a72

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

osgp/protocol-adapter-dlms/osgp-jasper-interface/src/main/java/org/opensmartgridplatform/adapter/protocol/jasper/rest/client/JasperWirelessTerminalRestClient.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ public GetSessionInfoResponse getSession(final String iccId) throws OsgpJasperEx
5454
this.jasperwirelessRestTemplate.exchange(
5555
url, HttpMethod.GET, entity, GetSessionInfoResponse.class);
5656

57-
getSessionInfoResponse = this.checkOnSessionValidity(getSessionInfoResponseEntity);
57+
if (getSessionInfoResponseEntity.getBody() != null) {
58+
getSessionInfoResponse =
59+
this.checkOnSessionValidity(getSessionInfoResponseEntity.getBody());
60+
}
5861

5962
} catch (final HttpClientErrorException | HttpServerErrorException e) {
6063
this.handleException(e);
@@ -65,15 +68,14 @@ public GetSessionInfoResponse getSession(final String iccId) throws OsgpJasperEx
6568
}
6669

6770
private GetSessionInfoResponse checkOnSessionValidity(
68-
final ResponseEntity<GetSessionInfoResponse> getSessionInfoResponseEntity) {
71+
final GetSessionInfoResponse getSessionInfoResponse) {
6972
// To simulated to same behaviour as the SOAP interface. Session info of an expired session is
7073
// removed form the response.
7174
// REST-interface returns information about the current or most recent data session for a given
7275
// device.
7376
// SOAP-interface returns the current session information (IP address and session start time)
7477
// for one or more devices. If the specified device is not in session, no information is
7578
// returned.
76-
final GetSessionInfoResponse getSessionInfoResponse = getSessionInfoResponseEntity.getBody();
7779
if (this.hasCurrentSession(getSessionInfoResponse)) {
7880
return getSessionInfoResponse;
7981
} else {

0 commit comments

Comments
 (0)