Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-16064

No error message if updating the index queue flush timestamp fails

    XMLWordPrintable

Details

    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

          Activity

            People

              Unassigned Unassigned
              ckiehl Chris Kiehl
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: