Jetty 12 - Issue #8999 - Remove FileID.isArchive() from ResourceFactory (#9002)

* Issue #8999 - Remove FileID.isArchive() from ResourceFactory
* Remove FileID.isArchive() from URIUtil.toJarFileUri
This commit is contained in:
Joakim Erdfelt 2022-12-06 12:31:12 -06:00 committed by GitHub
parent fab644151a
commit 95fd8adeb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -1862,9 +1862,6 @@ public final class URIUtil
Objects.requireNonNull(uri, "URI");
String scheme = Objects.requireNonNull(uri.getScheme(), "URI scheme");
if (!FileID.isArchive(uri))
return uri;
boolean hasInternalReference = uri.getRawSchemeSpecificPart().indexOf("!/") > 0;
if (scheme.equalsIgnoreCase("jar"))
@ -1882,6 +1879,8 @@ public final class URIUtil
else if (scheme.equalsIgnoreCase("file"))
{
String rawUri = uri.toASCIIString();
if (rawUri.endsWith("/")) // skip directories
return uri;
if (hasInternalReference)
return URI.create("jar:" + rawUri);
else

View File

@ -20,7 +20,6 @@ import java.nio.file.Path;
import java.util.List;
import java.util.Objects;
import org.eclipse.jetty.util.FileID;
import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.URIUtil;
@ -237,8 +236,6 @@ public interface ResourceFactory
default Resource newJarFileResource(URI uri)
{
if (!FileID.isArchive(uri))
throw new IllegalArgumentException("Path is not a Java Archive: " + uri);
if (!uri.getScheme().equalsIgnoreCase("file"))
throw new IllegalArgumentException("Not an allowed path: " + uri);
return newResource(URIUtil.toJarFileUri(uri));