Skip to content

Commit

Permalink
no null numbers, please; also lets stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
naknomum committed Jan 28, 2025
1 parent f72a556 commit e471663
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/main/java/org/ecocean/Encounter.java
Original file line number Diff line number Diff line change
Expand Up @@ -4029,7 +4029,9 @@ public void opensearchDocumentSerializer(JsonGenerator jgen)
myShepherd.beginDBTransaction();
try {
opensearchDocumentSerializer(jgen, myShepherd);
} catch (Exception e) {} finally {
} catch (Exception ex) {
ex.printStackTrace();
} finally {
myShepherd.rollbackAndClose();
}
}
Expand Down Expand Up @@ -4284,13 +4286,20 @@ public void opensearchDocumentSerializer(JsonGenerator jgen, Shepherd myShepherd
jgen.writeStringField("occurrenceGroupBehavior", occ.getGroupBehavior());
jgen.writeStringField("occurrenceGroupComposition", occ.getGroupComposition());
jgen.writeStringField("occurrenceComments", occ.getComments());
jgen.writeNumberField("occurrenceVisibilityIndex", occ.getVisibilityIndex());
jgen.writeNumberField("occurrenceIndividualCount", occ.getIndividualCount());
jgen.writeNumberField("occurrenceMinGroupSizeEstimate", occ.getMinGroupSizeEstimate());
jgen.writeNumberField("occurrenceMaxGroupSizeEstimate", occ.getMaxGroupSizeEstimate());
jgen.writeNumberField("occurrenceBestGroupSizeEstimate", occ.getBestGroupSizeEstimate());
jgen.writeNumberField("occurrenceBearing", occ.getBearing());
jgen.writeNumberField("occurrenceDistance", occ.getDistance());
if (occ.getVisibilityIndex() != null)
jgen.writeNumberField("occurrenceVisibilityIndex", occ.getVisibilityIndex());
if (occ.getIndividualCount() != null)
jgen.writeNumberField("occurrenceIndividualCount", occ.getIndividualCount());
if (occ.getMinGroupSizeEstimate() != null)
jgen.writeNumberField("occurrenceMinGroupSizeEstimate", occ.getMinGroupSizeEstimate());
if (occ.getMaxGroupSizeEstimate() != null)
jgen.writeNumberField("occurrenceMaxGroupSizeEstimate", occ.getMaxGroupSizeEstimate());
if (occ.getBestGroupSizeEstimate() != null)
jgen.writeNumberField("occurrenceBestGroupSizeEstimate", occ.getBestGroupSizeEstimate());
if (occ.getBearing() != null)
jgen.writeNumberField("occurrenceBearing", occ.getBearing());
if (occ.getDistance() != null)
jgen.writeNumberField("occurrenceDistance", occ.getDistance());
Double odlat = occ.getDecimalLatitude();
Double odlon = occ.getDecimalLongitude();
if ((odlat == null) || !Util.isValidDecimalLatitude(odlat) || (odlon == null) ||
Expand Down

0 comments on commit e471663

Please sign in to comment.