1327N/A/*
2362N/A * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
1327N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1327N/A *
1327N/A * This code is free software; you can redistribute it and/or modify it
1327N/A * under the terms of the GNU General Public License version 2 only, as
1327N/A * published by the Free Software Foundation.
1327N/A *
1327N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1327N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1327N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1327N/A * version 2 for more details (a copy is included in the LICENSE file that
1327N/A * accompanied this code).
1327N/A *
1327N/A * You should have received a copy of the GNU General Public License version
1327N/A * 2 along with this work; if not, write to the Free Software Foundation,
1327N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1327N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
1327N/A */
1327N/A
1327N/A/*
1327N/A * @test
1327N/A * @bug 6827999
1327N/A * @run main/othervm B6827999
1327N/A * @summary Fix for 6827999
1327N/A */
1327N/A
1327N/Aimport java.net.*;
1327N/Aimport java.io.*;
1327N/A
1327N/A/**
1327N/A */
1327N/A
1327N/Apublic class B6827999
1327N/A{
1327N/A public static void main(String[] args) throws Exception {
1327N/A
1327N/A URL[] urls = new URL[] {new URL("http://foobar.jar") };
1327N/A MyURLClassLoader ucl = new MyURLClassLoader(urls);
1327N/A
1327N/A ucl.addURL(new URL("http://foo/bar.jar"));
1327N/A urls = ucl.getURLs();
1327N/A
1327N/A if (urls.length != 2)
1327N/A throw new RuntimeException("Failed:(1)");
1327N/A ucl.close();
1327N/A
1327N/A ucl.addURL(new URL("http://foo.bar/bar.jar"));
1327N/A
1327N/A if (ucl.getURLs().length != 2) {
1327N/A throw new RuntimeException("Failed:(2)");
1327N/A }
1327N/A
1327N/A }
1327N/A
1327N/A static class MyURLClassLoader extends URLClassLoader {
1327N/A public MyURLClassLoader(URL[] urls) {
1327N/A super(urls);
1327N/A }
1327N/A public void addURL(URL url) {
1327N/A super.addURL(url);
1327N/A }
1327N/A }
1327N/A
1327N/A}