/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.classloader;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.util.Arrays;
import java.util.stream.Collectors;

import org.xwiki.stability.Unstable;

/**
 * An {@link ExtendedURLClassLoader} associated with a namespace. The namespace can be anything.
 * For example it's used by the Extension Manager to have one classloader per wiki using a
 * namespace of the type {@code wiki:wikiname}.
 *
 * @version $Id$
 * @since 4.0M1
 */
public class NamespaceURLClassLoader extends ExtendedURLClassLoader
{
    /**
     * @see #getNamespace()
     */
    private String namespace;

    /**
     * @param uris the search path
     * @param parent the parent class loader
     * @param namespace see {@link #getNamespace()}
     * @deprecated since 12.5RC1 prefer using
     *      {@link NamespaceURLClassLoader#NamespaceURLClassLoader(URL[], ClassLoader, String)}.
     */
    @Deprecated
    public NamespaceURLClassLoader(URI[] uris, ClassLoader parent, String namespace)
    {
        this(Arrays.stream(uris).map(uri -> {
            try {
                return uri.toURL();
            } catch (MalformedURLException e) {
                throw new RuntimeException(e);
            }
        }).collect(Collectors.toList()).toArray(new URL[0]), parent, namespace);
    }

    /**
     * @param urls the search path.
     * @param parent the parent class loader
     * @param namespace see {@link #getNamespace()}
     * @since 12.5RC1
     */
    @Unstable
    public NamespaceURLClassLoader(URL[] urls, ClassLoader parent, String namespace)
    {
        super(urls, parent);
        this.namespace = namespace;
    }

    /**
     * @param parent the parent class loader
     * @param namespace see {@link #getNamespace()}
     * @since 12.5RC1
     */
    @Unstable
    public NamespaceURLClassLoader(ClassLoader parent, String namespace)
    {
        this(new URL[]{}, parent, namespace);
    }

    /**
     * @return the namespace associated with the classloader
     */
    public String getNamespace()
    {
        return this.namespace;
    }
}

@@ -1200,19 +1200,16 @@
 nything.
-%0A *
  For exa
@@ -1222,16 +1222,19 @@
 t's used
+%0A *
  by the 
@@ -1291,19 +1291,16 @@
  using a
-%0A *
  namespa
@@ -1714,16 +1714,23 @@
 g%0A     *
+       
       %7B@
@@ -2822,16 +2822,17 @@
 ew URL%5B%5D
+ 
 %7B%7D, pare

Apply codestyle