Skip to content

Deploy strategies use three different exception types for empty-array fault #4732

@Yicong-Huang

Description

@Yicong-Huang

What happened?

Calling next() on a deploy strategy whose available array is empty produces a different exception per strategy:

  • OneOnEach: IndexOutOfBoundsException
  • RoundRobinDeployment: ArithmeticException (divide-by-zero on index = (index + 1) % length)
  • RandomDeployment: IllegalArgumentException (Random.nextInt(0) rejects bound 0)

The shared DeployStrategy trait gives no contract for the empty-array case, but a unified failure mode would make callers easier to write.

How to reproduce?

For each strategy, init with Array.empty[Address] and call next():

OneOnEach().tap(_.initialize(Array.empty)).next()           // IndexOutOfBoundsException
RoundRobinDeployment().tap(_.initialize(Array.empty)).next() // ArithmeticException
RandomDeployment().tap(_.initialize(Array.empty)).next()    // IllegalArgumentException

Version

1.1.0-incubating (Pre-release/Master)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions