aboutsummaryrefslogtreecommitdiff
path: root/src/main/javassist/tools/rmi/ObjectImporter.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/javassist/tools/rmi/ObjectImporter.java')
-rw-r--r--src/main/javassist/tools/rmi/ObjectImporter.java39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/main/javassist/tools/rmi/ObjectImporter.java b/src/main/javassist/tools/rmi/ObjectImporter.java
index e6692ef..798279a 100644
--- a/src/main/javassist/tools/rmi/ObjectImporter.java
+++ b/src/main/javassist/tools/rmi/ObjectImporter.java
@@ -1,11 +1,12 @@
/*
* Javassist, a Java-bytecode translator toolkit.
- * Copyright (C) 1999-2007 Shigeru Chiba. All Rights Reserved.
+ * Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. Alternatively, the contents of this file may be used under
- * the terms of the GNU Lesser General Public License Version 2.1 or later.
+ * the terms of the GNU Lesser General Public License Version 2.1 or later,
+ * or the Apache License Version 2.0.
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
@@ -15,10 +16,16 @@
package javassist.tools.rmi;
-import java.io.*;
-import java.net.*;
-import java.applet.Applet;
-import java.lang.reflect.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.net.Socket;
+import java.net.URL;
/**
* The object importer enables applets to call a method on a remote
@@ -72,6 +79,8 @@ import java.lang.reflect.*;
* @see javassist.tools.web.Viewer
*/
public class ObjectImporter implements java.io.Serializable {
+ /** default serialVersionUID */
+ private static final long serialVersionUID = 1L;
private final byte[] endofline = { 0x0d, 0x0a };
private String servername, orgServername;
private int port, orgPort;
@@ -87,7 +96,8 @@ public class ObjectImporter implements java.io.Serializable {
*
* @param applet the applet loaded from the <code>Webserver</code>.
*/
- public ObjectImporter(Applet applet) {
+ public ObjectImporter(@SuppressWarnings("deprecation") java.applet.Applet applet) {
+ @SuppressWarnings("deprecation")
URL codebase = applet.getCodeBase();
orgServername = servername = codebase.getHost();
orgPort = port = codebase.getPort();
@@ -99,10 +109,10 @@ public class ObjectImporter implements java.io.Serializable {
* <p>If you run a program with <code>javassist.tools.web.Viewer</code>,
* you can construct an object importer as follows:
*
- * <ul><pre>
+ * <pre>
* Viewer v = (Viewer)this.getClass().getClassLoader();
* ObjectImporter oi = new ObjectImporter(v.getServer(), v.getPort());
- * </pre></ul>
+ * </pre>
*
* @see javassist.tools.web.Viewer
*/
@@ -182,13 +192,13 @@ public class ObjectImporter implements java.io.Serializable {
throw new ObjectNotFoundException(name);
}
- private static final Class[] proxyConstructorParamTypes
+ private static final Class<?>[] proxyConstructorParamTypes
= new Class[] { ObjectImporter.class, int.class };
private Object createProxy(int oid, String classname) throws Exception {
- Class c = Class.forName(classname);
- Constructor cons = c.getConstructor(proxyConstructorParamTypes);
- return cons.newInstance(new Object[] { this, new Integer(oid) });
+ Class<?> c = Class.forName(classname);
+ Constructor<?> cons = c.getConstructor(proxyConstructorParamTypes);
+ return cons.newInstance(new Object[] { this, Integer.valueOf(oid) });
}
/**
@@ -266,8 +276,7 @@ public class ObjectImporter implements java.io.Serializable {
if (result)
return rvalue;
- else
- throw new RemoteException(errmsg);
+ throw new RemoteException(errmsg);
}
private void skipHeader(InputStream in) throws IOException {