From 992cb964eb6c0c47297f16ba3b3a5b3081df73f0 Mon Sep 17 00:00:00 2001 From: David Huynh Date: Wed, 12 May 2010 06:35:01 +0000 Subject: [PATCH] Fixed Issue 2: Undo History bug. The MassChange class didn't write out each elemental change's class and so they couldn't be read back in. git-svn-id: http://google-refine.googlecode.com/svn/trunk@719 7d457c2a-affb-35e4-300a-418c747d4874 --- .../com/metaweb/gridworks/history/History.java | 14 +++++++++----- .../gridworks/model/changes/MassChange.java | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/metaweb/gridworks/history/History.java b/src/main/java/com/metaweb/gridworks/history/History.java index 3eba08dbd..227276549 100644 --- a/src/main/java/com/metaweb/gridworks/history/History.java +++ b/src/main/java/com/metaweb/gridworks/history/History.java @@ -50,7 +50,7 @@ public class History implements Jsonizable { return (Change) load.invoke(null, reader, pool); } - static public void writeOneChange(OutputStream out, Change change, Pool pool) throws Exception { + static public void writeOneChange(OutputStream out, Change change, Pool pool) throws IOException { Writer writer = new OutputStreamWriter(out); try { History.writeOneChange(writer, change, pool); @@ -59,14 +59,18 @@ public class History implements Jsonizable { } } - static public void writeOneChange(Writer writer, Change change, Pool pool) throws Exception { - writer.write(Gridworks.getVersion()); writer.write('\n'); - writer.write(change.getClass().getName()); writer.write('\n'); - + static public void writeOneChange(Writer writer, Change change, Pool pool) throws IOException { Properties options = new Properties(); options.setProperty("mode", "save"); options.put("pool", pool); + writeOneChange(writer, change, options); + } + + static public void writeOneChange(Writer writer, Change change, Properties options) throws IOException { + writer.write(Gridworks.getVersion()); writer.write('\n'); + writer.write(change.getClass().getName()); writer.write('\n'); + change.save(writer, options); } diff --git a/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java b/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java index a9011308f..f5ab78c2b 100644 --- a/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java +++ b/src/main/java/com/metaweb/gridworks/model/changes/MassChange.java @@ -49,7 +49,7 @@ public class MassChange implements Change { writer.write("updateRowContextDependencies="); writer.write(Boolean.toString(_updateRowContextDependencies)); writer.write('\n'); writer.write("changeCount="); writer.write(Integer.toString(_changes.size())); writer.write('\n'); for (Change c : _changes) { - c.save(writer, options); + History.writeOneChange(writer, c, options); } writer.write("/ec/\n"); // end of change marker }