From 71cdc0ae52defdf2852a9023781efb84c3788349 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Mon, 6 Aug 2012 20:55:49 +0000 Subject: [PATCH] updates for fixing error when new content type is added when editing an existing page in page management (previously, data getter URI was checked for each content section/data getter URI, and this was resulting in an error when new content section/data getter was added in edit mode). --- .../preprocessors/ManagePagePreprocessor.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java index 29077de2c..31063bf39 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ManagePagePreprocessor.java @@ -250,10 +250,15 @@ public class ManagePagePreprocessor extends //To get data getter uris, check if editing an existing set and include those as form inputs if(editConfiguration.isParamUpdate()) { - String URIValue = jsonObject.getString("URI"); - if(URIValue != null) { - String dataGetterURISubmissionName = pn.getDataGetterVarName(counter); - submission.addUriToForm(editConfiguration, dataGetterURISubmissionName, new String[]{URIValue}); + //Although this is editing an existing page, new content might have been added which would not include + //existing data getter URIs, so important to check whether the key exists within the json object in the first place + if(jsonObject.containsKey("URI")) { + String URIValue = jsonObject.getString("URI"); + if(URIValue != null) { + log.debug("Existing URI for data getter found: " + URIValue); + String dataGetterURISubmissionName = pn.getDataGetterVarName(counter); + submission.addUriToForm(editConfiguration, dataGetterURISubmissionName, new String[]{URIValue}); + } } }