Issue #3700 better handling of null location (#3837)

Issue #3700 if a location is null then consider if there are inclusions and/or exclusions when matching a class.
Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-07-03 11:48:09 +02:00 committed by GitHub
parent 21857f0b81
commit 5c91e44eaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 8 deletions

View File

@ -193,6 +193,11 @@ public class IncludeExcludeSet<T, P> implements Predicate<P>
return !_includes.isEmpty();
}
public boolean hasExcludes()
{
return !_excludes.isEmpty();
}
public int size()
{
return _includes.size() + _excludes.size();

View File

@ -734,14 +734,14 @@ public class ClasspathPattern extends AbstractSet<String>
return false;
URI uri = location.get();
if (uri != null)
{
Boolean byLocation = locations.isIncludedAndNotExcluded(uri);
if (Boolean.FALSE == byLocation)
return false;
if (uri == null)
return locations.isEmpty() || locations.hasExcludes() && !locations.hasIncludes();
Boolean byLocation = locations.isIncludedAndNotExcluded(uri);
if (Boolean.FALSE == byLocation)
return false;
return Boolean.TRUE.equals(byName) || Boolean.TRUE.equals(byLocation) || !(names.hasIncludes() || locations.hasIncludes());
return Boolean.TRUE.equals(byName) || Boolean.TRUE.equals(byLocation) || !(names.hasIncludes() || locations.hasIncludes());
}
return false;
}
}