Description
org.fisco.bcos.sdk.v3.contract.auth.po.ProposalInfo's no-arg constructor cannot be used — it always throws NumberFormatException.
Cause
The no-arg constructor calls super(new Address(""), ...). Address(String) → Numeric.toBigInt("") → new BigInteger("", 16), which throws NumberFormatException: Zero length BigInteger.
public ProposalInfo() {
super(
new Address(""), // Address("") -> Numeric.toBigInt("") -> NumberFormatException
new Uint8(0),
new Uint256(0),
new Uint8(0),
new DynamicArray<>(Address.class),
new DynamicArray<>(Address.class));
}
Impact
Any code that default-constructs ProposalInfo (e.g. as a decode template) throws at construction time.
Suggested fix
Use a valid zero address in the no-arg constructor, e.g. new Address(BigInteger.ZERO) (or Address.DEFAULT) instead of new Address(""). Other DynamicStruct PO subclasses with the same pattern should be checked too.
Found via
A unit test constructing new ProposalInfo(), during the test-coverage work in #947.
Description
org.fisco.bcos.sdk.v3.contract.auth.po.ProposalInfo's no-arg constructor cannot be used — it always throwsNumberFormatException.Cause
The no-arg constructor calls
super(new Address(""), ...).Address(String)→Numeric.toBigInt("")→new BigInteger("", 16), which throwsNumberFormatException: Zero length BigInteger.Impact
Any code that default-constructs
ProposalInfo(e.g. as a decode template) throws at construction time.Suggested fix
Use a valid zero address in the no-arg constructor, e.g.
new Address(BigInteger.ZERO)(orAddress.DEFAULT) instead ofnew Address(""). OtherDynamicStructPO subclasses with the same pattern should be checked too.Found via
A unit test constructing
new ProposalInfo(), during the test-coverage work in #947.