diff --git a/src/controller/java/CHIPDeviceController-JNI.cpp b/src/controller/java/CHIPDeviceController-JNI.cpp index f80a21896e327d..5adb06dd43f17c 100644 --- a/src/controller/java/CHIPDeviceController-JNI.cpp +++ b/src/controller/java/CHIPDeviceController-JNI.cpp @@ -187,8 +187,11 @@ JNI_METHOD(void, commissionDevice) ChipLogProgress(Controller, "commissionDevice() called"); CommissioningParameters commissioningParams = CommissioningParameters(); - err = wrapper->ApplyNetworkCredentials(commissioningParams, networkCredentials); - VerifyOrExit(err == CHIP_NO_ERROR, err = CHIP_ERROR_INVALID_ARGUMENT); + if (networkCredentials != nullptr) + { + err = wrapper->ApplyNetworkCredentials(commissioningParams, networkCredentials); + VerifyOrExit(err == CHIP_NO_ERROR, err = CHIP_ERROR_INVALID_ARGUMENT); + } if (csrNonce != nullptr) { diff --git a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java index 477e47058bf5ac..5f85dede15a222 100644 --- a/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java +++ b/src/controller/java/src/chip/devicecontroller/ChipDeviceController.java @@ -141,7 +141,7 @@ public void establishPaseConnection(long deviceId, String address, int port, lon * @param deviceId the ID of the node to be commissioned * @param networkCredentials the credentials (Wi-Fi or Thread) to be provisioned */ - public void commissionDevice(long deviceId, NetworkCredentials networkCredentials) { + public void commissionDevice(long deviceId, @Nullable NetworkCredentials networkCredentials) { commissionDevice(deviceControllerPtr, deviceId, /* csrNonce= */ null, networkCredentials); } @@ -155,7 +155,7 @@ public void commissionDevice(long deviceId, NetworkCredentials networkCredential * @param networkCredentials the credentials (Wi-Fi or Thread) to be provisioned */ public void commissionDevice( - long deviceId, @Nullable byte[] csrNonce, NetworkCredentials networkCredentials) { + long deviceId, @Nullable byte[] csrNonce, @Nullable NetworkCredentials networkCredentials) { commissionDevice(deviceControllerPtr, deviceId, csrNonce, networkCredentials); } @@ -331,7 +331,7 @@ private native void commissionDevice( long deviceControllerPtr, long deviceId, @Nullable byte[] csrNonce, - NetworkCredentials networkCredentials); + @Nullable NetworkCredentials networkCredentials); private native void unpairDevice(long deviceControllerPtr, long deviceId);