My name is Martin Aubrey with NOAA NGDC. I am inserting xml that is producing an IllegalStateException thrown from the kernel DataManager. This code calls org.fao.geonet.kernel.EditLib.findElement() and gets a null value resulting in the
exception below.
---------------------------------------------------------------------------------------------------------------------------
Scenario:
1) insert xml
2) click id number and then Edit
3) click check to validate
Upon entry into the JeevesServlet engine, the request contains what appears to be the original xml
being checked but transformed into a hash table...ex:
<request>
<position>-1</position>
<licenseurl />
<type />
<_23>fake abstract</_23>
<_12_gmdCOLONidentifier>gmd:MD_Identifier</_12_gmdCOLONidentifier>
<_25 />
<version>2</version>
<child />
<id>12</id>
<_1_gmdCOLONidentificationInfo>gmd:MD_DataIdentification</_1_gmdCOLONidentificationInfo>
<_20_codeListValue>creation</_20_codeListValue>
<name />
<_ />
<_1_gmdCOLONcontentInfo>gmd:MD_CoverageDescription</_1_gmdCOLONcontentInfo>
<fname />
<template>n</template>
<_1_gmdCOLONseries>gmd:DS_Initiative</_1_gmdCOLONseries>
<_6_gcoCOLONnilReason>missing</_6_gcoCOLONnilReason>
<editing>12</editing>
<_18>20091001</_18>
<_10_gmdCOLONresourceConstraints>gmd:MD_Constraints</_10_gmdCOLONresourceConstraints>
<access />
<_14>FAKE TITLE</_14>
<showvalidationerrors>true</showvalidationerrors>
<_1_gmdCOLONspatialRepresentationInfo>gmd:MD_Georectified</_1_gmdCOLONspatialRepresentationInfo>
<ref />
<_1_gmdCOLONmetadataConstraints>gmd:MD_Constraints</_1_gmdCOLONmetadataConstraints>
<currTab>simple</currTab>
</request>
NOTE the <_ /> in this list. This hash table eventually makes its way to EditUtils where the htChanges hash is
build...skipping the underscore and using the blank object as a key...this hash makes its way to the DataManager
who iterates through this calling EditLib.findElement() passing a blank reference to search on. This findElement method is recurrsive with 3 return points which seems odd but the net of this is that this code does
not handle a hash build from a list containing <_ /> and returns null. The DataManager then throws the exception.
I would like to find out if the <_ /> coming into the JeevesServlet is valid or not and what code produces this...!!
Is the htchanges hash table valid in this case. Maybe this table should not be built and used unless an xsd validation
completes successfully...?
If valid then the findElement() may need some work.
---------------------------------------------------------------------------------------------------------------------------
2009-10-02 14:03:16,133 ERROR [jeeves.service] - Exception when executing service
2009-10-02 14:03:16,133 ERROR [jeeves.service] - (C) Exc : java.lang.IllegalStateException: Element not found at ref =
2009-10-02 14:03:16,134 DEBUG [jeeves.service] - Raised exception while executing service
<error id="error">
<message>Element not found at ref =</message>
<class>IllegalStateException</class>
<stack>
<at class="org.fao.geonet.kernel.DataManager" file="DataManager.java" line="1355" method="updateMetadataEmbedded" />
<at class="org.fao.geonet.services.metadata.EditUtils" file="EditUtils.java" line="140" method="updateContent" />
<at class="org.fao.geonet.services.metadata.Update" file="Update.java" line="103" method="exec" />
<at class="jeeves.server.dispatchers.ServiceInfo" file="ServiceInfo.java" line="256" method="execService" />
<at class="jeeves.server.dispatchers.ServiceInfo" file="ServiceInfo.java" line="159" method="execServices" />
<at class="jeeves.server.dispatchers.ServiceManager" file="ServiceManager.java" line="380" method="dispatch" />
<at class="jeeves.server.JeevesEngine" file="JeevesEngine.java" line="623" method="dispatch" />
<at class="jeeves.server.sources.http.JeevesServlet" file="JeevesServlet.java" line="204" method="execute" />
<at class="jeeves.server.sources.http.JeevesServlet" file="JeevesServlet.java" line="102" method="doPost" />
<at class="javax.servlet.http.HttpServlet" file="HttpServlet.java" line="727" method="service" />
</stack>
<request>
<language>en</language>
<service>metadata.update</service>
</request>
</error>
---------------------------------------------------------------------------------------------------------------------------
Inserted xml: The xml that follows has 7 test scenarios of which 3 produce the exception above.
<gmd:MD_Metadata xmlns:gmi="http://www.isotc211.org/2005/gmi" xmlns:gts="http://www.isotc211.org/2005/gts" xmlns:gco="http://www.isotc211.org/2005/gco" xmlns:gmd="http://www.isotc211.org/2005/gmd" xmlns:srv="http://www.isotc211.org/2005/srv" xmlns:gmx="http://www.isotc211.org/2005/gmx"
xmlns:gss="http://www.isotc211.org/2005/gss" xmlns:gsr="http://www.isotc211.org/2005/gsr" xmlns:gml="http://www.opengis.net/gml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.isotc211.org/2005/gmd
http://www.ngdc.noaa.gov/metadata/published/xsd/schema.xsd">
<gmd:contact>
<gmd:CI_ResponsibleParty>
<gmd:role gco:nilReason="missing"/>
</gmd:CI_ResponsibleParty>
</gmd:contact>
<gmd:dateStamp>
<gco:Date>2009-10-01</gco:Date>
</gmd:dateStamp>
<gmd:identificationInfo>
<gmd:MD_DataIdentification>
<gmd:citation>
<gmd:CI_Citation>
<gmd:title>
<gco:CharacterString>FAKE TITLE</gco:CharacterString>
</gmd:title>
<gmd:date>
<gmd:CI_Date>
<gmd:date>
<gco:Date>20091001</gco:Date>
</gmd:date>
<gmd:dateType>
<gmd:CI_DateTypeCode codeList="#fakeURL" codeListValue="creation">creation</gmd:CI_DateTypeCode>
</gmd:dateType>
</gmd:CI_Date>
</gmd:date>
<!-- 1. validate ok...no ref error -->
<!--<gmd:editionDate><gco:Date>2009-10-02</gco:Date></gmd:editionDate> -->
<!-- 2. validate ok with ref error-->
<!-- <gmd:editionDate gco:nilReason="unknown"/> -->
<!-- 3. validate ok...no ref error -->
<!--<gmd:editionDate gco:nilReason="unknown">
<gco:Date>2009-10-02</gco:Date>
</gmd:editionDate> -->
<!-- 4. does not validate...no ref error-->
<!-- <gmd:editionDate gco:nilReason="unknown">
<gco:Date/>
</gmd:editionDate>-->
<!-- 5. should not validate OR should autopopulate with 'gco:nilReason="missing" and then validate-->
<!-- validate OK with ref error-->
<!-- <gmd:editionDate/> -->
<!-- 6. does not validate with ref error -->
<!--<gmd:editionDate><gco:CharacterString>2009-10-02</gco:CharacterString></gmd:editionDate> -->
<!-- 7. does not validate...no ref error -->
<!--<gmd:editionDate>
<gco:Date/>
</gmd:editionDate> -->
</gmd:CI_Citation>
</gmd:citation>
<gmd:abstract>
<gco:CharacterString>fake abstract</gco:CharacterString>
</gmd:abstract>
<gmd:language>
<gco:CharacterString>esperante</gco:CharacterString>
</gmd:language>
</gmd:MD_DataIdentification>
</gmd:identificationInfo>
</gmd:MD_Metadata>
---------------------------------------------------------------------------------------------------------------------------