SOLR-8548: Core Discovery was not following symlinks

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1725196 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alan Woodward 2016-01-18 09:05:24 +00:00
parent 9dc0ba4c7b
commit ddf13a54a3
2 changed files with 10 additions and 1 deletions

View File

@ -399,6 +399,9 @@ Bug Fixes
* SOLR-8541: Highlighting a geo RPT field would throw an NPE instead of doing nothing.
(Pawel Rog via David Smiley)
* SOLR-8548: Core discovery was not following symlinks (Aaron LaBella via Alan
Woodward)
Optimizations
----------------------

View File

@ -24,15 +24,18 @@ import java.io.OutputStreamWriter;
import java.io.Writer;
import java.lang.invoke.MethodHandles;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileVisitOption;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import com.google.common.collect.Lists;
import org.apache.solr.common.SolrException;
@ -123,7 +126,10 @@ public class CorePropertiesLocator implements CoresLocator {
logger.info("Looking for core definitions underneath {}", rootDirectory);
final List<CoreDescriptor> cds = Lists.newArrayList();
try {
Files.walkFileTree(this.rootDirectory, new SimpleFileVisitor<Path>() {
Set<FileVisitOption> options = new HashSet<>();
options.add(FileVisitOption.FOLLOW_LINKS);
final int maxDepth = 256;
Files.walkFileTree(this.rootDirectory, options, maxDepth, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (file.getFileName().toString().equals(PROPERTIES_FILENAME)) {