Skip to content
Snippets Groups Projects
Commit c76a219a authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Error on user/profile document : string value for 'time' cause an synchro error - fix #37

parent ab074209
No related branches found
No related tags found
No related merge requests found
......@@ -523,7 +523,18 @@ public abstract class AbstractSynchroAction extends AbstractService implements S
}
// Check version
Number existingVersion = ((Number) existingFields.get(versionFieldName));
Number existingVersion = null;
Object versionObj = existingFields.get(versionFieldName);
if (versionObj != null) {
if (versionObj instanceof String) {
existingVersion = Long.parseLong((String) versionObj);
} else if (versionObj instanceof Number) {
existingVersion = ((Number) versionObj);
} else {
throw new InvalidFormatException(String.format("Invalid document: '%s' should be a long, but found: %s", versionFieldName, versionObj));
}
}
boolean doUpdate = (existingVersion == null || version > existingVersion.longValue());
if (doUpdate) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment