You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2008/09/19 14:48:58 UTC
svn commit: r697073 -
/ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
Author: bodewig
Date: Fri Sep 19 05:48:58 2008
New Revision: 697073
URL: http://svn.apache.org/viewvc?rev=697073&view=rev
Log:
no need to clone a linked list to iterate through it
Modified:
ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
Modified: ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java?rev=697073&r1=697072&r2=697073&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/DirectoryScanner.java Fri Sep 19 05:48:58 2008
@@ -1785,20 +1785,21 @@
private boolean causesIllegalSymlinkLoop(String dirName, File parent,
LinkedList directoryNamesFollowed) {
try {
- if (CollectionUtils.frequency(directoryNamesFollowed, dirName)
+ if (directoryNamesFollowed.size() >= maxLevelsOfSymlinks
+ && CollectionUtils.frequency(directoryNamesFollowed, dirName)
>= maxLevelsOfSymlinks
&& FILE_UTILS.isSymbolicLink(parent, dirName)) {
- LinkedList s = (LinkedList) directoryNamesFollowed.clone();
ArrayList files = new ArrayList();
File f = FILE_UTILS.resolveFile(parent, dirName);
String target = f.getCanonicalPath();
files.add(target);
String relPath = "";
- while (s.size() > 0) {
+ for (Iterator i = directoryNamesFollowed.iterator();
+ i.hasNext(); ) {
relPath += "../";
- String dir = (String) s.removeFirst();
+ String dir = (String) i.next();
if (dirName.equals(dir)) {
f = FILE_UTILS.resolveFile(parent, relPath + dir);
files.add(f.getCanonicalPath());