Apache Lucene open-source search software
Improve exception message so you see expected/actual if lock file is messed with
Robert Muir3b9aa4d5cc42
diff --git a/lucene/core/src/java/org/apache/lucene/store/NativeFSLockFactory.java b/lucene/core/src/java/org/apache/lucene/store/NativeFSLockFactory.javaindex 70270146ffa..4f17d951a6f 100644--- a/lucene/core/src/java/org/apache/lucene/store/NativeFSLockFactory.java+++ b/lucene/core/src/java/org/apache/lucene/store/NativeFSLockFactory.java@@ -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 {@Overridepublic String toString() {- return "NativeFSLock(path=" + path + ",impl=" + lock + ",ctime=" + creationTime + ")";+ return "NativeFSLock(path=" + path + ",impl=" + lock + ",creationTime=" + creationTime + ")";}}}diff --git a/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java b/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.javaindex f0b9683f5ed..101ff5e234f 100644--- a/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java+++ b/lucene/core/src/java/org/apache/lucene/store/SimpleFSLockFactory.java@@ -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 {@Overridepublic String toString() {- return "SimpleFSLock(path=" + path + ",ctime=" + creationTime + ")";+ return "SimpleFSLock(path=" + path + ",creationTime=" + creationTime + ")";}}}