diff --git a/provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClient.java b/provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClient.java index eef6158911..e18b12fc8f 100644 --- a/provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClient.java +++ b/provisioning/provisioning-device-client/src/main/java/com/microsoft/azure/sdk/iot/provisioning/device/ProvisioningDeviceClient.java @@ -114,7 +114,10 @@ public void registerDevice(ProvisioningDeviceClientRegistrationCallback provisio throw new IllegalArgumentException("registration callback cannot be null"); } - this.provisioningDeviceClientConfig.setPayload(additionalData.getProvisioningPayload()); + if (additionalData != null) + { + this.provisioningDeviceClientConfig.setPayload(additionalData.getProvisioningPayload()); + } this.provisioningDeviceClientConfig.setRegistrationCallback(provisioningDeviceClientRegistrationCallback, context); @@ -180,7 +183,8 @@ public ProvisioningDeviceClientRegistrationResult registerDeviceSync(AdditionalD registrationExceptionReference.set(e); registrationLatch.countDown(); }, - null); + null, + additionalData); // Wait until registration finishes or for a max amount of time boolean timedOut = !registrationLatch.await(timeout, TimeUnit.SECONDS);