Details
-
Bug
-
Resolution: Duplicate
-
Low
-
None
-
3.0
Description
In com.atlassian.confluence.search.lucene.queue.DatabaseIndexTaskQueue.touchTimestamp() we don't check the return value of timestamp.setLastModified(ts). We should instead throw an exception if the update fails.
Here is the possible fix as suggested by one of our customers on the forums:
Change
private synchronized long touchTimestamp() { long ts = System.currentTimeMillis(); try { File timestamp = getTimestampFile(); if (!timestamp.exists() && !timestamp.getParentFile().mkdirs() && !timestamp.createNewFile()) { // error. throw new IOException("Failed to create timestamp file."); } timestamp.setLastModified(ts); } catch (IOException e) { log.error("", e); } return ts; }
to
private synchronized long touchTimestamp() { long ts = System.currentTimeMillis(); try { File timestamp = getTimestampFile(); if (!timestamp.exists() && !timestamp.getParentFile().mkdirs() && !timestamp.createNewFile()) { // error. throw new IOException("Failed to create timestamp file."); } if (!timestamp.setLastModified(ts)) { // error. throw new IOException("Failed to update timestamp file."); } } catch (IOException e) { log.error("", e); } return ts; }
Attachments
Issue Links
- duplicates
-
CONFSERVER-9228 Incorrect file permissions on index timestamp are not reported
- Closed