(String name, ClassLoader parent)
| 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 | /** |
no test coverage detected