public static Class loadClass(String codebase, String name, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader) throws MalformedURLException, ClassNotFoundException { try { return ClassLoading.loadClass(codebase, name, defaultLoader, verifyCodebaseIntegrity, verifierLoader); } catch (NoSuchMethodError e){ // Ignore, earlier version of River. } return RMIClassLoader.loadClass(codebase, name, defaultLoader); }
/** * Converts this descriptor to a Class instance, loading from codebase * * @param codebase String the codebase to load the class from * @return Class the class this descriptor represents */ public Class toClass(String codebase) throws IOException, ClassNotFoundException { if (name.charAt(0) != ';') { return ClassLoading.loadClass( codebase, name, null, integrity, null); } StringTokenizer st = new StringTokenizer(name, ";"); String[] ifs = new String[st.countTokens()]; for (int i = 0; i < ifs.length; i++) { ifs[i] = st.nextToken(); } return ClassLoading.loadProxyClass( codebase, ifs, null, integrity, null); }
public static String getClassAnnotation(Class clas){ try { return ClassLoading.getClassAnnotation(clas); } catch (NoSuchMethodError e){ // Ignore, earlier version of River. } return RMIClassLoader.getClassAnnotation(clas); }
public static Class loadProxyClass(String codebase, String[] interfaceNames, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader) throws MalformedURLException, ClassNotFoundException { try { return ClassLoading.loadProxyClass(codebase, interfaceNames, defaultLoader, verifyCodebaseIntegrity, verifierLoader); } catch (NoSuchMethodError e){ // Ignore, earlier version of River. } return RMIClassLoader.loadProxyClass(codebase, interfaceNames, defaultLoader); } }
if (verifyCodebaseIntegrity && codebase != null) { try { verifyIntegrity(codebase, verifierLoader); } catch (SecurityException e) { verifyException = e;
public ClassLoader run() throws IOException { Thread currentThread = Thread.currentThread(); ClassLoader context = currentThread.getContextClassLoader(); try { currentThread.setContextClassLoader(parent); return ClassLoading.getClassLoader(path); } finally { if (context != null) currentThread.setContextClassLoader(context); } } }
/** * Installs a new RMIClassLoaderSpi provider with the ClassLoader * provided. * * @param providerName fully defined class name of the provider, if null, * a new provider instance will be determined by system properties. * @param providerLoader The class loader to be used to load * provider-configuration files and provider classes, or null if the * system class loader (or, failing that, the bootstrap class loader) * is to be used. * @return true if successful. * @throws SecurityException if caller doesn't have RuntimePermission "getFactory" */ public static boolean installNewProvider( String providerName, ClassLoader providerLoader) { permission.checkGuard(null); synchronized (lock){ return provider(providerName, providerLoader); } }
String codebase = usingCodebaseAnnotations ? annotation : null; return ClassLoading.loadProxyClass(codebase, interfaceNames, defaultLoader,
if (verifyCodebaseIntegrity && codebase != null) { try { verifyIntegrity(codebase, verifierLoader); } catch (SecurityException e) { verifyException = e;
@Override public Object run() { ClassLoader bcl = base.getClassLoader(); if (bcl == null) { return null; } ClassLoader pcl = bcl.getParent(); Thread t = Thread.currentThread(); ClassLoader ccl = t.getContextClassLoader(); boolean proper = false; try { t.setContextClassLoader(pcl); proper = (ClassLoading.getClassLoader(bcb) == bcl); } catch (MalformedURLException e) { } finally { t.setContextClassLoader(ccl); } if (proper) { try { return Proxy.newProxyInstance( pcl, new Class[]{ProxyTrust.class, RemoteMethodControl.class}, ih); } catch (IllegalArgumentException e) { } } return null; } });
return ClassLoading.loadClass(codebase, name, defaultLoader,
private void writeAnnotation(final Class c) throws IOException { String cb = ClassLoading.getClassAnnotation(c); writeObject(cb); if (bcb.equals(cb)) { AccessController.doPrivileged(new PrivilegedAction() { @Override public Object run() { if (c.getClassLoader() != bcl) { replace = true; } return null; } }); } } }
String codebase = usingCodebaseAnnotations ? annotation : null; return ClassLoading.loadProxyClass(codebase, interfaceNames, defaultLoader,
if (verifyCodebaseIntegrity && codebase != null) { try { verifyIntegrity(codebase, verifierLoader); } catch (SecurityException e) { verifyException = e;
return ClassLoading.loadClass(codebase, name, defaultLoader,
/** * Annotates the stream descriptor for the class <code>cl</code>. * * <p><code>MarshalOutputStream</code> implements this method as * follows: * * <p>This method invokes {@link RMIClassLoaderSpi#getClassAnnotation * RMIClassLoaderSpi.getClassAnnotation} with <code>cl</code> to get * the appropriate class annotation string value (possibly * <code>null</code>), and then it invokes this stream's {@link * #writeAnnotation writeAnnotation} method with that string to * record the annotation. * * @param cl the class to annotate * * @throws IOException if <code>writeAnnotation</code> throws an * <code>IOException</code> * * @throws NullPointerException if <code>cl</code> is * <code>null</code> **/ @Override protected void annotateClass(Class cl) throws IOException { writeAnnotation(ClassLoading.getClassAnnotation(cl)); }
if (verifyCodebaseIntegrity && codebase != null) { try { verifyIntegrity(codebase, verifierLoader); } catch (SecurityException e) { verifyException = e;
ActivationGroupDesc desc = in.readObject(ActivationGroupDesc.class); long incarnation = in.readLong(); Class cl = ClassLoading.loadClass(desc.getLocation(), desc.getClassName(), null, false, null); try {
/** * Annotates the stream descriptor for the proxy class * <code>cl</code>. * * <p><code>MarshalOutputStream</code> implements this method as * follows: * * <p>This method invokes {@link RMIClassLoaderSpi#getClassAnnotation * RMIClassLoaderSpi.getClassAnnotation} with <code>cl</code> to get * the appropriate class annotation string value (possibly * <code>null</code>), and then it invokes this stream's {@link * #writeAnnotation writeAnnotation} method with that string to * record the annotation. * * @param cl the proxy class to annotate * * @throws IOException if <code>writeAnnotation</code> throws an * <code>IOException</code> * * @throws NullPointerException if <code>cl</code> is * <code>null</code> **/ @Override protected void annotateProxyClass(Class cl) throws IOException { writeAnnotation(ClassLoading.getClassAnnotation(cl)); }
public Class toClass(String codebase) throws IOException, ClassNotFoundException { Class cls = ClassLoading.loadClass(codebase, name, null, integrity, null); EntryClass local; try { local = ClassMapper.toEntryClassBase(cls).eclass; } catch (MarshalException e) { throw new UnmarshalException("problem obtaining local version of " + toString(), e); } if (hash != local.hash) throw new UnmarshalException("incoming entry type: " + toString() + " is not assignable to the local" + " version of the type: " + local); return cls; }