1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.classloader

File ExtendedURLClassLoader.java

 

Coverage histogram

../../../img/srcFileCovDistChart5.png
74% of files have more coverage

Code metrics

0
7
6
1
93
35
6
0.86
1.17
6
1

Classes

Class Line # Actions
ExtendedURLClassLoader 34 7 0% 6 7
0.4615384646.2%
 

Contributing tests

This file is covered by 79 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.classloader;
21   
22    import java.net.URL;
23    import java.net.URLClassLoader;
24    import java.net.URLStreamHandlerFactory;
25    import java.util.List;
26   
27    /**
28    * Implementation that allows adding URLs on demand (the default {@link URLClassLoader} only allows adding URLs in the
29    * constructor).
30    *
31    * @version $Id: 873f6cc673244426a2aca74a59ac7f8b9647d9dd $
32    * @since 2.0.1
33    */
 
34    public class ExtendedURLClassLoader extends URLClassLoader
35    {
36    /**
37    * See {@link URLClassLoader#URLClassLoader(URL[], ClassLoader, URLStreamHandlerFactory)}.
38    *
39    * @param urls the URLs from which to load classes and resources
40    * @param parent the parent class loader for delegation
41    * @param factory the URLStreamHandlerFactory to use when creating URLs
42    */
 
43  0 toggle public ExtendedURLClassLoader(URL[] urls, ClassLoader parent, URLStreamHandlerFactory factory)
44    {
45  0 super(urls, parent, factory);
46    }
47   
48    /**
49    * See {@link URLClassLoader#URLClassLoader(URL[], ClassLoader)}.
50    *
51    * @param urls the URLs from which to load classes and resources
52    * @param parent the parent class loader for delegation
53    */
 
54  20156 toggle public ExtendedURLClassLoader(URL[] urls, ClassLoader parent)
55    {
56  20158 super(urls, parent);
57    }
58   
59    /**
60    * See {@link URLClassLoader#URLClassLoader(URL[])}.
61    *
62    * @param urls the URLs from which to load classes and resources
63    */
 
64  2 toggle public ExtendedURLClassLoader(URL[] urls)
65    {
66  2 super(urls);
67    }
68   
69    /**
70    * @param parent the parent class loader for delegation
71    * @param factory the URLStreamHandlerFactory to use when creating URLs
72    */
 
73  0 toggle public ExtendedURLClassLoader(ClassLoader parent, URLStreamHandlerFactory factory)
74    {
75  0 this(new URL[0], parent, factory);
76    }
77   
 
78  2 toggle @Override
79    public void addURL(URL url)
80    {
81  2 super.addURL(url);
82    }
83   
84    /**
85    * @param urls the JAR URLs to add
86    */
 
87  0 toggle public void addURLs(List<URL> urls)
88    {
89  0 for (URL url : urls) {
90  0 addURL(url);
91    }
92    }
93    }