From 5d1f7ee2a8fff427f84c45974cc39b4e5d3d1916 Mon Sep 17 00:00:00 2001 From: Bryce Willey Date: Wed, 29 Apr 2026 10:27:02 -0400 Subject: [PATCH] Remove the "Optional" property from the CourtLocationInfo class Jackson makes the ridiculous decision to stop parsing an object halfway through when this happens, printing out the error in the serialized string. Used to be parsed as `{"empty": false, "present": true}`, which is admittedly not a good serialization either (would be broken if it was used). Error below: Fixed by storing the object specifically as an enum, TRUE, FALSE or DEFAULT (not used anywhere else, so okay for us to do this). > Java 8 optional type `java.util.Optional` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jdk8" to enable handling (or disable `MapperFeature.REQUIRE_HANDLERS_FOR_JAVA8_OPTIONALS`) (through reference chain: edu.suffolk.litlab.efsp.ecfcodes.tyler.CourtLocationInfo["allowserviceoninitial"]) --- .../ecfcodes/tyler/CourtLocationInfo.java | 19 +++++++++++++++---- .../ecf4/EcfCourtSpecificSerializer.java | 8 +++++--- .../efsp/server/setup/tyler/Ecf4Filer.java | 18 ++++++++---------- 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/proxyserver/src/main/java/edu/suffolk/litlab/efsp/ecfcodes/tyler/CourtLocationInfo.java b/proxyserver/src/main/java/edu/suffolk/litlab/efsp/ecfcodes/tyler/CourtLocationInfo.java index 2e126e6dc..7a28fb69e 100644 --- a/proxyserver/src/main/java/edu/suffolk/litlab/efsp/ecfcodes/tyler/CourtLocationInfo.java +++ b/proxyserver/src/main/java/edu/suffolk/litlab/efsp/ecfcodes/tyler/CourtLocationInfo.java @@ -3,7 +3,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; -import java.util.Optional; public class CourtLocationInfo { public String code; @@ -95,7 +94,15 @@ public class CourtLocationInfo { public String protectedcasereplacementstring; public boolean allowzerofeeswithoutfilingparty; - public Optional allowserviceoninitial; + + public static enum BoolOrDefault { + TRUE, + FALSE, + DEFAULT + } + + public BoolOrDefault + allowserviceoninitial; // if default, check DataField FilingServiceCheckBoxInitial public boolean allowaddservicecontactsoninitial; /** True if the court allows redaction of documents. See TODO(#39) */ @@ -201,9 +208,13 @@ public CourtLocationInfo(ResultSet rs) throws SQLException { this.allowzerofeeswithoutfilingparty = Boolean.parseBoolean(rs.getString(24)); String serviceoninitial = rs.getString(25); if (serviceoninitial == null || serviceoninitial.isBlank()) { - this.allowserviceoninitial = Optional.empty(); + this.allowserviceoninitial = BoolOrDefault.DEFAULT; } else { - this.allowserviceoninitial = Optional.of(Boolean.parseBoolean(serviceoninitial)); + if (Boolean.parseBoolean(serviceoninitial)) { + this.allowserviceoninitial = BoolOrDefault.TRUE; + } else { + this.allowserviceoninitial = BoolOrDefault.FALSE; + } } this.allowaddservicecontactsoninitial = Boolean.parseBoolean(rs.getString(26)); this.allowredaction = Boolean.parseBoolean(rs.getString(27)); diff --git a/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/ecf4/EcfCourtSpecificSerializer.java b/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/ecf4/EcfCourtSpecificSerializer.java index 85c733d15..56353e15c 100644 --- a/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/ecf4/EcfCourtSpecificSerializer.java +++ b/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/ecf4/EcfCourtSpecificSerializer.java @@ -869,10 +869,12 @@ public JAXBElement filingDocToXml( collector.addRequired(var); } } - Optional maybeServiceOnInitial = this.court.allowserviceoninitial; boolean serviceOnInitial = - maybeServiceOnInitial.orElse( - allDataFields.getFieldRow("FilingServiceCheckBoxInitial").isvisible); + switch (this.court.allowserviceoninitial) { + case TRUE -> true; + case FALSE -> false; + case DEFAULT -> allDataFields.getFieldRow("FilingServiceCheckBoxInitial").isvisible; + }; // From Reference Guide: if no FilingAction is provided, the original default behavior applies: // * ReviewFiling API w/o service contacts: EFile // * ReviewFiling API w/ service contacts: EfileAndServe diff --git a/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/setup/tyler/Ecf4Filer.java b/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/setup/tyler/Ecf4Filer.java index de2fceb4e..5bbec343f 100644 --- a/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/setup/tyler/Ecf4Filer.java +++ b/proxyserver/src/main/java/edu/suffolk/litlab/efsp/server/setup/tyler/Ecf4Filer.java @@ -343,16 +343,14 @@ private CoreMessageAndNames prepareFiling( cfm.getDocumentIdentification().add(id); } - Optional serviceOnInitial = locationInfo.allowserviceoninitial; - if (serviceOnInitial.isEmpty()) { - serviceOnInitial = - Optional.of( - cd.getDataField(locationInfo.code, "FilingServiceCheckBoxInitial").isvisible); - } - if (isInitialFiling - && !serviceOnInitial.orElse( - cd.getDataField(locationInfo.code, "FilingServiceCheckBoxInitial").isvisible) - && info.getServiceContacts().size() > 0) { + boolean serviceOnInitial = + switch (locationInfo.allowserviceoninitial) { + case TRUE -> true; + case FALSE -> false; + case DEFAULT -> + cd.getDataField(locationInfo.code, "FilingServiceCheckBoxInitial").isvisible; + }; + if (isInitialFiling && !serviceOnInitial && info.getServiceContacts().size() > 0) { FilingError err = FilingError.malformedInterview( "Court " + locationInfo.name + " doesn't allow service on initial filings");