geonetwork / core-geonetwork

GeoNetwork is a catalog application to manage spatially referenced resources. It provides powerful metadata editing and search functions as well as an interactive web map viewer. It is currently used in numerous Spatial Data Infrastructure initiatives across the world.
http://geonetwork-opensource.org/
GNU General Public License v2.0
412 stars 487 forks source link

harvester not handling gml:TimePosition correctly #7928

Open smrgeoinfo opened 5 months ago

smrgeoinfo commented 5 months ago

gml:TimePosition is defined with data type <union memberTypes="gml:CalDate time dateTime anyURI decimal"/> in gml/3.2.1/termporal.xsd. I have data that uses gml:TimePosition to report geologic ages, i.e. a decimal number, which is a valid data type in this union, but when I try to harvest those records there is an error and the record is not harvested. In fact it appears that the harvest process hangs...

here is the error message:

2024-04-04T21:40:29,810 ERROR [geonetwork.domain] - Error parsing ISO DateTimes '160'. Error is: null
java.lang.NullPointerException: null
        at org.fao.geonet.utils.DateUtil.parseISODateTimes(DateUtil.java:149) ~[classes/:?]
        at org.fao.geonet.utils.DateUtil.convertToISOZuluDateTime(DateUtil.java:106) ~[classes/:?]

Here is a snippet from the xml being harvested:

<gex:temporalElement>
      <gex:EX_TemporalExtent>
         <gex:extent>
            <gml:TimePeriod>
               <gml:description>geoTime: Jurassic, Cretaceous</gml:description>
               <gml:begin>
                  <gml:TimeInstant>
                     <gml:name>Base Early Jurassic</gml:name>
                     <gml:timePosition  frame="Ma before present" >160</gml:timePosition>
                  </gml:TimeInstant>
               </gml:begin>
               <gml:end>.... like begin

The processor should not assume that gml:timePosition is an ISODateTime-- it needs to check for a URI or numeric value and allow those.

fxprunayre commented 5 months ago

Probably something to improve around here https://github.com/geonetwork/core-geonetwork/blob/main/web/src/main/webapp/xslt/common/index-utils.xsl#L605-L642 and then display information in the record view https://github.com/geonetwork/core-geonetwork/blob/main/web-ui/src/main/resources/catalog/views/default/templates/recordView/summary.html#L12-L21

The parsing error during indexing should not be something making the harvester hanging.