Merge remote-tracking branch 'origin/jetty-9.4.x' into jetty-10.0.x

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2019-07-03 11:55:03 +02:00
commit 0ddf4fd044
3 changed files with 16 additions and 12 deletions

View File

@ -187,6 +187,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

@ -19,6 +19,7 @@
package org.eclipse.jetty.util.resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
@ -384,10 +385,9 @@ public class PathResource extends Resource
@Override
public InputStream getInputStream() throws IOException
{
if (Files.isDirectory(path))
throw new IOException(path + " is a directory");
return Files.newInputStream(path, StandardOpenOption.READ);
// Use a FileInputStream rather than Files.newInputStream(path)
// since it produces a stream with a fast skip implementation
return new FileInputStream(getFile());
}
@Override

View File

@ -758,14 +758,13 @@ public class ClassMatcher 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();
return Boolean.TRUE.equals(byName) || Boolean.TRUE.equals(byLocation) || !(names.hasIncludes() || locations.hasIncludes());
}
return false;
Boolean byLocation = locations.isIncludedAndNotExcluded(uri);
if (Boolean.FALSE == byLocation)
return false;
return Boolean.TRUE.equals(byName) || Boolean.TRUE.equals(byLocation) || !(names.hasIncludes() || locations.hasIncludes());
}
}