Project

General

Profile

bug #7578

preseve null values in all mesurements during serialization of webservice responses

Added by Andreas Kohlbecker 5 months ago. Updated 4 months ago.

Status:
Closed
Priority:
New
Category:
cdmlib-remote
Target version:
Start date:
07/23/2018
Due date:
% Done:

100%

Severity:
normal
Found in Version:

Description

as reported in #6563 the double values which are null are serialized as 0.0 by json-lib this is plain wrong for all measurments like those in GatheringEvent

This affect the following model class properties:

Double and Float:

  • location.Point.java (3 matches)
    • 70: private Double longitude;
    • 75: private Double latitude;
    • 382: private Double toDecimal(){
  • molecular.Amplification.java (3 matches)
    • 150: private Double electrophoresisVoltage;
    • 156: private Double gelRunningTime;
    • 162: private Double gelConcentration;
  • molecular.AmplificationResult.java
    • 143: // private Double gelRunningTime;
  • molecular.DnaQuality.java (3 matches)
    • 93: private Double ratioOfAbsorbance260_230;
    • 95: private Double ratioOfAbsorbance260_280;
    • 97: private Double concentration;
  • occurrence.GatheringEvent.java (4 matches)
    • 153: private Double distanceToGround;
    • 159: private Double distanceToGroundMax;
    • 179: private Double distanceToWaterSurface;
    • 185: private Double distanceToWaterSurfaceMax;
  • PreservationMethod.java
    • 71: private Double temperature;
  • description.StatisticalMeasurementValue.java
    • 62: private float value;

Integer

  • description.FeatureNode.java
    • 120: private Integer sortIndex; - value not used
  • description.PolytomousKeyNode.java (2 matches)
    • 190: private Integer sortIndex = -1; - value not used
    • 237: private Integer nodeNumber = null;
  • description.QuantitativeData.java
    • 112: // private Integer sampleSize;
  • locationPoint.java
    • 83: private Integer errorRadius = 0; - 0 by default, can be set to null in which case serialization as null would be ok
  • media.ExternalLink.java
    • 97: private Integer size; - can be null and should be serialized as null in this case
  • media.MediaRepresentationPart.java
    • 61: private Integer size; - should be serialized as null is size is unknown molecular.SequenceString.java
    • 56: private Integer length; - should be serialized as null is length is unknown
  • molecular.SingleReadAlignment.java (3 matches)
    • 67: private Integer firstSeqPosition; - null serialization ok
    • 69: private Integer leftCutPosition; - null serialization ok
    • 71: private Integer rightCutPosition; - null serialization ok
  • name.TaxonName.java (2 matches)
    • 564: private Integer publicationYear; - null serialization ok
    • 570: private Integer originalPublicationYear; - null serialization ok
  • occurrence.GatheringEvent.java (2 matches)
    • 127: private Integer absoluteElevation; - null serialization ok
    • 133: private Integer absoluteElevationMax; - null serialization ok
  • taxon.TaxonNode.java
    • 145: private Integer sortIndex = -1; -- for internal use only not expected to be null at any time

according to the above analysis all Integer, Double and Float values should be serialized as null if the value is null.

Associated revisions

Revision d9f51acb (diff)
Added by Andreas Kohlbecker 5 months ago

fix #7578 DefaultValueProcessor to serialize all null numbers as null

Revision 200979f6 (diff)
Added by Andreas Kohlbecker 4 months ago

ref #7578 adding missing json config entry for the generic api

History

#1 Updated by Andreas Kohlbecker 5 months ago

  • Description updated (diff)

#2 Updated by Andreas Kohlbecker 5 months ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 50

#3 Updated by Andreas Kohlbecker 5 months ago

review by checking the example record here: http://test.e-taxonomy.eu/dataportal/preview/cichorieae/cdm_dataportal/taxon/1ad7630a-290b-464f-99e3-43c9dfb3c38b/specimens but this may be overwritten by importing a new production DB to test.

#4 Updated by Andreas Müller 4 months ago

  • Subject changed from preseve null values in all mesurements during serializazion of webservice responses to preseve null values in all mesurements during serialization of webservice responses

#5 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from Resolved to In Progress

this seems to be not working as expected:

http://test.e-taxonomy.eu/cdmserver/cichorieae/occurrence/8eaf2ade-d478-4af6-b3df-bad69f23ea3a/gatheringEvent.json

returns '0' for absoluteElevation even if set to NULL

#6 Updated by Andreas Kohlbecker 4 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 50 to 100

works now!

#8 Updated by Andreas Kohlbecker 4 months ago

Andreas Müller wrote:

error radius still returns 0 in http://test.e-taxonomy.eu/cdmserver/cichorieae/occurrence/8eaf2ade-d478-4af6-b3df-bad69f23ea3a/gatheringEvent.json

Is this wanted or excepted behavior?

The actual value of radius in this case is 0 when I set it to NULL the webservice returns NULL

It seems as if there is a problem with the embedded type Point. Whenever long and lat are set the radius is always set to 0 implying a precision of the location information which was not intended. It should be NULL instead.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)