deal with empty string properly

This commit is contained in:
Jacky 2017-10-27 16:59:55 -04:00
parent 6a47482ea4
commit 7c83746ee7
3 changed files with 10 additions and 9 deletions

View File

@ -57,16 +57,16 @@ public class ProjectMetadata implements Jsonizable {
private final Date _created;
private Date _modified;
private Date written = null;
private String _name;
private String _password;
private String _name = "";
private String _password = "";
private String _encoding;
private String _encoding = "";
private int _encodingConfidence;
private String _creator;
private String _contributors;
private String _subject; // Several refine projects may be linked
private String _description; // free form of comment
private String _creator = "";
private String _contributors = "";
private String _subject = ""; // Several refine projects may be linked
private String _description = ""; // free form of comment
private int _rowNumber; // at the creation. Essential for cleaning old projects too heavy
// import options is an array for 1-n data sources

View File

@ -6,6 +6,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.json.JSONException;
import org.json.JSONTokener;
import org.json.JSONWriter;
@ -36,7 +37,7 @@ public class SetProjectMetaDataCommand extends Command {
response.setHeader("Content-Type", "application/json");
JSONWriter writer = new JSONWriter(response.getWriter());
Object o = valueString == null ? null : new JSONTokener(valueString).nextValue();
Object o = StringUtils.isEmpty(valueString) ? null : new JSONTokener(valueString).nextValue();
meta.setAnyField(metaName, valueString);
ProjectManager.singleton.saveMetadata(meta, project.id);

View File

@ -1,4 +1,4 @@
<div class="dialog-frame" style="width: 700px;">
<div class="dialog-frame" >
<div class="dialog-border">
<div class="dialog-header" bind="dialogHeader"></div>
<div class="dialog-body" bind="dialogBody">