From 2543fc306e039f42ca3dcf6f7a263e375cb50d7c Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Mon, 4 Mar 2013 11:04:51 +0100 Subject: [PATCH] Use oid and fixId everywhere for safety. --- src/com/massivecraft/mcore/store/Coll.java | 35 +++++++++++++------ .../mcore/store/CollInterface.java | 18 +++++----- 2 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/com/massivecraft/mcore/store/Coll.java b/src/com/massivecraft/mcore/store/Coll.java index 15a97a59..94fc3d58 100644 --- a/src/com/massivecraft/mcore/store/Coll.java +++ b/src/com/massivecraft/mcore/store/Coll.java @@ -281,8 +281,9 @@ public class Coll> implements CollInterface localDetachIds; protected Set changedIds; - protected synchronized void clearIdentifiedChanges(L id) + protected synchronized void clearIdentifiedChanges(Object oid) { + L id = this.fixId(oid); this.localAttachIds.remove(id); this.localDetachIds.remove(id); this.changedIds.remove(id); @@ -296,8 +297,9 @@ public class Coll> implements CollInterface lastRaw; protected Set lastDefault; - protected synchronized void clearSynclog(L id) + protected synchronized void clearSynclog(Object oid) { + L id = this.fixId(oid); this.lastMtime.remove(id); this.lastRaw.remove(id); this.lastDefault.remove(id); @@ -309,8 +311,9 @@ public class Coll> implements CollInterface> implements CollInterface> implements CollInterface> implements CollInterface entry = this.getDb().getDriver().load(this, id); @@ -396,19 +405,23 @@ public class Coll> implements CollInterface> implements CollInterface> public Set localAttachIds(); public Set localDetachIds(); public Set changedIds(); - public void clearIdentifiedChanges(L id); + public void clearIdentifiedChanges(Object oid); */ // -------------------------------------------- // @@ -104,26 +104,26 @@ public interface CollInterface> public Map lastMtime(); public Map lastRaw(); public Set lastDefault(); - public void clearSynclog(L id); + public void clearSynclog(Object oid); */ // -------------------------------------------- // // SYNC LOWLEVEL IO ACTIONS // -------------------------------------------- // - public E removeAtLocal(L id); - public void removeAtRemote(L id); - public void saveToRemote(L id); - public void loadFromRemote(L id); + public E removeAtLocal(Object oid); + public void removeAtRemote(Object oid); + public void saveToRemote(Object oid); + public void loadFromRemote(Object oid); // -------------------------------------------- // // SYNC EXAMINE AND DO // -------------------------------------------- // - public ModificationState examineId(L id); - public ModificationState examineId(L id, Long remoteMtime); + public ModificationState examineId(Object oid); + public ModificationState examineId(Object oid, Long remoteMtime); - public ModificationState syncId(L id); + public ModificationState syncId(Object oid); public void syncSuspects(); public void syncAll(); public void findSuspects();