diff --git a/CHANGES.txt b/CHANGES.txt index da6219ac1..c9a83c513 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -10,6 +10,8 @@ Fixes: - Issue 15: "Ability to rename projects" - Issue 16: "Column name collision when adding data from Freebase" - Issue 28: "mql-like preview is not properly unquoting numbers" +- Issue 45: "Renaming Cells with Ctrl-Enter produced ERROR" + Tentative fix for a concurrent bug. Changes: - Moved unit tests from JUnit to TestNG diff --git a/src/main/java/com/metaweb/gridworks/history/History.java b/src/main/java/com/metaweb/gridworks/history/History.java index 227276549..bc600bd87 100644 --- a/src/main/java/com/metaweb/gridworks/history/History.java +++ b/src/main/java/com/metaweb/gridworks/history/History.java @@ -89,7 +89,7 @@ public class History implements Jsonizable { _futureEntries = new ArrayList(); } - public void addEntry(HistoryEntry entry) { + synchronized public void addEntry(HistoryEntry entry) { entry.apply(ProjectManager.singleton.getProject(_projectID)); _pastEntries.add(entry); @@ -113,7 +113,7 @@ public class History implements Jsonizable { ProjectManager.singleton.getProjectMetadata(_projectID).updateModified(); } - public List getLastPastEntries(int count) { + synchronized public List getLastPastEntries(int count) { if (count <= 0) { return new LinkedList(_pastEntries); } else { @@ -121,7 +121,7 @@ public class History implements Jsonizable { } } - public void undoRedo(long lastDoneEntryID) { + synchronized public void undoRedo(long lastDoneEntryID) { if (lastDoneEntryID == 0) { // undo all the way back to the start of the project undo(_pastEntries.size()); @@ -142,7 +142,7 @@ public class History implements Jsonizable { } } - public long getPrecedingEntryID(long entryID) { + synchronized public long getPrecedingEntryID(long entryID) { if (entryID == 0) { return -1; } else { @@ -214,7 +214,7 @@ public class History implements Jsonizable { } } - public void write(JSONWriter writer, Properties options) + synchronized public void write(JSONWriter writer, Properties options) throws JSONException { writer.object(); @@ -234,7 +234,7 @@ public class History implements Jsonizable { writer.endObject(); } - public void save(Writer writer, Properties options) throws IOException { + synchronized public void save(Writer writer, Properties options) throws IOException { writer.write("pastEntryCount="); writer.write(Integer.toString(_pastEntries.size())); writer.write('\n'); for (HistoryEntry entry : _pastEntries) { entry.save(writer, options); writer.write('\n'); @@ -248,7 +248,7 @@ public class History implements Jsonizable { writer.write("/e/\n"); } - public void load(Project project, LineNumberReader reader) throws Exception { + synchronized public void load(Project project, LineNumberReader reader) throws Exception { String line; while ((line = reader.readLine()) != null && !"/e/".equals(line)) { int equal = line.indexOf('='); diff --git a/src/main/java/com/metaweb/gridworks/model/ColumnModel.java b/src/main/java/com/metaweb/gridworks/model/ColumnModel.java index aae16af73..e3b9b95c2 100644 --- a/src/main/java/com/metaweb/gridworks/model/ColumnModel.java +++ b/src/main/java/com/metaweb/gridworks/model/ColumnModel.java @@ -34,7 +34,7 @@ public class ColumnModel implements Jsonizable { internalInitialize(); } - public void setMaxCellIndex(int maxCellIndex) { + synchronized public void setMaxCellIndex(int maxCellIndex) { this._maxCellIndex = Math.max(this._maxCellIndex, maxCellIndex); } @@ -42,7 +42,7 @@ public class ColumnModel implements Jsonizable { return _maxCellIndex; } - public int allocateNewCellIndex() { + synchronized public int allocateNewCellIndex() { return ++_maxCellIndex; } @@ -55,7 +55,7 @@ public class ColumnModel implements Jsonizable { return _keyColumnIndex; } - public void addColumnGroup(int startColumnIndex, int span, int keyColumnIndex) { + synchronized public void addColumnGroup(int startColumnIndex, int span, int keyColumnIndex) { for (ColumnGroup g : columnGroups) { if (g.startColumnIndex == startColumnIndex && g.columnSpan == span) { if (g.keyColumnIndex == keyColumnIndex) { @@ -102,11 +102,11 @@ public class ColumnModel implements Jsonizable { _nameToColumn.put(name, column); // so the next call can check } - public Column getColumnByName(String name) { + synchronized public Column getColumnByName(String name) { return _nameToColumn.get(name); } - public int getColumnIndexByName(String name) { + synchronized public int getColumnIndexByName(String name) { for (int i = 0; i < _columnNames.size(); i++) { String s = _columnNames.get(i); if (name.equals(s)) { @@ -116,15 +116,15 @@ public class ColumnModel implements Jsonizable { return -1; } - public Column getColumnByCellIndex(int cellIndex) { + synchronized public Column getColumnByCellIndex(int cellIndex) { return _cellIndexToColumn.get(cellIndex); } - public List getColumnNames() { + synchronized public List getColumnNames() { return _columnNames; } - public void write(JSONWriter writer, Properties options) + synchronized public void write(JSONWriter writer, Properties options) throws JSONException { writer.object(); @@ -153,7 +153,7 @@ public class ColumnModel implements Jsonizable { writer.endObject(); } - public void save(Writer writer, Properties options) throws IOException { + synchronized public void save(Writer writer, Properties options) throws IOException { writer.write("maxCellIndex="); writer.write(Integer.toString(_maxCellIndex)); writer.write('\n'); writer.write("keyColumnIndex="); writer.write(Integer.toString(_keyColumnIndex)); writer.write('\n'); @@ -170,7 +170,7 @@ public class ColumnModel implements Jsonizable { writer.write("/e/\n"); } - public void load(LineNumberReader reader) throws Exception { + synchronized public void load(LineNumberReader reader) throws Exception { String line; while ((line = reader.readLine()) != null && !"/e/".equals(line)) { int equal = line.indexOf('='); @@ -199,7 +199,7 @@ public class ColumnModel implements Jsonizable { internalInitialize(); } - protected void internalInitialize() { + synchronized protected void internalInitialize() { generateMaps(); // Turn the flat list of column groups into a tree diff --git a/src/main/java/com/metaweb/gridworks/model/Project.java b/src/main/java/com/metaweb/gridworks/model/Project.java index db819f20a..15ac364a6 100644 --- a/src/main/java/com/metaweb/gridworks/model/Project.java +++ b/src/main/java/com/metaweb/gridworks/model/Project.java @@ -62,7 +62,7 @@ public class Project { return ProjectManager.singleton.getProjectMetadata(id); } - public void save() { + synchronized public void save() { synchronized (this) { File dir = ProjectManager.singleton.getProjectDir(id); @@ -257,7 +257,7 @@ public class Project { int keyCellIndex; } - public void recomputeRowContextDependencies() { + synchronized public void recomputeRowContextDependencies() { List keyedGroups = new ArrayList(); addRootKeyedGroup(keyedGroups);