When I delete messages in a folder. it doesn't work. I debug the source code. in Folder#expunge() getDeletedMessageCount() always return 0. and in MboxFile#purge(int[] msgnums) file.renameTo(tempFile) return false that be proved the opeation fail. Can you tell me how to fix this problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had a quick look and you are right - the rename of the original file to the temp file is not working. It seems that something is still locking the file even after closing the channel (I tried with another sample file and it worked ok).
There seems to be a lot of bugs regarding File.renameTo() on Sun's bug-tracker, so this could be a bug in the JDK. I'll keep investigating why the file lock is not being released, but as a last resort I may have to find an alternative to File.renameTo().
I'll keep you posted on how its going.
regards,
ben
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
When I delete messages in a folder. it doesn't work. I debug the source code. in Folder#expunge() getDeletedMessageCount() always return 0. and in MboxFile#purge(int[] msgnums) file.renameTo(tempFile) return false that be proved the opeation fail. Can you tell me how to fix this problem.
I had a quick look and you are right - the rename of the original file to the temp file is not working. It seems that something is still locking the file even after closing the channel (I tried with another sample file and it worked ok).
There seems to be a lot of bugs regarding File.renameTo() on Sun's bug-tracker, so this could be a bug in the JDK. I'll keep investigating why the file lock is not being released, but as a last resort I may have to find an alternative to File.renameTo().
I'll keep you posted on how its going.
regards,
ben