Fixed bug in which a newly created and unedited project would never get saved because it had the same modified time and last save time.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1530 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
1f1586715d
commit
4ccdbc8716
@ -204,7 +204,7 @@ public abstract class ProjectManager {
|
|||||||
protected void saveProjects(boolean allModified) {
|
protected void saveProjects(boolean allModified) {
|
||||||
List<SaveRecord> records = new ArrayList<SaveRecord>();
|
List<SaveRecord> records = new ArrayList<SaveRecord>();
|
||||||
Date startTimeOfSave = new Date();
|
Date startTimeOfSave = new Date();
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
for (long id : _projectsMetadata.keySet()) {
|
for (long id : _projectsMetadata.keySet()) {
|
||||||
ProjectMetadata metadata = getProjectMetadata(id);
|
ProjectMetadata metadata = getProjectMetadata(id);
|
||||||
@ -212,7 +212,10 @@ public abstract class ProjectManager {
|
|||||||
|
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
boolean hasUnsavedChanges =
|
boolean hasUnsavedChanges =
|
||||||
metadata.getModified().getTime() > project.getLastSave().getTime();
|
metadata.getModified().getTime() >= project.getLastSave().getTime();
|
||||||
|
// We use >= instead of just > to avoid the case where a newly created project
|
||||||
|
// has the same modified and last save times, resulting in the project not getting
|
||||||
|
// saved at all.
|
||||||
|
|
||||||
if (hasUnsavedChanges) {
|
if (hasUnsavedChanges) {
|
||||||
long msecsOverdue = startTimeOfSave.getTime() - project.getLastSave().getTime();
|
long msecsOverdue = startTimeOfSave.getTime() - project.getLastSave().getTime();
|
||||||
@ -229,7 +232,7 @@ public abstract class ProjectManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (records.size() > 0) {
|
if (records.size() > 0) {
|
||||||
Collections.sort(records, new Comparator<SaveRecord>() {
|
Collections.sort(records, new Comparator<SaveRecord>() {
|
||||||
public int compare(SaveRecord o1, SaveRecord o2) {
|
public int compare(SaveRecord o1, SaveRecord o2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user