diff --git a/main/src/com/google/refine/io/FileProjectManager.java b/main/src/com/google/refine/io/FileProjectManager.java index beccf4c5a..e56c0f97f 100644 --- a/main/src/com/google/refine/io/FileProjectManager.java +++ b/main/src/com/google/refine/io/FileProjectManager.java @@ -430,6 +430,11 @@ public class FileProjectManager extends ProjectManager { try { boolean found = false; JSONObject placeHolderJsonObj = userMetadataPreference.getJSONObject(index); + + if (!isValidUserMetaDataDefinition(placeHolderJsonObj)) { + logger.warn("Skipped invalid user metadata definition" + placeHolderJsonObj.toString()); + continue; + } for (int i = 0; i < jsonObjArray.length(); i++) { JSONObject jsonObj = jsonObjArray.getJSONObject(i); @@ -452,6 +457,17 @@ public class FileProjectManager extends ProjectManager { } } } + + /** + * A valid user meta data definition should have name and display property + * @param placeHolderJsonObj + * @return + */ + private boolean isValidUserMetaDataDefinition(JSONObject placeHolderJsonObj) { + return (placeHolderJsonObj != null && + placeHolderJsonObj.has("name") && + placeHolderJsonObj.has("display")); + } protected void recover() { boolean recovered = false; diff --git a/main/webapp/modules/core/scripts/index/edit-metadata-dialog.js b/main/webapp/modules/core/scripts/index/edit-metadata-dialog.js index 29aac1fc5..2f85cf1cc 100644 --- a/main/webapp/modules/core/scripts/index/edit-metadata-dialog.js +++ b/main/webapp/modules/core/scripts/index/edit-metadata-dialog.js @@ -14,29 +14,31 @@ function EditMetadataDialog(metaData, targetRowElem) { var td2 = tr.insertCell(2); - $('