[ https://issues.apache.org/jira/browse/TRANSACTION-18?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Zeigermann resolved TRANSACTION-18. ------------------------------------------ Resolution: Fixed Fixed by applying your patch. Thansk :) > applyDeletes method does not delete symbolic links > -------------------------------------------------- > > Key: TRANSACTION-18 > URL: https://issues.apache.org/jira/browse/TRANSACTION-18 > Project: Commons Transaction > Issue Type: Bug > Affects Versions: 1.2 > Environment: Linux CENT OS > Reporter: Bojan Vukojevic > Assignee: Oliver Zeigermann > > applyDeletes static method in FileResourceManager (line 154) checks "isFile" > and if this returns "false" assumes it is a directory. This fails if the > resource is symbolic link. Instead, it should call "isDirectory" and then > recursively call itself, otherwise, it should delete the resource. > The fix is shown below: > protected static void applyDeletes(File removeDir, File targetDir, File > rootDir) throws IOException { > if (removeDir.isDirectory() && targetDir.isDirectory()) { > File[] files = removeDir.listFiles(); > for (int i = 0; i < files.length; i++) { > File removeFile = files[i]; > File targetFile = new File(targetDir, removeFile.getName()); > if (!removeFile.isDirectory()) { //===========THIS IS THE > FIX - WAS removeFile.isFile======= > if (targetFile.exists()) { > if (!targetFile.delete()) { > throw new IOException("Could not delete file " + > removeFile.getName() > + " in directory targetDir"); > } > } > // indicate, this has been done > removeFile.delete(); > } else { > applyDeletes(removeFile, targetFile, rootDir); > } > // delete empty target directories, except root dir > if (!targetDir.equals(rootDir) && targetDir.list().length == > 0) { > targetDir.delete(); > } > } > } > } -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]