Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

fix parse exception of ad result response #132

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Don't allow interval to be set with 0 or negative values. (#92)
tryantwit authored and jinsoor-amzn committed Aug 13, 2019
commit 0400ba67bcc05140a65f33dc5eb0f09a5d805ea6
Original file line number Diff line number Diff line change
@@ -249,6 +249,10 @@ data class IntervalSchedule(
if (!SUPPORTED_UNIT.contains(unit)) {
throw IllegalArgumentException("Timezone $unit is not supported expected $SUPPORTED_UNIT")
}

if (interval <= 0) {
throw IllegalArgumentException("Interval is not allowed to be 0 or negative")
}
}

@Transient
Original file line number Diff line number Diff line change
@@ -336,5 +336,9 @@ class ScheduleTest : XContentTestBase {
assertFailsWith(IllegalArgumentException::class, "Expected IllegalArgumentException") {
IntervalSchedule(1, ChronoUnit.MONTHS)
}

assertFailsWith(IllegalArgumentException::class, "Expected IllegalArgumentException") {
IntervalSchedule(-1, ChronoUnit.MINUTES)
}
}
}