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:
parent
6c9ef24336
commit
ee82ec2642
@ -10,6 +10,8 @@ Fixes:
|
|||||||
- Issue 15: "Ability to rename projects"
|
- Issue 15: "Ability to rename projects"
|
||||||
- Issue 16: "Column name collision when adding data from Freebase"
|
- Issue 16: "Column name collision when adding data from Freebase"
|
||||||
- Issue 28: "mql-like preview is not properly unquoting numbers"
|
- 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:
|
Changes:
|
||||||
- Moved unit tests from JUnit to TestNG
|
- Moved unit tests from JUnit to TestNG
|
||||||
|
@ -89,7 +89,7 @@ public class History implements Jsonizable {
|
|||||||
_futureEntries = new ArrayList<HistoryEntry>();
|
_futureEntries = new ArrayList<HistoryEntry>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEntry(HistoryEntry entry) {
|
synchronized public void addEntry(HistoryEntry entry) {
|
||||||
entry.apply(ProjectManager.singleton.getProject(_projectID));
|
entry.apply(ProjectManager.singleton.getProject(_projectID));
|
||||||
_pastEntries.add(entry);
|
_pastEntries.add(entry);
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ public class History implements Jsonizable {
|
|||||||
ProjectManager.singleton.getProjectMetadata(_projectID).updateModified();
|
ProjectManager.singleton.getProjectMetadata(_projectID).updateModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<HistoryEntry> getLastPastEntries(int count) {
|
synchronized public List<HistoryEntry> getLastPastEntries(int count) {
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
return new LinkedList<HistoryEntry>(_pastEntries);
|
return new LinkedList<HistoryEntry>(_pastEntries);
|
||||||
} else {
|
} else {
|
||||||
@ -121,7 +121,7 @@ public class History implements Jsonizable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void undoRedo(long lastDoneEntryID) {
|
synchronized public void undoRedo(long lastDoneEntryID) {
|
||||||
if (lastDoneEntryID == 0) {
|
if (lastDoneEntryID == 0) {
|
||||||
// undo all the way back to the start of the project
|
// undo all the way back to the start of the project
|
||||||
undo(_pastEntries.size());
|
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) {
|
if (entryID == 0) {
|
||||||
return -1;
|
return -1;
|
||||||
} else {
|
} 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 {
|
throws JSONException {
|
||||||
|
|
||||||
writer.object();
|
writer.object();
|
||||||
@ -234,7 +234,7 @@ public class History implements Jsonizable {
|
|||||||
writer.endObject();
|
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');
|
writer.write("pastEntryCount="); writer.write(Integer.toString(_pastEntries.size())); writer.write('\n');
|
||||||
for (HistoryEntry entry : _pastEntries) {
|
for (HistoryEntry entry : _pastEntries) {
|
||||||
entry.save(writer, options); writer.write('\n');
|
entry.save(writer, options); writer.write('\n');
|
||||||
@ -248,7 +248,7 @@ public class History implements Jsonizable {
|
|||||||
writer.write("/e/\n");
|
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;
|
String line;
|
||||||
while ((line = reader.readLine()) != null && !"/e/".equals(line)) {
|
while ((line = reader.readLine()) != null && !"/e/".equals(line)) {
|
||||||
int equal = line.indexOf('=');
|
int equal = line.indexOf('=');
|
||||||
|
@ -34,7 +34,7 @@ public class ColumnModel implements Jsonizable {
|
|||||||
internalInitialize();
|
internalInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMaxCellIndex(int maxCellIndex) {
|
synchronized public void setMaxCellIndex(int maxCellIndex) {
|
||||||
this._maxCellIndex = Math.max(this._maxCellIndex, maxCellIndex);
|
this._maxCellIndex = Math.max(this._maxCellIndex, maxCellIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class ColumnModel implements Jsonizable {
|
|||||||
return _maxCellIndex;
|
return _maxCellIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int allocateNewCellIndex() {
|
synchronized public int allocateNewCellIndex() {
|
||||||
return ++_maxCellIndex;
|
return ++_maxCellIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ public class ColumnModel implements Jsonizable {
|
|||||||
return _keyColumnIndex;
|
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) {
|
for (ColumnGroup g : columnGroups) {
|
||||||
if (g.startColumnIndex == startColumnIndex && g.columnSpan == span) {
|
if (g.startColumnIndex == startColumnIndex && g.columnSpan == span) {
|
||||||
if (g.keyColumnIndex == keyColumnIndex) {
|
if (g.keyColumnIndex == keyColumnIndex) {
|
||||||
@ -102,11 +102,11 @@ public class ColumnModel implements Jsonizable {
|
|||||||
_nameToColumn.put(name, column); // so the next call can check
|
_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);
|
return _nameToColumn.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getColumnIndexByName(String name) {
|
synchronized public int getColumnIndexByName(String name) {
|
||||||
for (int i = 0; i < _columnNames.size(); i++) {
|
for (int i = 0; i < _columnNames.size(); i++) {
|
||||||
String s = _columnNames.get(i);
|
String s = _columnNames.get(i);
|
||||||
if (name.equals(s)) {
|
if (name.equals(s)) {
|
||||||
@ -116,15 +116,15 @@ public class ColumnModel implements Jsonizable {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Column getColumnByCellIndex(int cellIndex) {
|
synchronized public Column getColumnByCellIndex(int cellIndex) {
|
||||||
return _cellIndexToColumn.get(cellIndex);
|
return _cellIndexToColumn.get(cellIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getColumnNames() {
|
synchronized public List<String> getColumnNames() {
|
||||||
return _columnNames;
|
return _columnNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void write(JSONWriter writer, Properties options)
|
synchronized public void write(JSONWriter writer, Properties options)
|
||||||
throws JSONException {
|
throws JSONException {
|
||||||
|
|
||||||
writer.object();
|
writer.object();
|
||||||
@ -153,7 +153,7 @@ public class ColumnModel implements Jsonizable {
|
|||||||
writer.endObject();
|
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("maxCellIndex="); writer.write(Integer.toString(_maxCellIndex)); writer.write('\n');
|
||||||
writer.write("keyColumnIndex="); writer.write(Integer.toString(_keyColumnIndex)); 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");
|
writer.write("/e/\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(LineNumberReader reader) throws Exception {
|
synchronized public void load(LineNumberReader reader) throws Exception {
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null && !"/e/".equals(line)) {
|
while ((line = reader.readLine()) != null && !"/e/".equals(line)) {
|
||||||
int equal = line.indexOf('=');
|
int equal = line.indexOf('=');
|
||||||
@ -199,7 +199,7 @@ public class ColumnModel implements Jsonizable {
|
|||||||
internalInitialize();
|
internalInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void internalInitialize() {
|
synchronized protected void internalInitialize() {
|
||||||
generateMaps();
|
generateMaps();
|
||||||
|
|
||||||
// Turn the flat list of column groups into a tree
|
// Turn the flat list of column groups into a tree
|
||||||
|
@ -62,7 +62,7 @@ public class Project {
|
|||||||
return ProjectManager.singleton.getProjectMetadata(id);
|
return ProjectManager.singleton.getProjectMetadata(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() {
|
synchronized public void save() {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
File dir = ProjectManager.singleton.getProjectDir(id);
|
File dir = ProjectManager.singleton.getProjectDir(id);
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ public class Project {
|
|||||||
int keyCellIndex;
|
int keyCellIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recomputeRowContextDependencies() {
|
synchronized public void recomputeRowContextDependencies() {
|
||||||
List<Group> keyedGroups = new ArrayList<Group>();
|
List<Group> keyedGroups = new ArrayList<Group>();
|
||||||
|
|
||||||
addRootKeyedGroup(keyedGroups);
|
addRootKeyedGroup(keyedGroups);
|
||||||
|
Loading…
Reference in New Issue
Block a user