Skip to content

Commit

Permalink
Fixing issue with serializable updates on deleted variable instances
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikheremans committed Jun 18, 2013
1 parent fe3af0d commit c9d0a8c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class VariableInstanceEntity implements ValueFields, PersistentObject, Ha

protected Object cachedValue;
protected boolean forcedUpdate;
protected boolean deleted = false;

// Default constructor for SQL mapping
protected VariableInstanceEntity() {
Expand Down Expand Up @@ -85,6 +86,7 @@ public void delete() {
.delete(this);

byteArrayRef.delete();
deleted = true;
}

public Object getPersistentState() {
Expand Down Expand Up @@ -113,6 +115,11 @@ public Object getPersistentState() {
public int getRevisionNext() {
return revision+1;
}


public boolean isDeleted() {
return deleted;
}

// lazy initialized relations ///////////////////////////////////////////////

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public DeserializedObject(Object deserializedObject, byte[] serializedBytes, Var

public void flush() {
// this first check verifies if the variable value was not overwritten with another object
if (deserializedObject==variableInstanceEntity.getCachedValue()) {
if (deserializedObject==variableInstanceEntity.getCachedValue() && !variableInstanceEntity.isDeleted()) {
byte[] bytes = SerializableType.serialize(deserializedObject, variableInstanceEntity);
if (!Arrays.equals(originalBytes, bytes)) {
variableInstanceEntity.setBytes(bytes);
Expand Down

0 comments on commit c9d0a8c

Please sign in to comment.