Merged gcj-eclipse branch to trunk.
From-SVN: r120621
This commit is contained in:
parent
c648dedbde
commit
97b8365caf
17478 changed files with 606493 additions and 100744 deletions
|
@ -112,8 +112,10 @@ public class ActivatableRef extends UnicastRef
|
|||
public void readExternal(ObjectInput in) throws IOException,
|
||||
ClassNotFoundException
|
||||
{
|
||||
super.readExternal(in);
|
||||
actId = (ActivationID) in.readObject();
|
||||
String type = in.readUTF();
|
||||
// XXX handle type.equals("") (null reference)
|
||||
super.readExternal(in);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,8 +123,10 @@ public class ActivatableRef extends UnicastRef
|
|||
*/
|
||||
public void writeExternal(ObjectOutput out) throws IOException
|
||||
{
|
||||
super.writeExternal(out);
|
||||
out.writeObject(actId);
|
||||
// XXX write a "" if the "nested" reference is a null reference
|
||||
out.writeUTF("UnicastRef2");
|
||||
super.writeExternal(out);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* RMIClassLoaderImpl.java -- FIXME: briefly describe file purpose
|
||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
||||
|
@ -38,6 +38,7 @@ exception statement from your version. */
|
|||
|
||||
package gnu.java.rmi.server;
|
||||
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
|
@ -186,6 +187,7 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi
|
|||
{
|
||||
defaultClassLoader = new MyClassLoader (new URL[] { defaultCodebase }, null,
|
||||
defaultAnnotation);
|
||||
// XXX using getContextClassLoader here *cannot* be right
|
||||
cacheLoaders.put (new CacheKey (defaultAnnotation,
|
||||
Thread.currentThread().getContextClassLoader()),
|
||||
defaultClassLoader);
|
||||
|
@ -216,47 +218,53 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi
|
|||
ClassLoader defaultLoader)
|
||||
throws MalformedURLException, ClassNotFoundException
|
||||
{
|
||||
ClassLoader loader;
|
||||
if (defaultLoader == null)
|
||||
loader = Thread.currentThread().getContextClassLoader();
|
||||
else
|
||||
loader = defaultLoader;
|
||||
|
||||
//try context class loader first
|
||||
try
|
||||
{
|
||||
return Class.forName(name, false, loader);
|
||||
if (defaultLoader != null)
|
||||
return Class.forName(name, false, defaultLoader);
|
||||
}
|
||||
catch (ClassNotFoundException e)
|
||||
{
|
||||
// class not found in the local classpath
|
||||
}
|
||||
|
||||
if (codeBase.length() == 0) //==""
|
||||
{
|
||||
loader = defaultClassLoader;
|
||||
}
|
||||
else
|
||||
{
|
||||
loader = getClassLoader(codeBase);
|
||||
}
|
||||
|
||||
if (loader == null)
|
||||
{
|
||||
//do not throw NullPointerException
|
||||
throw new ClassNotFoundException ("Could not find class (" + name +
|
||||
") at codebase (" + codeBase + ")");
|
||||
}
|
||||
|
||||
return Class.forName(name, false, loader);
|
||||
return Class.forName(name, false, getClassLoader(codeBase));
|
||||
}
|
||||
|
||||
public Class loadProxyClass(String codeBase, String[] interfaces,
|
||||
ClassLoader defaultLoader)
|
||||
throws MalformedURLException, ClassNotFoundException
|
||||
{
|
||||
// FIXME: Implement this.
|
||||
return null;
|
||||
Class clss[] = new Class[interfaces.length];
|
||||
|
||||
for (int i = 0; i < interfaces.length; i++)
|
||||
{
|
||||
clss[i] = loadClass(codeBase, interfaces[i], defaultLoader);
|
||||
}
|
||||
|
||||
// Chain all class loaders (they may differ).
|
||||
ArrayList loaders = new ArrayList(clss.length);
|
||||
ClassLoader loader = null;
|
||||
for (int i = 0; i < clss.length; i++)
|
||||
{
|
||||
loader = clss[i].getClassLoader();
|
||||
if (! loaders.contains(loader))
|
||||
{
|
||||
loaders.add(0, loader);
|
||||
}
|
||||
}
|
||||
if (loaders.size() > 1)
|
||||
{
|
||||
loader = new CombinedClassLoader(loaders);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return Proxy.getProxyClass(loader, clss);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
throw new ClassNotFoundException(null, e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,6 +280,9 @@ public class RMIClassLoaderImpl extends RMIClassLoaderSpi
|
|||
public ClassLoader getClassLoader(String codebase)
|
||||
throws MalformedURLException
|
||||
{
|
||||
if (codebase == null || codebase.length() == 0)
|
||||
return Thread.currentThread().getContextClassLoader();
|
||||
|
||||
ClassLoader loader;
|
||||
CacheKey loaderKey = new CacheKey
|
||||
(codebase, Thread.currentThread().getContextClassLoader());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* RMIObjectInputStream.java --
|
||||
Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004
|
||||
Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004, 2006
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Classpath.
|
||||
|
@ -39,11 +39,11 @@ exception statement from your version. */
|
|||
|
||||
package gnu.java.rmi.server;
|
||||
|
||||
import gnu.classpath.VMStackWalker;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectStreamClass;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.net.MalformedURLException;
|
||||
import java.rmi.server.RMIClassLoader;
|
||||
import java.util.ArrayList;
|
||||
|
@ -57,16 +57,14 @@ public RMIObjectInputStream(InputStream strm) throws IOException {
|
|||
}
|
||||
|
||||
protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
|
||||
String annotation = (String)getAnnotation();
|
||||
|
||||
try {
|
||||
if(annotation == null)
|
||||
return (RMIClassLoader.loadClass(desc.getName()));
|
||||
else
|
||||
return (RMIClassLoader.loadClass(annotation, desc.getName()));
|
||||
return RMIClassLoader.loadClass(
|
||||
(String)getAnnotation(),
|
||||
desc.getName(),
|
||||
VMStackWalker.firstNonNullClassLoader());
|
||||
}
|
||||
catch (MalformedURLException _) {
|
||||
throw new ClassNotFoundException(desc.getName());
|
||||
catch (MalformedURLException x) {
|
||||
throw new ClassNotFoundException(desc.getName(), x);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -81,45 +79,16 @@ protected Object getAnnotation()
|
|||
protected Class resolveProxyClass(String intfs[]) throws IOException,
|
||||
ClassNotFoundException
|
||||
{
|
||||
String annotation = (String) getAnnotation();
|
||||
|
||||
Class clss[] = new Class[intfs.length];
|
||||
|
||||
for (int i = 0; i < intfs.length; i++)
|
||||
try
|
||||
{
|
||||
if (annotation == null)
|
||||
clss[i] = RMIClassLoader.loadClass(intfs[i]);
|
||||
else
|
||||
clss[i] = RMIClassLoader.loadClass(annotation, intfs[i]);
|
||||
return RMIClassLoader.loadProxyClass(
|
||||
(String)getAnnotation(),
|
||||
intfs,
|
||||
VMStackWalker.firstNonNullClassLoader());
|
||||
}
|
||||
|
||||
ClassLoader loader;
|
||||
|
||||
if (clss.length > 0)
|
||||
catch (MalformedURLException x)
|
||||
{
|
||||
// Chain all class loaders (they may differ).
|
||||
ArrayList loaders = new ArrayList(intfs.length);
|
||||
ClassLoader cx;
|
||||
for (int i = 0; i < clss.length; i++)
|
||||
{
|
||||
cx = clss[i].getClassLoader();
|
||||
if (!loaders.contains(cx))
|
||||
{
|
||||
loaders.add(0, cx);
|
||||
}
|
||||
}
|
||||
loader = new CombinedClassLoader(loaders);
|
||||
}
|
||||
else
|
||||
loader = ClassLoader.getSystemClassLoader();
|
||||
|
||||
try
|
||||
{
|
||||
return Proxy.getProxyClass(loader, clss);
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
throw new ClassNotFoundException(null, e);
|
||||
throw new ClassNotFoundException(null, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue