I'm trying to set up an app using java ledger api and based on the ping pong example. However, the method "containsModule" is throwing the exception:
InvalidProtocolBufferException.java "Protocol message had too many levels of nesting. May be malicious. Use CodedInputStream.setRecursionLimit() to increase the depth limit."
on this line:
//parse the archive payload
DamlLf.ArchivePayload payload = DamlLf.ArchivePayload.parseFrom(getPackageResponse.getArchivePayload());
Can you please help on this? Thanks.
Often the packages are too big for protobuf to digest. As suggested by the error, you can set the recursion limit explicitly, e.g.
CodedInputStream cos =
CodedInputStream.newInstance(getPackageResponse.getArchivePayload());
cos.setRecursionLimit(1000);
DamlLf.ArchivePayload payload = DamlLf.ArchivePayload.parser().parseFrom(cos);
We'll fix the example, thanks for pointing this out.