MCPcopy Index your code
hub / github.com/apache/tomcat / createClassLoader

Method createClassLoader

java/org/apache/catalina/startup/Bootstrap.java:159–196  ·  view source on GitHub ↗
(String name, ClassLoader parent)

Source from the content-addressed store, hash-verified

157
158
159 private ClassLoader createClassLoader(String name, ClassLoader parent) throws Exception {
160
161 String value = CatalinaProperties.getProperty(name + ".loader");
162 if ((value == null) || (value.isEmpty())) {
163 return parent;
164 }
165
166 value = replace(value);
167
168 List<Repository> repositories = new ArrayList<>();
169
170 String[] repositoryPaths = getPaths(value);
171
172 for (String repository : repositoryPaths) {
173 // Check for a JAR URL repository
174 try {
175 URI uri = new URI(repository);
176 @SuppressWarnings("unused")
177 URL url = uri.toURL();
178 repositories.add(new Repository(repository, RepositoryType.URL));
179 continue;
180 } catch (IllegalArgumentException | MalformedURLException | URISyntaxException e) {
181 // Ignore
182 }
183
184 // Local repository
185 if (repository.endsWith("*.jar")) {
186 repository = repository.substring(0, repository.length() - "*.jar".length());
187 repositories.add(new Repository(repository, RepositoryType.GLOB));
188 } else if (repository.endsWith(".jar")) {
189 repositories.add(new Repository(repository, RepositoryType.JAR));
190 } else {
191 repositories.add(new Repository(repository, RepositoryType.DIR));
192 }
193 }
194
195 return ClassLoaderFactory.createClassLoader(repositories, parent);
196 }
197
198
199 /**

Callers 1

initClassLoadersMethod · 0.95

Calls 8

getPropertyMethod · 0.95
replaceMethod · 0.95
getPathsMethod · 0.95
createClassLoaderMethod · 0.95
endsWithMethod · 0.80
lengthMethod · 0.80
addMethod · 0.65
isEmptyMethod · 0.45

Tested by

no test coverage detected