Ticket #99 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

FGDC metadata extension with online linkage causes ClassCastException

Reported by: mattblanchette Owned by: geonetwork-devel@…
Priority: critical Milestone: v2.4.0 RC2
Component: General Version: v2.2.0 Final
Keywords: FGDC, metextns, onlink, ClassCastException Cc:

Description

Attempting to add a FGDC metextns (Metadata Extension) element with an onlink (Online Linkage) in the metadata edit forms causes the following Error message:

Error
The requested operation could not be performed.
ClassCastException? : java.util.ArrayList? cannot be cast to java.lang.String

Once these elements (<metextns><onlink/></metextns>) are added to an FGDC metadata entry, it can no longer be opened for editing since it will always throw this Error.

Error log shows that this Exception originated from the addValues method of org.fao.geonet.kernel.EditLib? class, which appears to be line 999 since it performs a String cast:
text.setAttribute(Edit.Attribute.Attr.VALUE, (String) values.get(i));

Change History

Changed 4 years ago by mattblanchette

Current workaround: Add test in addValues method:

if( values.get(i) instanceof String ) {
    Element text  = new Element(Edit.Element.Child.TEXT, Edit.NAMESPACE);
    text.setAttribute(Edit.Attribute.Attr.VALUE, (String) values.get(i));

    elem.addContent(text);
}

Changed 4 years ago by ticheler

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to v2.4.0 RC2

Fixed and tested by Simon Pigot

Note: See TracTickets for help on using tickets.