diff --git a/core/src/main/kotlin/org/evomaster/core/problem/rest/oracle/RestSecurityOracle.kt b/core/src/main/kotlin/org/evomaster/core/problem/rest/oracle/RestSecurityOracle.kt index 97616f397c..71e73d682e 100644 --- a/core/src/main/kotlin/org/evomaster/core/problem/rest/oracle/RestSecurityOracle.kt +++ b/core/src/main/kotlin/org/evomaster/core/problem/rest/oracle/RestSecurityOracle.kt @@ -457,7 +457,15 @@ class RestSecurityOracle { for(index in individual.seeMainExecutableActions().indices){ val a = individual.seeMainExecutableActions()[index] - val r = actionResults.find { it.sourceLocalId == a.getLocalId() } as RestCallResult + val r = actionResults.find { it.sourceLocalId == a.getLocalId() } as RestCallResult? + /* + FIXME either we check every "as RestCallResult" cast in this class, or + we need to refactor how we pass around "individual" and "actionResults". + TODO need refactoring + TODO need invariant checks (eg if RestCallResult is missing, what property + like "stopped" must be in the individual?) + */ + ?: break if((a.verb == HttpVerb.PUT || a.verb == HttpVerb.PATCH || a.verb == HttpVerb.DELETE) && faultyPaths.contains(a.path) diff --git a/core/src/main/kotlin/org/evomaster/core/search/gene/datetime/DateGene.kt b/core/src/main/kotlin/org/evomaster/core/search/gene/datetime/DateGene.kt index 82c466918a..b13d7382e6 100644 --- a/core/src/main/kotlin/org/evomaster/core/search/gene/datetime/DateGene.kt +++ b/core/src/main/kotlin/org/evomaster/core/search/gene/datetime/DateGene.kt @@ -112,9 +112,14 @@ class DateGene( extraCheck: Boolean ): String { return if (mode == GeneUtils.EscapeMode.EJSON) { - val millis = LocalDate.of(year.value, month.value, day.value).atStartOfDay().atZone(ZoneId.systemDefault()) - .toInstant().toEpochMilli() - "{\"\$date\":{\"\$numberLong\":\"$millis\"}}" + val millis = try{ + LocalDate.of(year.value, month.value, day.value).atStartOfDay().atZone(ZoneId.systemDefault()) + .toInstant().toEpochMilli() + }catch (e : Exception){ + //this can happen if date is invalid + -1 + } + $$"{\"$date\":{\"$numberLong\":\"$$millis\"}}" } else { "\"${getValueAsRawString()}\"" }