Skip to content

Commit

Permalink
[refactor] Remove code copied from an old version of Apache Ant, just…
Browse files Browse the repository at this point in the history
… use the Ant dependency we already have
  • Loading branch information
adamretter committed Sep 14, 2020
1 parent 510e75b commit 7839a5b
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 825 deletions.
11 changes: 0 additions & 11 deletions exist-ant/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,6 @@
<filtering>true</filtering>
</testResource>
</testResources>

<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<configuration>
<!-- clashes with Ant 1.10.6, see https://github.com/jeremylong/DependencyCheck/issues/1914 -->
<skipSystemScope>true</skipSystemScope>
</configuration>
</plugin>
</plugins>
</build>

</project>
5 changes: 5 additions & 0 deletions exist-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,11 @@
<artifactId>bifurcan</artifactId>
</dependency>

<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
24 changes: 22 additions & 2 deletions exist-core/src/main/java/org/exist/client/InteractiveClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;

import org.apache.tools.ant.DirectoryScanner;
import org.exist.SystemProperties;
import org.exist.dom.persistent.XMLUtil;
import org.exist.security.ACLPermission;
Expand Down Expand Up @@ -1408,7 +1409,15 @@ protected synchronized boolean parse(final Path file) throws XMLDBException {
files.add(file);
}
} else {
files = DirectoryScanner.scanDir(file.toString());
final DirectoryScanner directoryScanner = new DirectoryScanner();
directoryScanner.setIncludes(new String[] { file.toString() });
//TODO(AR) do we need to call scanner.setBasedir()?
directoryScanner.setCaseSensitive(true);
directoryScanner.scan();
for (final String includedFile : directoryScanner.getIncludedFiles()) {
// files.add(baseDir.resolve(includedFile));
files.add(Paths.get(includedFile));
}
}

final long start0 = System.currentTimeMillis();
Expand Down Expand Up @@ -1540,7 +1549,18 @@ protected synchronized boolean parseGZip(String fileName) throws XMLDBException,
files.add(file);
}
} else {
files = DirectoryScanner.scanDir(fileName);
final DirectoryScanner directoryScanner = new DirectoryScanner();
directoryScanner.setIncludes(new String[] { fileName });
//TODO(AR) do we need to call scanner.setBasedir()?
directoryScanner.setCaseSensitive(true);
directoryScanner.scan();

final String[] includedFiles = directoryScanner.getIncludedFiles();
files = new ArrayList<>(includedFiles.length);
for (final String includedFile : includedFiles) {
// files.add(baseDir.resolve(includedFile));
files.add(Paths.get(includedFile));
}
}

final long start0 = System.currentTimeMillis();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.types.selectors.SelectorUtils;
import org.xmldb.api.base.Collection;
import org.xmldb.api.base.Resource;
import org.xmldb.api.base.XMLDBException;
Expand Down Expand Up @@ -53,7 +55,7 @@ public final static void scan(List<Resource> list, Collection current, String vp
for (String sub : childCollections) {
name = vpath + sub;
System.out.println("checking " + name + " = " + pattern);
if (DirectoryScanner.matchStart(pattern, name))
if (SelectorUtils.matchPatternStart(pattern, name))
///TODO : use dedicated function in XmldbURI
{
scan(list, current.getChildCollection(sub), name + "/", pattern);
Expand Down
106 changes: 0 additions & 106 deletions exist-core/src/main/java/org/exist/util/DirectoryScanner.java

This file was deleted.

Loading

0 comments on commit 7839a5b

Please sign in to comment.