diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfFormController.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfFormController.java index b64904f49..40dd804cf 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfFormController.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/controller/ProcessRdfFormController.java @@ -61,7 +61,7 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{ //get the EditConfiguration EditConfigurationVTwo configuration = EditConfigurationUtils.getEditConfiguration(vreq); if(configuration == null) - throw new Error("No edit configuration found."); + return handleMissingConfiguration(vreq); //get the EditSubmission MultiValueEditSubmission submission = new MultiValueEditSubmission(vreq.getParameterMap(), configuration); @@ -177,6 +177,17 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{ } return null; //no errors } + + /** + * If the edit configuration cannot be found in the Session, + * show a message and display any request parameters so that the user's + * efforts won't be lost. + */ + protected ResponseValues handleMissingConfiguration(VitroRequest vreq){ + Map map = new HashMap(); + map.put("params",vreq.getParameterMap()); + return new TemplateResponseValues( "missingEditConfig.ftl", map ); + } //Move to EditN3Utils but keep make new uris here public static class Utilities { @@ -313,4 +324,5 @@ public class ProcessRdfFormController extends FreemarkerHttpServlet{ } + } diff --git a/webapp/web/templates/freemarker/edit/missingEditConfig.ftl b/webapp/web/templates/freemarker/edit/missingEditConfig.ftl new file mode 100644 index 000000000..a0871fc98 --- /dev/null +++ b/webapp/web/templates/freemarker/edit/missingEditConfig.ftl @@ -0,0 +1,17 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +

Unable to process the edit, possibly due to session experation.

+ +<#list params?keys as key> + <#if key != "editKey"> + +
+

${key}

+ <#list params[key] as value> +

${value}

+ +
+ + + + \ No newline at end of file