Ticket #613 (closed defect: fixed)

Opened 20 months ago

Last modified 20 months ago

SchemaManager autodetect defaults to defaultSchema (with patch)

Reported by: jesseeichar Owned by: geonetwork-devel@…
Priority: major Milestone: v2.7.0
Component: General Version: v2.6.3
Keywords: Cc:

Description

This is a problem in some situations like MEF import because if there 2 metadata files. In my case GM03 and iso19139.che. It does not recognize GM03 so it uses the default, then an error occurs when it tries to import GM03.

I have a patch that adds a second parameter that is the default to use. In all cases the current behaviour is used but MEF import has been changed so that null is returned if the schema is not auto detected so it is correctly handled.

Attachments

613_schema_defaults.diff Download (2.7 KB) - added by jesseeichar 20 months ago.

Change History

Changed 20 months ago by jesseeichar

Changed 20 months ago by jesseeichar

  • summary changed from SchemaManager autodetect defaults to defaultSchema to SchemaManager autodetect defaults to defaultSchema (with patch)

Changed 20 months ago by Fxp

Not sure if this related Jesse, but in config.xml you have

<param name="preferredSchema" value="iso19139" />

which in your case should be probably set to

<param name="preferredSchema" value="iso19139.che" />

This is used by MEF import to select which XML to load (See Importer#handleMetadataFiles).

Changed 20 months ago by jesseeichar

Our preferred schema is == to the defaultSchema. and if a file (in my case GM03) does not have a schema it returns the defaultSchema. And therefore the system thinks the file is the preferred metadata which is simply wrong. It should return null. And probably did in a previous version. But no longer does. My change makes this usecase work again.

Changed 20 months ago by Fxp

  • status changed from new to closed
  • resolution set to fixed
  • milestone changed from v2.6.5 to v2.7.0

It would be better to always return null probably ? If schema detection failed it could be risky to import an XML with a non matching schema (that was made long time ago when autodetection was not so flexible). At least, we could log to warning in that case.

Committed revision 8237 (trunk).

Note: See TracTickets for help on using tickets.