Uploaded image for project: 'JSword'
  1. JSword
  2. JS-128

AbstractSwordInstaller does not delete the temporary download file

    Details

      Description

      Maybe I am doing something wrong but I was having a lot of temporary swd files left on my Android sdcard so I think the temp file should be deleted in a finally block in AbstractSwordInstaller.run()

      + URI temp = null;
      try

      { // main code skipped }

      finally {
      job.done();
      + // tidy up after ourselves
      + if (temp != null) {
      + try

      { + NetUtil.delete(temp); + }

      catch (Exception e)

      { + log.warn("Error deleting temp download file:"+e.getMessage()); + }

      + }
      }

        Attachments

          Activity

          Hide
          dmsmith DM Smith added a comment -

          Yes. These should be deleted. JSword uses a Java mechanism that marks created temporary files for delete upon exit. Maybe that doesn't work in an Android environment.

          Show
          dmsmith DM Smith added a comment - Yes. These should be deleted. JSword uses a Java mechanism that marks created temporary files for delete upon exit. Maybe that doesn't work in an Android environment.
          Hide
          mjdenham Martin Denham added a comment -

          Ah, I have just found the createTempFile and deleteOnExit in NetUtil and I see that if the JVM exits normally these files should be deleted but it would be nice to delete them explicitly after the download has completed in the same way that IndexDownloader.downloadIndex does an explicit deletion immediately after it has finished with a temporary file.

          Show
          mjdenham Martin Denham added a comment - Ah, I have just found the createTempFile and deleteOnExit in NetUtil and I see that if the JVM exits normally these files should be deleted but it would be nice to delete them explicitly after the download has completed in the same way that IndexDownloader.downloadIndex does an explicit deletion immediately after it has finished with a temporary file.
          Hide
          dmsmith DM Smith added a comment -

          Done.

          Show
          dmsmith DM Smith added a comment - Done.
          Hide
          dmsmith DM Smith added a comment -

          This is a good idea.

          Show
          dmsmith DM Smith added a comment - This is a good idea.

            People

            • Assignee:
              dmsmith DM Smith
              Reporter:
              mjdenham Martin Denham
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: