Improve exception message so you see expected/actual if lock file is messed with

This commit is contained in:
Robert Muir 2016-04-30 16:16:24 -04:00
parent ad152d23d5
commit 6c0e940b9b
2 changed files with 4 additions and 4 deletions

View File

@ -176,7 +176,7 @@ public final class NativeFSLockFactory extends FSLockFactory {
// if it differs, someone deleted our lock file (and we are ineffective)
FileTime ctime = Files.readAttributes(path, BasicFileAttributes.class).creationTime();
if (!creationTime.equals(ctime)) {
throw new AlreadyClosedException("Underlying file changed by an external force at " + creationTime + ", (lock=" + this + ")");
throw new AlreadyClosedException("Underlying file changed by an external force at " + ctime + ", (lock=" + this + ")");
}
}
@ -199,7 +199,7 @@ public final class NativeFSLockFactory extends FSLockFactory {
@Override
public String toString() {
return "NativeFSLock(path=" + path + ",impl=" + lock + ",ctime=" + creationTime + ")";
return "NativeFSLock(path=" + path + ",impl=" + lock + ",creationTime=" + creationTime + ")";
}
}
}

View File

@ -111,7 +111,7 @@ public final class SimpleFSLockFactory extends FSLockFactory {
// if it differs, someone deleted our lock file (and we are ineffective)
FileTime ctime = Files.readAttributes(path, BasicFileAttributes.class).creationTime();
if (!creationTime.equals(ctime)) {
throw new AlreadyClosedException("Underlying file changed by an external force at " + creationTime + ", (lock=" + this + ")");
throw new AlreadyClosedException("Underlying file changed by an external force at " + ctime + ", (lock=" + this + ")");
}
}
@ -144,7 +144,7 @@ public final class SimpleFSLockFactory extends FSLockFactory {
@Override
public String toString() {
return "SimpleFSLock(path=" + path + ",ctime=" + creationTime + ")";
return "SimpleFSLock(path=" + path + ",creationTime=" + creationTime + ")";
}
}
}