[GeoNetwork-devel] [GeoNetwork opensource Developer website] #99: FGDC metadata extension with online linkage causes ClassCastException

#99: FGDC metadata extension with online linkage causes ClassCastException
--------------------------------------------------------+-------------------
Reporter: mattblanchette | Owner: geonetwork-devel@lists.sourceforge.net
     Type: defect | Status: new
Priority: critical | Milestone:
Component: General | Version: v2.2.0 Final
Keywords: FGDC, metextns, onlink, ClassCastException |
--------------------------------------------------------+-------------------
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[[BR]]
The requested operation could not be performed.[[BR]]
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:[[BR]]
text.setAttribute(Edit.Attribute.Attr.VALUE, (String) values.get(i));

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/99&gt;
GeoNetwork opensource Developer website <http://trac.osgeo.org/geonetwork&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#99: FGDC metadata extension with online linkage causes ClassCastException
-----------------------------+----------------------------------------------
  Reporter: mattblanchette | Owner: geonetwork-devel@lists.sourceforge.net
      Type: defect | Status: new
  Priority: critical | Milestone:
Component: General | Version: v2.2.0 Final
Resolution: | Keywords: FGDC, metextns, onlink, ClassCastException
-----------------------------+----------------------------------------------
Comment (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);
}
}}}

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/99#comment:1&gt;
GeoNetwork opensource Developer website <http://trac.osgeo.org/geonetwork&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.

#99: FGDC metadata extension with online linkage causes ClassCastException
-----------------------------+----------------------------------------------
  Reporter: mattblanchette | Owner: geonetwork-devel@lists.sourceforge.net
      Type: defect | Status: closed
  Priority: critical | Milestone: v2.4.0 RC2
Component: General | Version: v2.2.0 Final
Resolution: fixed | Keywords: FGDC, metextns, onlink, ClassCastException
-----------------------------+----------------------------------------------
Changes (by ticheler):

  * status: new => closed
  * resolution: => fixed
  * milestone: => v2.4.0 RC2

Comment:

Fixed and tested by Simon Pigot

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/99#comment:2&gt;
GeoNetwork opensource Developer website <http://trac.osgeo.org/geonetwork&gt;
GeoNetwork opensource is a standards based, Free and Open Source catalog application to manage spatially referenced resources through the web. It provides powerful metadata editing and search functions as well as an embedded interactive web map viewer. This website contains information related to the development of the software.