Issue 45: "Renaming Cells with Ctrl-Enter produced ERROR"

Tentative fix by sprinkling in "synchronized".


git-svn-id: http://google-refine.googlecode.com/svn/trunk@809 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-05-18 00:02:58 +00:00
parent 6c9ef24336
commit ee82ec2642
4 changed files with 22 additions and 20 deletions

View File

@ -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

View File

@ -89,7 +89,7 @@ public class History implements Jsonizable {
_futureEntries = new ArrayList<HistoryEntry>();
}
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<HistoryEntry> getLastPastEntries(int count) {
synchronized public List<HistoryEntry> getLastPastEntries(int count) {
if (count <= 0) {
return new LinkedList<HistoryEntry>(_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('=');

View File

@ -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<String> getColumnNames() {
synchronized public List<String> 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

View File

@ -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<Group> keyedGroups = new ArrayList<Group>();
addRootKeyedGroup(keyedGroups);