Skip to content

Commit

Permalink
Bugfix save user in batch (#964)
Browse files Browse the repository at this point in the history
* Fix for #499

Signed-off-by: Daniel San <daniel.samrocha@gmail.com>

* Avoid code smell

According to SonarLint this is a necessary change to avoid code smell:
https://rules.sonarsource.com/java/tag/brain-overload/RSPEC-135

Signed-off-by: Daniel San <daniel.samrocha@gmail.com>
  • Loading branch information
danielsanfr authored and Jawnnypoo committed Aug 9, 2019
1 parent 7417db5 commit 3451435
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions parse/src/main/java/com/parse/ParseObjectCurrentCoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class ParseObjectCurrentCoder extends ParseObjectCoder {
private static final String KEY_CLASS_NAME = "classname";
private static final String KEY_CREATED_AT = "createdAt";
private static final String KEY_UPDATED_AT = "updatedAt";
private static final String KEY_ACL = "ACL";
private static final String KEY_DATA = "data";

/*
Expand Down Expand Up @@ -155,27 +156,28 @@ public <T extends ParseObject.State.Init<?>> T decode(
Iterator<?> keys = data.keys();
while (keys.hasNext()) {
String key = (String) keys.next();

if (key.equals(KEY_OBJECT_ID)) {
String newObjectId = data.getString(key);
builder.objectId(newObjectId);
continue;
}
if (key.equals(KEY_CREATED_AT)) {
builder.createdAt(ParseDateFormat.getInstance().parse(data.getString(key)));
continue;
}
if (key.equals(KEY_UPDATED_AT)) {
builder.updatedAt(ParseDateFormat.getInstance().parse(data.getString(key)));
continue;
switch (key) {
case KEY_OBJECT_ID:
String newObjectId = data.getString(key);
builder.objectId(newObjectId);
break;
case KEY_CREATED_AT:
builder.createdAt(ParseDateFormat.getInstance().parse(data.getString(key)));
break;
case KEY_UPDATED_AT:
builder.updatedAt(ParseDateFormat.getInstance().parse(data.getString(key)));
break;
case KEY_ACL:
ParseACL acl = ParseACL.createACLFromJSONObject(data.getJSONObject(key), decoder);
builder.put(KEY_ACL, acl);
break;
default:
Object value = data.get(key);
Object decodedObject = decoder.decode(value);
builder.put(key, decodedObject);
}

Object value = data.get(key);
Object decodedObject = decoder.decode(value);
builder.put(key, decodedObject);
}
}

return builder;
} catch (JSONException e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit 3451435

Please sign in to comment.