/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code 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 General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* @test
* @bug 4137605
* @summary When the RMIClassLoader.getClassAnnotation() is called with a
* class loaded from any URLClassLoader instance (not just those created for
* internal use by the RMI runtime), then it should return a String containing
* a space-separated list of the class loader's path of URLs.
* @author Peter Jones
*
* @library ../../../testlibrary
* @build TestLibrary Dummy
* @run main/othervm/policy=security.policy/timeout=120 UseGetURLs
*/
public class UseGetURLs {
/*
* Install dummy class in first codebase to be loaded from an
* arbitrary URLClassLoader; the second codebase is used to make
* the desired annotation more interesting (more than one element).
*/
try {
"codebase1");
"codebase2");
} catch (MalformedURLException e) {
}
try {
/*
* Create an arbitary URLClassLoader for the two codebases.
*/
"URLs for class loader: " +
/*
* Load dummy class from the loader, get the annotation string,
* and verify that it is correct.
*/
annotation + "\"");
if (annotation == null) {
throw new RuntimeException("annotation was null");
}
throw new RuntimeException(
"wrong number of elements in annotation");
}
throw new RuntimeException(
"first URL in annotation is incorrect");
}
throw new RuntimeException(
"second URL in annotation is incorrect");
}
} catch (Exception e) {
}
}
throws MalformedURLException
{
}
return urls;
}
}
}