merge to trunk. Fixing exceptions on submission of null value in dataproperty form. NIHVIVO-1021

This commit is contained in:
bdc34 2010-07-27 14:44:16 +00:00
parent cc0aab3814
commit 2968a09613

View file

@ -292,6 +292,7 @@ and set a flag in the request to indicate "back button confusion"
DataPropertyStatement dps = new DataPropertyStatementImpl();
Literal submitted = submission.getLiteralsFromForm().get(copy.getVarNameForObject());
if( submitted != null ){
dps.setIndividualURI( copy.getSubjectUri() );
dps.setDatapropURI( copy.getPredicateUri() );
dps.setDatatypeURI( submitted.getDatatypeURI());
@ -301,6 +302,7 @@ and set a flag in the request to indicate "back button confusion"
copy.prepareForDataPropUpdate(writeModel, dps);
copy.setDatapropKey( Integer.toString(RdfLiteralHash.makeRdfLiteralHash(dps)) );
EditConfiguration.putConfigInSession(copy,session);
}
%>
<jsp:forward page="postEditCleanUp.jsp"/>
@ -404,8 +406,11 @@ and set a flag in the request to indicate "back button confusion"
String onlyField = editConfig.getFields().keySet().iterator()
.next();
Literal value = submission.getLiteralsFromForm().get(onlyField);
if ("".equals(value.getLexicalForm())) {
log.debug("Submission was a single field with an empty string");
if( value == null ){
log.debug("No parameters found in submission for field \"" + onlyField +"\"");
return true;
}else if( "".equals(value.getLexicalForm())) {
log.debug("Submission was a single field named \"" + onlyField + "\" with an empty string");
return true;
}
}