Merge pull request #1304 from jackyq2015/master

handle the empty user metadata
This commit is contained in:
Jacky 2017-11-04 19:14:36 -04:00 committed by GitHub
commit 1cd018b3fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -76,10 +76,12 @@ public class GetAllProjectMetadataCommand extends Command {
} }
writer.endObject(); writer.endObject();
writer.key("customMetaDataColumns"); String userMeta = (String)ProjectManager.singleton.getPreferenceStore().get("userMetaData");
JSONArray customMetaDataColumns = new JSONArray( if (userMeta != null) {
(String)ProjectManager.singleton.getPreferenceStore().get("userMetaData")); writer.key("customMetaDataColumns");
JSONArray customMetaDataColumns = new JSONArray(userMeta);
writer.value(customMetaDataColumns); writer.value(customMetaDataColumns);
}
writer.endObject(); writer.endObject();
} catch (JSONException e) { } catch (JSONException e) {

View File

@ -413,7 +413,10 @@ public class FileProjectManager extends ProjectManager {
JSONArray jsonObjArray = metadata.getUserMetadata(); JSONArray jsonObjArray = metadata.getUserMetadata();
try { try {
userMetadataPreference = new JSONArray((String)_preferenceStore.get(PreferenceStore.USER_METADATA_KEY)); String userMeta = (String)_preferenceStore.get(PreferenceStore.USER_METADATA_KEY);
if (userMeta == null)
return;
userMetadataPreference = new JSONArray(userMeta);
} catch (JSONException e1) { } catch (JSONException e1) {
logger.error(ExceptionUtils.getFullStackTrace(e1)); logger.error(ExceptionUtils.getFullStackTrace(e1));
} }