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

Wrong error handling in FileSystemAttachmentDataDao.getDeleteErrorReason()

    XMLWordPrintable

Details

    Description

      Marking this as major because the error message is misleading and causing unnecessary pain for support.

      In FileSystemAttachmentDataDao.getDeleteErrorReason() there are two bugs, see inline comments below:

          private static String getDeleteErrorReason(File attachmentFolderForThisPage)
          {
              if(!attachmentFolderForThisPage.exists())
              {
                  return REASON_DIR_DOES_NOT_EXIST;
              }
      
              if(!attachmentFolderForThisPage.isDirectory())
              {
                  return REASON_NOT_A_DIRECTORY;
              }
      
              if(attachmentFolderForThisPage.listFiles().length > 2)   // as pointed out by Don, this should be 0
              {
                  return REASON_NOT_EMPTY;
              }
      
              if(attachmentFolderForThisPage.canWrite()) // this should be a case where the directory is not writeable
              {
                  return REASON_NOT_WRITABLE;
              }
      
              return REASON_UNKNOWN;
          }
      

      Attachments

        Activity

          People

            don.willis@atlassian.com Don Willis
            rhartono Roy Hartono [Atlassian]
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: