Merge pull request #10902 from jetty/jetty-12.0.x-addContainerResource
do not add duplicate jars to MetaData containerResources
This commit is contained in:
commit
4a91cb7464
|
@ -25,6 +25,7 @@ import java.util.Objects;
|
|||
import jakarta.servlet.ServletContext;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.resource.Resources;
|
||||
import org.eclipse.jetty.util.thread.AutoLock;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -714,8 +715,13 @@ public class MetaData
|
|||
|
||||
public void addContainerResource(Resource jar)
|
||||
{
|
||||
Objects.requireNonNull(jar);
|
||||
_orderedContainerResources.add(jar);
|
||||
if (!Resources.isReadable(jar))
|
||||
throw new IllegalArgumentException("Resource is not readable: " + jar);
|
||||
|
||||
if (!_orderedContainerResources.contains(jar))
|
||||
_orderedContainerResources.add(jar);
|
||||
else
|
||||
LOG.warn("Duplicate Container Resource {}", jar);
|
||||
}
|
||||
|
||||
public void setWebInfClassesResources(List<Resource> dirs)
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.util.Objects;
|
|||
import jakarta.servlet.ServletContext;
|
||||
import org.eclipse.jetty.util.URIUtil;
|
||||
import org.eclipse.jetty.util.resource.Resource;
|
||||
import org.eclipse.jetty.util.resource.Resources;
|
||||
import org.eclipse.jetty.util.thread.AutoLock;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -714,7 +715,13 @@ public class MetaData
|
|||
|
||||
public void addContainerResource(Resource jar)
|
||||
{
|
||||
_orderedContainerResources.add(jar);
|
||||
if (!Resources.isReadable(jar))
|
||||
throw new IllegalArgumentException("Resource is not readable: " + jar);
|
||||
|
||||
if (!_orderedContainerResources.contains(jar))
|
||||
_orderedContainerResources.add(jar);
|
||||
else
|
||||
LOG.warn("Duplicate Container Resource {}", jar);
|
||||
}
|
||||
|
||||
public void setWebInfClassesResources(List<Resource> dirs)
|
||||
|
|
Loading…
Reference in New Issue