Opened 13 years ago

Closed 13 years ago

#613 closed defect (fixed)

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 (1)

613_schema_defaults.diff (2.7 KB ) - added by jesseeichar 13 years ago.

Download all attachments as: .zip

Change History (5)

by jesseeichar, 13 years ago

Attachment: 613_schema_defaults.diff added

comment:1 by jesseeichar, 13 years ago

Summary: SchemaManager autodetect defaults to defaultSchemaSchemaManager autodetect defaults to defaultSchema (with patch)

comment:2 by Fxp, 13 years ago

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).

comment:3 by jesseeichar, 13 years ago

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.

comment:4 by Fxp, 13 years ago

Milestone: v2.6.5v2.7.0
Resolution: fixed
Status: newclosed

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.