Fixed bugs

- MassEditOperation was barfing when engineConfig was missing
- When parsing JSON in streaming mode, get long instead of int and double instead of float so that we won't get overflow exception.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@476 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-04-14 20:34:29 +00:00
parent 70c6f901ac
commit 24a7ea91b6
3 changed files with 6 additions and 5 deletions

View File

@ -130,9 +130,9 @@ public class Cell implements HasFields, Jsonizable {
if (token == JsonToken.VALUE_STRING) { if (token == JsonToken.VALUE_STRING) {
value = jp.getText(); value = jp.getText();
} else if (token == JsonToken.VALUE_NUMBER_INT) { } else if (token == JsonToken.VALUE_NUMBER_INT) {
value = jp.getIntValue(); value = jp.getLongValue();
} else if (token == JsonToken.VALUE_NUMBER_FLOAT) { } else if (token == JsonToken.VALUE_NUMBER_FLOAT) {
value = jp.getFloatValue(); value = jp.getDoubleValue();
} else if (token == JsonToken.VALUE_TRUE) { } else if (token == JsonToken.VALUE_TRUE) {
value = true; value = true;
} else if (token == JsonToken.VALUE_FALSE) { } else if (token == JsonToken.VALUE_FALSE) {

View File

@ -279,9 +279,9 @@ public class Recon implements HasFields, Jsonizable {
if (token == JsonToken.VALUE_STRING) { if (token == JsonToken.VALUE_STRING) {
recon.features[feature++] = jp.getText(); recon.features[feature++] = jp.getText();
} else if (token == JsonToken.VALUE_NUMBER_INT) { } else if (token == JsonToken.VALUE_NUMBER_INT) {
recon.features[feature++] = jp.getIntValue(); recon.features[feature++] = jp.getLongValue();
} else if (token == JsonToken.VALUE_NUMBER_FLOAT) { } else if (token == JsonToken.VALUE_NUMBER_FLOAT) {
recon.features[feature++] = jp.getFloatValue(); recon.features[feature++] = jp.getDoubleValue();
} else if (token == JsonToken.VALUE_FALSE) { } else if (token == JsonToken.VALUE_FALSE) {
recon.features[feature++] = false; recon.features[feature++] = false;
} else if (token == JsonToken.VALUE_TRUE) { } else if (token == JsonToken.VALUE_TRUE) {

View File

@ -54,7 +54,8 @@ public class MassEditOperation extends EngineDependentMassCellOperation {
} }
static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception { static public AbstractOperation reconstruct(Project project, JSONObject obj) throws Exception {
JSONObject engineConfig = obj.getJSONObject("engineConfig"); JSONObject engineConfig = obj.has("engineConfig") && !obj.isNull("engineConfig") ?
obj.getJSONObject("engineConfig") : null;
return new MassEditOperation( return new MassEditOperation(
engineConfig, engineConfig,