[GeoNetwork-devel] [GeoNetwork opensource Developer website] #530: Deleting subelements n Point Of Contact in metadata editor

#530: Deleting subelements n Point Of Contact in metadata editor
-----------------------+----------------------------------------------------
Reporter: josegar74 | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.6.5
Component: General | Version: v2.6.4
Keywords: |
-----------------------+----------------------------------------------------
Possibly happens with other elements although I could reproduce it with
Point Of Contact.

Test: With default editor start removing the Point Of Contact subelements.
After some deletes is shown the attached window.

Log file contains an exception like:

{{{
2011-06-08 17:18:52,889 ERROR [jeeves.service] - (C) Exc :
java.lang.IllegalStateException: Element not found at ref = 96
2011-06-08 17:18:52,889 DEBUG [jeeves.service] - Raised exception while
executing service
<error id="error">

   <message>Element not found at ref = 96</message>

   <class>IllegalStateException</class>

   <stack>

     <at class="org.fao.geonet.kernel.DataManager" file="DataManager.java"
line="1477" method="deleteElementEmbedded" />

     <at class="org.fao.geonet.services.metadata.DeleteElement"
file="DeleteElement.java" line="72" method="exec" />

     <at class="jeeves.server.dispatchers.ServiceInfo"
file="ServiceInfo.java" line="238" method="execService" />

     <at class="jeeves.server.dispatchers.ServiceInfo"
file="ServiceInfo.java" line="141" method="execServices" />

     <at class="jeeves.server.dispatchers.ServiceManager"
file="ServiceManager.java" line="399" method="dispatch" />

     <at class="jeeves.server.JeevesEngine" file="JeevesEngine.java"
line="670" method="dispatch" />

     <at class="jeeves.server.sources.http.JeevesServlet"
file="JeevesServlet.java" line="185" method="execute" />

     <at class="jeeves.server.sources.http.JeevesServlet"
file="JeevesServlet.java" line="98" method="doGet" />

     <at class="javax.servlet.http.HttpServlet" file="HttpServlet.java"
line="707" method="service" />

     <at class="javax.servlet.http.HttpServlet" file="HttpServlet.java"
line="820" method="service" />

   </stack>

   <request>

     <language>en</language>

     <service>metadata.elem.delete</service>

   </request>

}}}

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/530&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/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.

#530: Deleting subelements from Point Of Contact in metadata editor causes an
exception
-----------------------+----------------------------------------------------
Reporter: josegar74 | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.6.5
Component: General | Version: v2.6.4
Keywords: |
-----------------------+----------------------------------------------------

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/530#comment:1&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/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.

#530: Deleting subelements from Point Of Contact in metadata editor causes an
exception
-----------------------+----------------------------------------------------
Reporter: josegar74 | Owner: geonetwork-devel@…
     Type: defect | Status: new
Priority: major | Milestone: v2.6.5
Component: General | Version: v2.6.4
Keywords: |
-----------------------+----------------------------------------------------

Comment(by josegar74):

The problem seem in this snippet of {{{deleteElementEmbedded}}} method:

{{{
parent.removeContent(me);

//--- existing geonet child element not present so create it
if (result == null) {
    result = editLib.createElement(schema,el,parent);

    parent.setContent(me,result);

}
}}}

if result == null, then as element was removed before the {{{if}}}, the
line {{{parent.setContent(me,result);}}} replaces the a wrong element. I
result == null, the instruction {{{parent.removeContent(me);}}} should not
be executed

Attached patch to review if can cause problems with other editor
functionality

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/530#comment:2&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/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.

#530: Deleting subelements from Point Of Contact in metadata editor causes an
exception
------------------------+---------------------------------------------------
  Reporter: josegar74 | Owner: geonetwork-devel@…
      Type: defect | Status: closed
  Priority: major | Milestone: v2.6.5
Component: General | Version: v2.6.4
Resolution: fixed | Keywords:
------------------------+---------------------------------------------------
Changes (by josegar74):

  * status: new => closed
  * resolution: => fixed

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/530#comment:3&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/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.

#530: Deleting subelements from Point Of Contact in metadata editor causes an
exception
------------------------+---------------------------------------------------
  Reporter: josegar74 | Owner: geonetwork-devel@…
      Type: defect | Status: closed
  Priority: major | Milestone: v2.6.5
Component: General | Version: v2.6.4
Resolution: fixed | Keywords:
------------------------+---------------------------------------------------

Comment(by justinrowles):

This is a dupe of #379, which was supposedly committed three months ago,
but must have been lost somehow.

--
Ticket URL: <http://trac.osgeo.org/geonetwork/ticket/530#comment:4&gt;
GeoNetwork opensource Developer website <http://sourceforge.net/projects/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.