From 6c0e940b9b65194561362dd7dfb098d0ae84ff25 Mon Sep 17 00:00:00 2001 From: Robert Muir Date: Sat, 30 Apr 2016 16:16:24 -0400 Subject: [PATCH] Improve exception message so you see expected/actual if lock file is messed with --- .../src/java/org/apache/lucene/store/NativeFSLockFactory.java | 4 ++-- .../src/java/org/apache/lucene/store/SimpleFSLockFactory.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lucene/core/src/java/org/apache/lucene/store/NativeFSLockFactory.java b/lucene/core/src/java/org/apache/lucene/store/NativeFSLockFactory.java index 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 { @Override public 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.java index 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 { @Override public String toString() { - return "SimpleFSLock(path=" + path + ",ctime=" + creationTime + ")"; + return "SimpleFSLock(path=" + path + ",creationTime=" + creationTime + ")"; } } }