home *** CD-ROM | disk | FTP | other *** search
- package sun.rmi.server;
-
- import java.io.IOException;
- import java.io.ObjectOutputStream;
- import java.io.OutputStream;
- import java.net.MalformedURLException;
- import java.net.URL;
- import java.rmi.Remote;
- import sun.rmi.transport.Utils;
-
- public class MarshalOutputStream extends ObjectOutputStream {
- private static String codebase = Utils.getProperty("java.rmi.server.codebase");
-
- public MarshalOutputStream(OutputStream var1) throws IOException {
- super(var1);
- ((ObjectOutputStream)this).enableReplaceObject(true);
- }
-
- protected Object replaceObject(Object var1) throws IOException {
- if (var1 instanceof Remote) {
- var1 = RemoteProxy.getProxy((Remote)var1);
- }
-
- return var1;
- }
-
- protected void annotateClass(Class var1) throws IOException {
- String var2 = null;
- String var3 = var1.getName();
- if (!var3.startsWith("java.")) {
- ClassLoader var4 = var1.getClassLoader();
- if (var4 != null) {
- if (var4 instanceof RMIClassLoader) {
- RMIClassLoader var5 = (RMIClassLoader)var4;
- var2 = var5.getCodeBase().toExternalForm();
- } else {
- SecurityManager var7 = System.getSecurityManager();
- Object var6;
- if (var7 != null && (var6 = var7.getSecurityContext()) != null && var6 instanceof URL) {
- var2 = ((URL)var6).toExternalForm();
- }
- }
- }
-
- if (var2 == null) {
- var2 = codebase;
- }
- }
-
- ((ObjectOutputStream)this).writeObject(var2);
- }
-
- static {
- if (codebase != null) {
- try {
- new URL(codebase);
- } catch (MalformedURLException var0) {
- codebase = null;
- }
- }
- }
- }
-