ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/util/scan/TestStandardJarScanner.java

Path
ttomcat-1778514358873.zip-extract/apache-tomcat-11.0.18-src/test/org/apache/tomcat/util/scan/TestStandardJarScanner.java
Status
scanned
Type
file
Name
TestStandardJarScanner.java
Extension
.java
Programming language
Java
Mime type
text/plain
File type
ASCII text, with CRLF line terminators
Tag

      
    
Rootfs path

      
    
Size
3033 (3.0 KB)
MD5
61713cc440d6a540d7c3a9e094da20f5
SHA1
9d23e740ea00450408aaf3e88f518f78261c35f5
SHA256
e715faac16c62cce5b7f4bc1635e323234a2a88e4b415b52b22ec2107691cd49
SHA512

      
    
SHA1_git
eb4d7154182f513e119c7c9ab4a0295ff19f7da4
Is binary

      
    
Is text
True
Is archive

      
    
Is media

      
    
Is legal

      
    
Is manifest

      
    
Is readme

      
    
Is top level

      
    
Is key file

      
    
TestStandardJarScanner.java | 3.0 KB |

/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.tomcat.util.scan; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import java.net.URI; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.apache.tomcat.Jar; import org.apache.tomcat.JarScanType; import org.apache.tomcat.JarScannerCallback; import org.apache.tomcat.unittest.TesterServletContext; public class TestStandardJarScanner { /** * Tomcat should ignore URLs which do not have a file part and do not use the file scheme. */ @Test public void skipsInvalidClasspathURLNoFilePartNoFileScheme() { StandardJarScanner scanner = new StandardJarScanner(); LoggingCallback callback = new LoggingCallback(); TesterServletContext context = new TesterServletContext() { @Override public ClassLoader getClassLoader() { URLClassLoader urlClassLoader; try { urlClassLoader = new URLClassLoader( new URL[] { URI.create("http://felix.extensions:9/").toURL() }); } catch (MalformedURLException e) { throw new RuntimeException(e); } return urlClassLoader; } }; scanner.scan(JarScanType.PLUGGABILITY, context, callback); } private static class LoggingCallback implements JarScannerCallback { List<String> callbacks = new ArrayList<>(); @Override public void scan(Jar jar, String webappPath, boolean isWebapp) throws IOException { callbacks.add(jar.getJarFileURL().toString() + "::" + webappPath + "::" + isWebapp); } @Override public void scan(File file, String webappPath, boolean isWebapp) throws IOException { callbacks.add(file.toString() + "::" + webappPath + "::" + isWebapp); } @Override public void scanWebInfClasses() throws IOException { callbacks.add("N/A::WEB-INF/classes::N/A"); } } }
Detected license expression
apache-2.0
Detected license expression (SPDX)
Apache-2.0
Percentage of license text
38.26
Copyrights

      
    
Holders

      
    
Authors

      
    
License detections License expression License expression SPDX
apache_2_0-4bde3f57-78aa-4201-96bf-531cba09e7de apache-2.0 Apache-2.0
URL Start line End line
http://www.apache.org/licenses/LICENSE-2.0 9 9