From 30759ee9eeb0316f8897a6fcca29e5488942ac0b Mon Sep 17 00:00:00 2001 From: arcuri82 Date: Thu, 2 Jul 2026 09:49:26 +0200 Subject: [PATCH 1/2] fix for DateGene EJSON mode --- .../evomaster/core/search/gene/datetime/DateGene.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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()}\"" } From a869d2459ad934aeb5ac6f9c59fd9afca6107e9e Mon Sep 17 00:00:00 2001 From: arcuri82 Date: Thu, 2 Jul 2026 09:58:50 +0200 Subject: [PATCH 2/2] fix for NPE --- .../core/problem/rest/oracle/RestSecurityOracle.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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)