Skip to content

Commit

Permalink
fix: NullPointerException when using BoxSignRequestPrefillTag (#1121
Browse files Browse the repository at this point in the history
)

Fixes: #1120
Closes: SDK-2771
  • Loading branch information
lukaszsocha2 authored Nov 15, 2022
1 parent f16515d commit 73fd5b6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main/java/com/box/sdk/BoxSignRequestPrefillTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ public JsonObject getJSONObject() {
JsonUtils.addIfNotNull(prefillTagObj, "document_tag_id", this.documentTagId);
JsonUtils.addIfNotNull(prefillTagObj, "text_value", this.textValue);
JsonUtils.addIfNotNull(prefillTagObj, "checkbox_value", this.checkboxValue);
JsonUtils.addIfNotNull(prefillTagObj, "date_value", formatAsDateOnly(this.dateValue));
if (this.dateValue != null) {
prefillTagObj.add("date_value", formatAsDateOnly(this.dateValue));
}

return prefillTagObj;
}
Expand Down
6 changes: 5 additions & 1 deletion src/test/java/com/box/sdk/BoxSignRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import com.github.tomakehurst.wiremock.junit.WireMockRule;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.junit.Before;
Expand Down Expand Up @@ -64,8 +65,11 @@ public void createSignRequestSucceeds() throws IOException {
signers.add(newSigner);

String parentFolderId = "55555";

BoxSignRequestCreateParams params = new BoxSignRequestCreateParams();
params.setPrefillTags(Collections.singletonList(new BoxSignRequestPrefillTag("id", "text")));
BoxSignRequest.Info signRequestInfo = BoxSignRequest.createSignRequest(this.api, files,
signers, parentFolderId);
signers, parentFolderId, params);

BoxFile.Info fileInfo = signRequestInfo.getSourceFiles().get(0);
BoxSignRequestSigner signer = signRequestInfo.getSigners().get(0);
Expand Down

0 comments on commit 73fd5b6

Please sign in to comment.