Browse Source

added notnull check for http commands

pull/8803/head
dashevchenko 3 years ago
parent
commit
e3ef58c603
  1. 6
      dao/src/main/java/org/thingsboard/server/dao/device/DeviceСonnectivityServiceImpl.java

6
dao/src/main/java/org/thingsboard/server/dao/device/DeviceСonnectivityServiceImpl.java

@ -119,8 +119,10 @@ public class DeviceСonnectivityServiceImpl implements DeviceConnectivityService
private JsonNode getHttpTransportPublishCommands(String defaultHostname, DeviceCredentials deviceCredentials) {
ObjectNode httpCommands = JacksonUtil.newObjectNode();
httpCommands.put(HTTP, getHttpPublishCommand(HTTP, defaultHostname, deviceCredentials));
httpCommands.put(HTTPS, getHttpPublishCommand(HTTPS, defaultHostname, deviceCredentials));
Optional.ofNullable(getHttpPublishCommand(HTTP, defaultHostname, deviceCredentials))
.ifPresent(v -> httpCommands.put(HTTP, v));
Optional.ofNullable(getHttpPublishCommand(HTTPS, defaultHostname, deviceCredentials))
.ifPresent(v -> httpCommands.put(HTTPS, v));
return httpCommands;
}

Loading…
Cancel
Save