Issue #5086 Fix error on addFile
Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
parent
31cc298987
commit
e39ec6cab4
|
@ -349,11 +349,16 @@ public class Scanner extends AbstractLifeCycle
|
||||||
if (p == null)
|
if (p == null)
|
||||||
throw new IllegalStateException("Null path");
|
throw new IllegalStateException("Null path");
|
||||||
|
|
||||||
File f = p.toFile();
|
if (!Files.exists(p) || Files.isDirectory(p))
|
||||||
if (!f.exists() || f.isDirectory())
|
|
||||||
throw new IllegalStateException("Not file or doesn't exist: " + p);
|
throw new IllegalStateException("Not file or doesn't exist: " + p);
|
||||||
|
try
|
||||||
_scannables.putIfAbsent(p, null);
|
{
|
||||||
|
_scannables.putIfAbsent(p.toRealPath(), new IncludeExcludeSet<>(PathMatcherSet.class));
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -370,15 +375,13 @@ public class Scanner extends AbstractLifeCycle
|
||||||
if (p == null)
|
if (p == null)
|
||||||
throw new IllegalStateException("Null path");
|
throw new IllegalStateException("Null path");
|
||||||
|
|
||||||
File f = p.toFile();
|
if (!Files.exists(p) || !Files.isDirectory(p))
|
||||||
if (!f.exists() || !f.isDirectory())
|
|
||||||
throw new IllegalStateException("Not directory or doesn't exist: " + p);
|
throw new IllegalStateException("Not directory or doesn't exist: " + p);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Path real = p.toRealPath();
|
|
||||||
IncludeExcludeSet<PathMatcher, Path> includesExcludes = new IncludeExcludeSet<>(PathMatcherSet.class);
|
IncludeExcludeSet<PathMatcher, Path> includesExcludes = new IncludeExcludeSet<>(PathMatcherSet.class);
|
||||||
IncludeExcludeSet<PathMatcher, Path> prev = _scannables.putIfAbsent(real, includesExcludes);
|
IncludeExcludeSet<PathMatcher, Path> prev = _scannables.putIfAbsent(p.toRealPath(), includesExcludes);
|
||||||
if (prev != null)
|
if (prev != null)
|
||||||
includesExcludes = prev;
|
includesExcludes = prev;
|
||||||
return includesExcludes;
|
return includesExcludes;
|
||||||
|
|
Loading…
Reference in New Issue