Skip to content

Commit

Permalink
Mark the withExpectedLedgerId method in DamlLedgerClient.Builder
Browse files Browse the repository at this point in the history
…as deprecated (#12537)

changelog_begin
[Java bindings] Deprecate `DamlLedgerClient.Builder.withExpectedLedgerId`
changelog_end
  • Loading branch information
stefanobaghino-da authored Jan 26, 2022
1 parent deb7f3a commit 0579ebd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public Builder withSslContext(@NonNull SslContext sslContext) {
return this;
}

/**
* @deprecated since 2.0 the ledger identifier has been deprecated as a fail-safe against
* contacting an unexpected participant. You are recommended to use the participant
* identifier in the access token as a way to validate that you are accessing the ledger
* through the expected participant node (as well as authorize your calls).
*/
@Deprecated
public Builder withExpectedLedgerId(@NonNull String expectedLedgerId) {
this.expectedLedgerId = Optional.of(expectedLedgerId);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class DamlLedgerClientTest
val damlLedgerClient = DamlLedgerClient
.newBuilder("localhost", server.getPort)
.withExpectedLedgerId(ledgerServices.ledgerId)
.build()
.build(): @annotation.nowarn(
"cat=deprecation&origin=com\\.daml\\.ledger\\.rxjava\\.DamlLedgerClient\\.Builder\\.withExpectedLedgerId"
)
testDamlLedgerClient(damlLedgerClient, impls)
}
}
Expand All @@ -63,7 +65,9 @@ class DamlLedgerClientTest
.newBuilder("localhost", server.getPort)
.withExpectedLedgerId(ledgerServices.ledgerId)
.withAccessToken(somePartyReadWriteToken)
.build()
.build(): @annotation.nowarn(
"cat=deprecation&origin=com\\.daml\\.ledger\\.rxjava\\.DamlLedgerClient\\.Builder\\.withExpectedLedgerId"
)
damlLedgerClient.connect()
damlLedgerClient.getLedgerId shouldBe ledgerServices.ledgerId
testActiveContractSetClient(
Expand Down

0 comments on commit 0579ebd

Please sign in to comment.