phax / as2-lib

A generic Java AS2 library, servlet and server
107 stars 43 forks source link

Rename operation from tempDir to target in AS2 package #116

Closed ihudedi closed 3 years ago

ihudedi commented 4 years ago

Hi Philip, We have an issue when the AS2 code trying to rename the file from tempDir to the target. When the tempDir and the target aren't on the same file system we are getting IOException when trying to rename file. You are using renameTo method in java.io.File Could you please modify the code to use move operation in nio package java.nio.file.Files#move(oldPath,newPath,StandardCopyOption.ATOMIC_MOVE,StandardCopyOption.REPLACE_EXISITING) You use the tempDir in some places in your code when you store the as2 message ,mdn etc. Please see the attached link https://stackoverflow.com/questions/6080295/how-to-rename-a-file-using-java-io-packages#6080330 Thanks, Itay

phax commented 3 years ago

Hi Itay, please post some stacktrace here. I checked the AS2IOHelper.moveFile and it actually does copy + delete. I scanned the sources and I don't see any call to renameTo. Thanks, Philip

ihudedi commented 3 years ago

Hi Philip, You can see it in AS2IOHelper.getFileOperationManager ().renameFile This method actual call the renameTo in java.io You can search for all occurancies. It's exist in AbstractStorageModule::store Thanks, Itay

phax commented 3 years ago

Thanks Itay for pointing me to the right place - too many abstraction layers in place ;-) Fixed in the latest SNAPSHOT. Will be part of of the 4.6.3 release

ihudedi commented 3 years ago

Hi Philip, Do you know when 4.6.3 is going to be released? Thanks, Itay

phax commented 3 years ago

Work in progress - on Maven Central within the next half hour

ihudedi commented 3 years ago

Thanks a lot for the quick response. Itay