[GeoNetwork-users] Harvesting problem due to invalid ISO date

Dear all,

I'd like to ask your advice on a problem that occurs in a harvesting job that we are running. The job is harvesting metadata records from a server that is running GeoNetwork. However, when the following request is issued by GeoNetwork, a Java exception is thrown and harvesting stops:

http://www.nationaalgeoregister.nl/geonetwork/srv/eng/csw?request=GetRecordById&service=CSW&version=2.0.2&outputSchema=http%3A%2F%2Fwww.isotc211.org%2F2005%2Fgmd&elementSetName=full&id=df50af8b-1a43-465f-a631-938ac1b2d63e

The stacktrace:
java.lang.IllegalArgumentException: Invalid ISO date : 2011
         at org.fao.geonet.util.ISODate.setDate(ISODate.java:116)
         at org.fao.geonet.util.ISODate.<init>(ISODate.java:82)
         at org.fao.geonet.kernel.harvest.harvester.RecordInfo.isMoreRecentThan(RecordInfo.java:76)
         at org.fao.geonet.kernel.harvest.harvester.csw.Aligner.updateMetadata(Aligner.java:270)
         at org.fao.geonet.kernel.harvest.harvester.csw.Aligner.align(Aligner.java:154)
         at org.fao.geonet.kernel.harvest.harvester.csw.Harvester.harvest(Harvester.java:101)
         at org.fao.geonet.kernel.harvest.harvester.csw.CswHarvester.doHarvest(CswHarvester.java:212)
         at org.fao.geonet.kernel.harvest.harvester.AbstractHarvester$HarvestWithIndexProcessor.process(AbstractHarvester.java:379)
         at org.fao.geonet.kernel.MetadataIndexerProcessor.processWithFastIndexing(MetadataIndexerProcessor.java:39)
         at org.fao.geonet.kernel.harvest.harvester.AbstractHarvester.harvest(AbstractHarvester.java:406)
         at org.fao.geonet.kernel.harvest.harvester.Executor.run(Executor.java:87)

The record, represented by the above request, indeed contains a gco:date field which contains only the year (which is not a valid ISO date). Now, I have two questions:

1. the metadata guide of the Dutch Georegister states that a year is allowed as a gco:date value. Is this true? If so, why does GeoNetwork throw an exception?
2. why does the harvest job stop when an exception is thrown because of an error in one metadata record? Can this behavior be changed?

Thanks in advance for your cooperation and greetings!

Jan

hello Jan,

1: A gco:Date value can indeed validly be simply a year.

2. Therefore in my opinion this is a bug in GeoNetwork. I'll file an issue
for it on GitHub. However I don't think there is any workaround for you,
unless you build yourself as soon as this is fixed. Maybe you could try to
get the metadata owner to change it to a date with month and day values.

Kind regards
Heikki Doeleman

On Mon, Jun 10, 2013 at 10:48 PM, Jan Boonen <jan.boonen@anonymised.com> wrote:

Dear all,

I'd like to ask your advice on a problem that occurs in a harvesting job
that we are running. The job is harvesting metadata records from a
server that is running GeoNetwork. However, when the following request
is issued by GeoNetwork, a Java exception is thrown and harvesting stops:

http://www.nationaalgeoregister.nl/geonetwork/srv/eng/csw?request=GetRecordById&service=CSW&version=2.0.2&outputSchema=http%3A%2F%2Fwww.isotc211.org%2F2005%2Fgmd&elementSetName=full&id=df50af8b-1a43-465f-a631-938ac1b2d63e

The stacktrace:
java.lang.IllegalArgumentException: Invalid ISO date : 2011
         at org.fao.geonet.util.ISODate.setDate(ISODate.java:116)
         at org.fao.geonet.util.ISODate.<init>(ISODate.java:82)
         at

org.fao.geonet.kernel.harvest.harvester.RecordInfo.isMoreRecentThan(RecordInfo.java:76)
         at

org.fao.geonet.kernel.harvest.harvester.csw.Aligner.updateMetadata(Aligner.java:270)
         at
org.fao.geonet.kernel.harvest.harvester.csw.Aligner.align(Aligner.java:154)
         at

org.fao.geonet.kernel.harvest.harvester.csw.Harvester.harvest(Harvester.java:101)
         at

org.fao.geonet.kernel.harvest.harvester.csw.CswHarvester.doHarvest(CswHarvester.java:212)
         at

org.fao.geonet.kernel.harvest.harvester.AbstractHarvester$HarvestWithIndexProcessor.process(AbstractHarvester.java:379)
         at

org.fao.geonet.kernel.MetadataIndexerProcessor.processWithFastIndexing(MetadataIndexerProcessor.java:39)
         at

org.fao.geonet.kernel.harvest.harvester.AbstractHarvester.harvest(AbstractHarvester.java:406)
         at
org.fao.geonet.kernel.harvest.harvester.Executor.run(Executor.java:87)

The record, represented by the above request, indeed contains a gco:date
field which contains only the year (which is not a valid ISO date). Now,
I have two questions:

1. the metadata guide of the Dutch Georegister states that a year is
allowed as a gco:date value. Is this true? If so, why does GeoNetwork
throw an exception?
2. why does the harvest job stop when an exception is thrown because of
an error in one metadata record? Can this behavior be changed?

Thanks in advance for your cooperation and greetings!

Jan

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork

Created issue https://github.com/geonetwork/core-geonetwork/issues/132.

On Mon, Jun 10, 2013 at 11:23 PM, heikki <tropicano@anonymised.com> wrote:

hello Jan,

1: A gco:Date value can indeed validly be simply a year.

2. Therefore in my opinion this is a bug in GeoNetwork. I'll file an issue
for it on GitHub. However I don't think there is any workaround for you,
unless you build yourself as soon as this is fixed. Maybe you could try to
get the metadata owner to change it to a date with month and day values.

Kind regards
Heikki Doeleman

On Mon, Jun 10, 2013 at 10:48 PM, Jan Boonen <jan.boonen@anonymised.com> wrote:

Dear all,

I'd like to ask your advice on a problem that occurs in a harvesting job
that we are running. The job is harvesting metadata records from a
server that is running GeoNetwork. However, when the following request
is issued by GeoNetwork, a Java exception is thrown and harvesting stops:

http://www.nationaalgeoregister.nl/geonetwork/srv/eng/csw?request=GetRecordById&service=CSW&version=2.0.2&outputSchema=http%3A%2F%2Fwww.isotc211.org%2F2005%2Fgmd&elementSetName=full&id=df50af8b-1a43-465f-a631-938ac1b2d63e

The stacktrace:
java.lang.IllegalArgumentException: Invalid ISO date : 2011
         at org.fao.geonet.util.ISODate.setDate(ISODate.java:116)
         at org.fao.geonet.util.ISODate.<init>(ISODate.java:82)
         at

org.fao.geonet.kernel.harvest.harvester.RecordInfo.isMoreRecentThan(RecordInfo.java:76)
         at

org.fao.geonet.kernel.harvest.harvester.csw.Aligner.updateMetadata(Aligner.java:270)
         at

org.fao.geonet.kernel.harvest.harvester.csw.Aligner.align(Aligner.java:154)
         at

org.fao.geonet.kernel.harvest.harvester.csw.Harvester.harvest(Harvester.java:101)
         at

org.fao.geonet.kernel.harvest.harvester.csw.CswHarvester.doHarvest(CswHarvester.java:212)
         at

org.fao.geonet.kernel.harvest.harvester.AbstractHarvester$HarvestWithIndexProcessor.process(AbstractHarvester.java:379)
         at

org.fao.geonet.kernel.MetadataIndexerProcessor.processWithFastIndexing(MetadataIndexerProcessor.java:39)
         at

org.fao.geonet.kernel.harvest.harvester.AbstractHarvester.harvest(AbstractHarvester.java:406)
         at
org.fao.geonet.kernel.harvest.harvester.Executor.run(Executor.java:87)

The record, represented by the above request, indeed contains a gco:date
field which contains only the year (which is not a valid ISO date). Now,
I have two questions:

1. the metadata guide of the Dutch Georegister states that a year is
allowed as a gco:date value. Is this true? If so, why does GeoNetwork
throw an exception?
2. why does the harvest job stop when an exception is thrown because of
an error in one metadata record? Can this behavior be changed?

Thanks in advance for your cooperation and greetings!

Jan

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
GeoNetwork-users mailing list
GeoNetwork-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at
http://sourceforge.net/projects/geonetwork