=clu #3517 Guard against wrong random selection

* When all weights in the map are zero total became 0, which is not
  valid in random pick. Treat this special case as empty WeightedRoutees, i.e.
  no availble targets and routing to deadLetters.
This commit is contained in:
Patrik Nordwall 2013-08-16 12:04:36 +02:00
parent 34eb48565b
commit 0afe653fe1
3 changed files with 12 additions and 2 deletions

View file

@ -231,7 +231,7 @@ class ByteStringSpec extends WordSpec with MustMatchers with Checkers {
for (i 0 until data.length) builder.putLongPart(data(i), nBytes)(byteOrder)
reference.zipWithIndex.collect({ // Since there is no partial put on LongBuffer, we need to collect only the interesting bytes
case (r, i) if byteOrder == ByteOrder.LITTLE_ENDIAN && i % elemSize < nBytes r
case (r, i) if byteOrder == ByteOrder.LITTLE_ENDIAN && i % elemSize < nBytes r
case (r, i) if byteOrder == ByteOrder.BIG_ENDIAN && i % elemSize >= (elemSize - nBytes) r
}).toSeq == builder.result
}