undefect. CWE-407 — 63 sites patched across 27 ecosystems

Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
This commit is contained in:
russell@unturf.com 2026-03-26 17:11:57 -04:00
commit 0a580b313d
70422 changed files with 17213626 additions and 0 deletions

View file

@ -0,0 +1,91 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 4180282
* @summary RMI needs a mechanism to dynamically change a VMs RMI
* serverHostname. If the java.rmi.server.hostname property is
* changed dynamically, newly exported objects should be exported
* with the new hostname instead of the value of the
* java.rmi.server.hostname property when the first object was exported.
*
* @author Ann Wollrath
*
* @build ChangeHostName ChangeHostName_Stub
* @run main/othervm ChangeHostName
*/
import java.net.InetAddress;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject;
public class ChangeHostName
extends UnicastRemoteObject
implements Receiver
{
public ChangeHostName() throws RemoteException {
}
public void receive(Remote obj) {
System.err.println("received: " + obj.toString());
}
public static void main(String[] args) throws Exception {
InetAddress localAddress = InetAddress.getLocalHost();
String[] hostlist = new String[] {
localAddress.getHostAddress(), localAddress.getHostName() };
for (int i = 0; i < hostlist.length; i++) {
System.setProperty("java.rmi.server.hostname", hostlist[i]);
Remote impl = new ChangeHostName();
System.err.println("\ncreated impl extending URO: " + impl);
Receiver stub = (Receiver) RemoteObject.toStub(impl);
System.err.println("stub for impl: " + stub);
System.err.println("invoking method on stub");
stub.receive(stub);
UnicastRemoteObject.unexportObject(impl, true);
System.err.println("unexported impl");
if (stub.toString().indexOf(hostlist[i]) >= 0) {
System.err.println("stub's ref contains hostname: " +
hostlist[i]);
} else {
throw new RuntimeException(
"TEST FAILED: stub's ref doesn't contain hostname: " +
hostlist[i]);
}
}
System.err.println("TEST PASSED");
}
}
interface Receiver extends Remote {
void receive(Remote obj) throws RemoteException;
}

View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
public final class ChangeHostName_Stub
extends java.rmi.server.RemoteStub
implements Receiver, java.rmi.Remote
{
private static final long serialVersionUID = 2;
private static java.lang.reflect.Method $method_receive_0;
static {
try {
$method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
} catch (java.lang.NoSuchMethodException e) {
throw new java.lang.NoSuchMethodError(
"stub class initialization failed");
}
}
// constructors
public ChangeHostName_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
// methods from remote interfaces
// implementation of receive(Remote)
public void receive(java.rmi.Remote $param_Remote_1)
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,67 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
/*
* Portions Copyright (c) 2011 IBM Corporation
*/
/*
* @test
* @bug 6597112
* @summary GC'ing objects whilst being exported to RMI should not cause exceptions
* @author Neil Richards <neil.richards@ngmr.net>, <neil_richards@uk.ibm.com>
* @run main/othervm GcDuringExport
* @key intermittent
*/
import java.rmi.Remote;
import java.rmi.server.UnicastRemoteObject;
public class GcDuringExport {
private static final long MAX_EXPORT_ITERATIONS = 50000;
public static void main(String[] args) throws Exception {
Thread gcInducingThread = new Thread() {
public void run() {
while (true) {
System.gc();
try { Thread.sleep(1); } catch (InterruptedException e) { }
}
}
};
gcInducingThread.setDaemon(true);
gcInducingThread.start();
long i = 0;
try {
while (i < MAX_EXPORT_ITERATIONS) {
i++;
UnicastRemoteObject.exportObject(new Remote() { }, 0);
}
} catch (Throwable e) {
throw new RuntimeException("Test FAILED on iteration " + i + ".", e);
}
System.out.println("Test successfully exported " + i + " objects.");
}
}

View file

@ -0,0 +1,146 @@
/*
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 4308492
* @summary In addition to keeping the VM alive (with a non-daeman thread)
* while there are remote objects exported, the RMI runtime should also
* keep it alive while there remain calls in progress (to remote objects
* the have presumably been unexported), so that a remote object can more
* conveniently implement a graceful remote shutdown method (that unexports
* the object).
* @author Peter Jones
*
* @library ../../../testlibrary
* @modules java.rmi/sun.rmi.registry
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
* @build TestLibrary JavaVM KeepAliveDuringCall_Stub
* ShutdownMonitor Shutdown ShutdownImpl ShutdownImpl_Stub
* @run main/othervm KeepAliveDuringCall
*/
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class KeepAliveDuringCall implements ShutdownMonitor {
public static final String BINDING = "KeepAliveDuringCall";
private static final int TIMEOUT = 20000;
private Object lock = new Object();
private Shutdown shutdown = null;
private boolean stillAlive = false;
public void submitShutdown(Shutdown shutdown) {
synchronized (lock) {
this.shutdown = shutdown;
lock.notifyAll();
}
}
public void declareStillAlive() {
synchronized (lock) {
stillAlive = true;
lock.notifyAll();
}
}
public static void main(String[] args) {
System.err.println("\nRegression test for bug 4308492\n");
KeepAliveDuringCall obj = new KeepAliveDuringCall();
JavaVM jvm = null;
try {
UnicastRemoteObject.exportObject(obj);
System.err.println("exported shutdown monitor");
Registry localRegistry = TestLibrary.createRegistryOnEphemeralPort();
int registryPort = TestLibrary.getRegistryPort(localRegistry);
System.err.println("created local registry");
localRegistry.bind(BINDING, obj);
System.err.println("bound shutdown monitor in local registry");
System.err.println("starting remote ShutdownImpl VM...");
jvm = new JavaVM("ShutdownImpl",
"-Drmi.registry.port=" +
registryPort, "");
jvm.start();
Shutdown s;
synchronized (obj.lock) {
System.err.println(
"waiting for submission of object to shutdown...");
while ((s = obj.shutdown) == null) {
obj.lock.wait(TIMEOUT);
}
if (s == null) {
throw new RuntimeException(
"TEST FAILED: timeout waiting for shutdown object " +
"to make initial contact");
}
System.err.println("shutdown object submitted: " + s);
}
try {
s.shutdown();
} catch (RemoteException e) {
throw new RuntimeException(
"TEST FAILED: shutdown method threw remote exception", e);
}
synchronized (obj.lock) {
if (!obj.stillAlive) {
throw new RuntimeException("TEST FAILED: " +
"shutdown object not detected alive after unexport");
}
}
System.err.println("TEST PASSED: " +
"shutdown object detected still alive after unexport");
} catch (Exception e) {
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
} else {
throw new RuntimeException(
"TEST FAILED: unexpected exception", e);
}
} finally {
if (jvm != null) {
jvm.destroy();
}
try {
UnicastRemoteObject.unexportObject(obj, true);
} catch (RemoteException e) {
}
}
}
}

View file

@ -0,0 +1,82 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
public final class KeepAliveDuringCall_Stub
extends java.rmi.server.RemoteStub
implements ShutdownMonitor
{
private static final long serialVersionUID = 2;
private static java.lang.reflect.Method $method_declareStillAlive_0;
private static java.lang.reflect.Method $method_submitShutdown_1;
static {
try {
$method_declareStillAlive_0 = ShutdownMonitor.class.getMethod("declareStillAlive", new java.lang.Class[] {});
$method_submitShutdown_1 = ShutdownMonitor.class.getMethod("submitShutdown", new java.lang.Class[] {Shutdown.class});
} catch (java.lang.NoSuchMethodException e) {
throw new java.lang.NoSuchMethodError(
"stub class initialization failed");
}
}
// constructors
public KeepAliveDuringCall_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
// methods from remote interfaces
// implementation of declareStillAlive()
public void declareStillAlive()
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_declareStillAlive_0, null, -1562228924246272634L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
// implementation of submitShutdown(Shutdown)
public void submitShutdown(Shutdown $param_Shutdown_1)
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_submitShutdown_1, new java.lang.Object[] {$param_Shutdown_1}, 7574258166120515108L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
/*
*
*/
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface Shutdown extends Remote {
void shutdown() throws RemoteException;
}

View file

@ -0,0 +1,90 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
/*
*
*/
import java.rmi.Remote;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import java.rmi.server.UnicastRemoteObject;
public class ShutdownImpl implements Shutdown {
private static Remote impl; // rooted here to prevent GC
private final ShutdownMonitor monitor;
private ShutdownImpl(ShutdownMonitor monitor) {
this.monitor = monitor;
}
public void shutdown() {
try {
System.err.println(
"(ShutdownImpl.shutdown) shutdown method invoked:");
UnicastRemoteObject.unexportObject(this, true);
System.err.println(
"(ShutdownImpl.shutdown) shutdown object unexported");
Thread.sleep(500);
System.err.println("(ShutDownImpl.shutdown) FEE");
Thread.sleep(500);
System.err.println("(ShutDownImpl.shutdown) FIE");
Thread.sleep(500);
System.err.println("(ShutDownImpl.shutdown) FOE");
Thread.sleep(500);
System.err.println("(ShutDownImpl.shutdown) FOO");
monitor.declareStillAlive();
System.err.println("(ShutDownImpl.shutdown) still alive!");
} catch (Exception e) {
throw new RuntimeException(
"unexpected exception occurred in shutdown method", e);
}
}
public static void main(String[] args) {
try {
int registryPort = Integer.parseInt(System.getProperty("rmi.registry.port"));
Registry registry =
LocateRegistry.getRegistry("", registryPort);
ShutdownMonitor monitor = (ShutdownMonitor)
registry.lookup(KeepAliveDuringCall.BINDING);
System.err.println("(ShutdownImpl) retrieved shutdown monitor");
impl = new ShutdownImpl(monitor);
Shutdown stub = (Shutdown) UnicastRemoteObject.exportObject(impl);
System.err.println("(ShutdownImpl) exported shutdown object");
monitor.submitShutdown(stub);
System.err.println("(ShutdownImpl) submitted shutdown object");
} catch (Exception e) {
System.err.println("(ShutdownImpl) TEST SUBPROCESS FAILURE:");
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
public final class ShutdownImpl_Stub
extends java.rmi.server.RemoteStub
implements Shutdown
{
private static final long serialVersionUID = 2;
private static java.lang.reflect.Method $method_shutdown_0;
static {
try {
$method_shutdown_0 = Shutdown.class.getMethod("shutdown", new java.lang.Class[] {});
} catch (java.lang.NoSuchMethodException e) {
throw new java.lang.NoSuchMethodError(
"stub class initialization failed");
}
}
// constructors
public ShutdownImpl_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
// methods from remote interfaces
// implementation of shutdown()
public void shutdown()
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_shutdown_0, null, -7207851917985848402L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,34 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
/*
*
*/
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ShutdownMonitor extends Remote {
void submitShutdown(Shutdown shutdown) throws RemoteException;
void declareStillAlive() throws RemoteException;
}

View file

@ -0,0 +1,89 @@
/*
* Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 4353388
* @summary After an instance of UnicastRemoteObject has been unexported,
* if it gets marshalled, an InternalError should not be thrown; instead,
* the marshalling should succeed. Also, if its "local" LiveRef gets
* marshalled, by way of the stub returned by RemoteObject.toStub, for
* example, then that should also succeed, instead of throwing an
* IOException (see fix for bugid 4017232).
* @author Peter Jones
*
* @build MarshalAfterUnexport MarshalAfterUnexport_Stub
* @run main/othervm MarshalAfterUnexport
*/
import java.rmi.MarshalledObject;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject;
public class MarshalAfterUnexport
extends UnicastRemoteObject
implements Receiver
{
public MarshalAfterUnexport() throws RemoteException {
}
public void receive(Remote obj) {
}
public static void main(String[] args) throws Exception {
Remote impl2 = null;
try {
Remote impl = new MarshalAfterUnexport();
System.err.println("created impl extending URO: " + impl);
Receiver stub = (Receiver) RemoteObject.toStub(impl);
System.err.println("stub for impl: " + stub);
UnicastRemoteObject.unexportObject(impl, true);
System.err.println("unexported impl");
impl2 = new MarshalAfterUnexport();
Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);
System.err.println("marshalling unexported object:");
MarshalledObject mobj = new MarshalledObject(impl);
System.err.println("passing unexported object via RMI-JRMP:");
stub2.receive(stub);
System.err.println("TEST PASSED");
} finally {
if (impl2 != null) {
try {
UnicastRemoteObject.unexportObject(impl2, true);
} catch (Throwable t) {
}
}
}
}
}
interface Receiver extends Remote {
void receive(Remote obj) throws RemoteException;
}

View file

@ -0,0 +1,97 @@
/*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 4513223
* @summary After an instance of UnicastRemoteObject has been unexported,
* if it gets marshalled, an InternalError should not be thrown; instead,
* the marshalling should succeed. Also, if its "local" LiveRef gets
* marshalled, by way of the stub returned by RemoteObject.toStub, for
* example, then that should also succeed, instead of throwing an
* IOException (see fixes for bugids 4353388, 4017232). This test
* handles the case where the impl's RemoteRef is a UnicastServerRef2.
* @author Peter Jones
* @author Ann Wollrath
*
* @build MarshalAfterUnexport2 MarshalAfterUnexport2_Stub
* @run main/othervm MarshalAfterUnexport2
*/
import java.rmi.MarshalledObject;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.RemoteObject;
import java.rmi.server.UnicastRemoteObject;
public class MarshalAfterUnexport2
extends UnicastRemoteObject
implements Receiver
{
public MarshalAfterUnexport2() throws RemoteException {
super(0, null, null);
}
public void receive(Remote obj) {
}
public static void main(String[] args) throws Exception {
System.err.println("\nRegression test for bug 4513223\n");
Remote impl2 = null;
try {
Remote impl = new MarshalAfterUnexport2();
System.err.println(
"created impl extending URO (with a UnicastServerRef2): " +
impl);
Receiver stub = (Receiver) RemoteObject.toStub(impl);
System.err.println("stub for impl: " + stub);
UnicastRemoteObject.unexportObject(impl, true);
System.err.println("unexported impl");
impl2 = new MarshalAfterUnexport2();
Receiver stub2 = (Receiver) RemoteObject.toStub(impl2);
System.err.println("marshalling unexported object:");
MarshalledObject mobj = new MarshalledObject(impl);
System.err.println("passing unexported object via RMI-JRMP:");
stub2.receive(stub);
System.err.println("TEST PASSED");
} finally {
if (impl2 != null) {
try {
UnicastRemoteObject.unexportObject(impl2, true);
} catch (Throwable t) {
}
}
}
}
}
interface Receiver extends Remote {
void receive(Remote obj) throws RemoteException;
}

View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
public final class MarshalAfterUnexport2_Stub
extends java.rmi.server.RemoteStub
implements Receiver, java.rmi.Remote
{
private static final long serialVersionUID = 2;
private static java.lang.reflect.Method $method_receive_0;
static {
try {
$method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
} catch (java.lang.NoSuchMethodException e) {
throw new java.lang.NoSuchMethodError(
"stub class initialization failed");
}
}
// constructors
public MarshalAfterUnexport2_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
// methods from remote interfaces
// implementation of receive(Remote)
public void receive(java.rmi.Remote $param_Remote_1)
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
public final class MarshalAfterUnexport_Stub
extends java.rmi.server.RemoteStub
implements Receiver, java.rmi.Remote
{
private static final long serialVersionUID = 2;
private static java.lang.reflect.Method $method_receive_0;
static {
try {
$method_receive_0 = Receiver.class.getMethod("receive", new java.lang.Class[] {java.rmi.Remote.class});
} catch (java.lang.NoSuchMethodException e) {
throw new java.lang.NoSuchMethodError(
"stub class initialization failed");
}
}
// constructors
public MarshalAfterUnexport_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
// methods from remote interfaces
// implementation of receive(Remote)
public void receive(java.rmi.Remote $param_Remote_1)
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_receive_0, new java.lang.Object[] {$param_Remote_1}, 5876293363550629411L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,197 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
import java.io.InvalidClassException;
import java.io.ObjectInputFilter;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.UnmarshalException;
import java.rmi.server.UnicastRemoteObject;
import java.util.Objects;
import java.lang.ref.Reference;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
/*
* @test
* @run testng/othervm FilterUROTest
* @summary Check that objects are exported with ObjectInputFilters via UnicastRemoteObject
*/
public class FilterUROTest {
/**
* Data to test serialFilter call counts.
* - name
* - Object
* - expected count of calls to checkInput.
*
* @return array of test data
*/
@DataProvider(name = "bindData")
static Object[][] bindObjects() {
Object[][] data = {
{"SimpleString", "SimpleString", 0},
{"String", new XX("now is the time"), 1},
{"String[]", new XX(new String[3]), 3},
{"Long[4]", new XX(new Long[4]), 3},
{"RejectME", new XX(new RejectME()), -1},
};
return data;
}
/*
* Test exporting an object with a serialFilter using exportObject().
* Send some objects and check the number of calls to the serialFilter.
*/
@Test(dataProvider = "bindData")
public void useExportObject(String name, Object obj, int expectedFilterCount) throws RemoteException {
try {
RemoteImpl impl = RemoteImpl.create();
Echo client = (Echo) UnicastRemoteObject
.exportObject(impl, 0, impl.checker);
int count = client.filterCount(obj);
System.out.printf("count: %d, obj: %s%n", count, obj);
Assert.assertEquals(count, expectedFilterCount, "wrong number of filter calls");
Reference.reachabilityFence(impl);
} catch (RemoteException rex) {
if (expectedFilterCount == -1 &&
UnmarshalException.class.equals(rex.getCause().getClass()) &&
InvalidClassException.class.equals(rex.getCause().getCause().getClass())) {
return; // normal expected exception
}
rex.printStackTrace();
Assert.fail("unexpected remote exception", rex);
} catch (Exception rex) {
Assert.fail("unexpected exception", rex);
}
}
/*
* Test exporting an object with a serialFilter using exportObject()
* with explicit (but null) SocketFactories.
* Send some objects and check the number of calls to the serialFilter.
*/
@Test(dataProvider = "bindData")
public void useExportObject2(String name, Object obj, int expectedFilterCount) throws RemoteException {
try {
RemoteImpl impl = RemoteImpl.create();
Echo client = (Echo) UnicastRemoteObject
.exportObject(impl, 0, null, null, impl.checker);
int count = client.filterCount(obj);
System.out.printf("count: %d, obj: %s%n", count, obj);
Assert.assertEquals(count, expectedFilterCount, "wrong number of filter calls");
Reference.reachabilityFence(impl);
} catch (RemoteException rex) {
if (expectedFilterCount == -1 &&
UnmarshalException.class.equals(rex.getCause().getClass()) &&
InvalidClassException.class.equals(rex.getCause().getCause().getClass())) {
return; // normal expected exception
}
rex.printStackTrace();
Assert.fail("unexpected remote exception", rex);
} catch (Exception rex) {
Assert.fail("unexpected exception", rex);
}
}
/**
* A simple Serializable holding an object that is passed by value.
* It and its contents are checked by the filter.
*/
static class XX implements Serializable {
private static final long serialVersionUID = 362498820763181265L;
final Object obj;
XX(Object obj) {
this.obj = obj;
}
public String toString() {
return super.toString() + "//" + Objects.toString(obj);
}
}
interface Echo extends Remote {
int filterCount(Object obj) throws RemoteException;
}
/**
* This remote object just counts the calls to the serialFilter
* and returns it. The caller can check the number against
* what was expected for the object passed as an argument.
* A new RemoteImpl is used for each test so the count starts at zero again.
*/
static class RemoteImpl implements Echo {
private static final long serialVersionUID = -6999613679881262446L;
transient Checker checker;
static RemoteImpl create() throws RemoteException {
RemoteImpl impl = new RemoteImpl(new Checker());
return impl;
}
private RemoteImpl(Checker checker) throws RemoteException {
this.checker = checker;
}
public int filterCount(Object obj) throws RemoteException {
return checker.count();
}
}
/**
* A ObjectInputFilter that just counts when it is called.
*/
static class Checker implements ObjectInputFilter {
int count;
@Override
public Status checkInput(FilterInfo filterInfo) {
if (filterInfo.serialClass() == RejectME.class) {
return Status.REJECTED;
}
count++;
return Status.UNDECIDED;
}
public int count() {
return count;
}
}
/**
* A class to be rejected by the filter.
*/
static class RejectME implements Serializable {
private static final long serialVersionUID = 2L;
}
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
import java.rmi.*;
public interface Ping extends Remote {
public void ping() throws RemoteException;
}

View file

@ -0,0 +1,90 @@
/*
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 4331349
* @summary synopsis: unexporting doesn't guarantee that DGC will
* let go of remote object
*
* @author Ann Wollrath
*
* @library ../../../testlibrary
* @modules java.rmi/sun.rmi.registry
* java.rmi/sun.rmi.server
* java.rmi/sun.rmi.transport
* java.rmi/sun.rmi.transport.tcp
* @build TestLibrary UnexportLeak_Stub Ping
* @run main/othervm UnexportLeak
*/
import java.lang.ref.*;
import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;
public class UnexportLeak implements Ping {
public void ping() {
}
public static void main(String[] args) {
try {
System.err.println("\nRegression test for bug 4331349\n");
Registry registry = TestLibrary.createRegistryOnEphemeralPort();
int registryPort = TestLibrary.getRegistryPort(registry);
Remote obj = new UnexportLeak();
WeakReference wr = new WeakReference(obj);
UnicastRemoteObject.exportObject(obj);
LocateRegistry.getRegistry(registryPort).rebind("UnexportLeak", obj);
UnicastRemoteObject.unexportObject(obj, true);
obj = null;
flushRefs();
if (wr.get() != null) {
System.err.println("FAILED: unexported object not collected");
throw new RuntimeException(
"FAILED: unexported object not collected");
} else {
System.err.println("PASSED: unexported object collected");
}
} catch (RemoteException e) {
System.err.println(
"FAILED: RemoteException encountered: " + e.getMessage());
e.printStackTrace();
throw new RuntimeException("FAILED: RemoteException encountered");
}
}
/**
* Force desparate garbage collection so that all WeakReference instances
* will be cleared.
*/
private static void flushRefs() {
java.util.Vector chain = new java.util.Vector();
try {
while (true) {
int[] hungry = new int[65536];
chain.addElement(hungry);
}
} catch (OutOfMemoryError e) {
}
}
}

View file

@ -0,0 +1,65 @@
/*
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
public final class UnexportLeak_Stub
extends java.rmi.server.RemoteStub
implements Ping
{
private static final long serialVersionUID = 2;
private static java.lang.reflect.Method $method_ping_0;
static {
try {
$method_ping_0 = Ping.class.getMethod("ping", new java.lang.Class[] {});
} catch (java.lang.NoSuchMethodException e) {
throw new java.lang.NoSuchMethodError(
"stub class initialization failed");
}
}
// constructors
public UnexportLeak_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
// methods from remote interfaces
// implementation of ping()
public void ping()
throws java.rmi.RemoteException
{
try {
ref.invoke(this, $method_ping_0, null, 5866401369815527589L);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.rmi.RemoteException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,119 @@
/*
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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 4507539
* @summary support using dynamic proxies as RMI stubs
* @author Ann Wollrath
*
* @build UseDynamicProxies UseDynamicProxies_Stub
* @run main/othervm/timeout=240 UseDynamicProxies true
* @run main/othervm/timeout=240 UseDynamicProxies
* false
*/
import java.io.IOException;
import java.lang.reflect.Proxy;
import java.rmi.Remote;
import java.rmi.server.RemoteObjectInvocationHandler;
import java.rmi.server.RemoteStub;
import java.rmi.server.UnicastRemoteObject;
public class UseDynamicProxies implements RemoteInterface {
public Object passObject(Object obj) {
return obj;
}
public int passInt(int x) {
return x;
}
public String passString(String string) {
return string;
}
public static void main(String[] args) throws Exception {
RemoteInterface server = null;
RemoteInterface proxy = null;
try {
System.setProperty("java.rmi.server.ignoreStubClasses", args[0]);
boolean ignoreStubClasses = Boolean.parseBoolean(args[0]);
System.err.println("export object");
server = new UseDynamicProxies();
proxy =
(RemoteInterface) UnicastRemoteObject.exportObject(server, 0);
System.err.println("proxy = " + proxy);
if (ignoreStubClasses) {
if (!Proxy.isProxyClass(proxy.getClass())) {
throw new RuntimeException(
"server proxy is not a dynamic proxy");
}
if (!(Proxy.getInvocationHandler(proxy) instanceof
RemoteObjectInvocationHandler))
{
throw new RuntimeException("invalid invocation handler");
}
} else if (!(proxy instanceof RemoteStub)) {
throw new RuntimeException(
"server proxy is not a RemoteStub");
}
System.err.println("invoke methods");
Object obj = proxy.passObject(proxy);
if (!proxy.equals(obj)) {
throw new RuntimeException("returned proxy not equal");
}
int x = proxy.passInt(53);
if (x != 53) {
throw new RuntimeException("returned int not equal");
}
String string = proxy.passString("test");
if (!string.equals("test")) {
throw new RuntimeException("returned string not equal");
}
System.err.println("TEST PASSED");
} finally {
if (proxy != null) {
UnicastRemoteObject.unexportObject(server, true);
}
}
}
}
interface RemoteInterface extends Remote {
Object passObject(Object obj) throws IOException;
int passInt(int x) throws IOException;
String passString(String string) throws IOException;
}

View file

@ -0,0 +1,102 @@
/*
* Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* 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.
*/
// Stub class generated by rmic, do not edit.
// Contents subject to change without notice.
public final class UseDynamicProxies_Stub
extends java.rmi.server.RemoteStub
implements RemoteInterface
{
private static final long serialVersionUID = 2;
private static java.lang.reflect.Method $method_passInt_0;
private static java.lang.reflect.Method $method_passObject_1;
private static java.lang.reflect.Method $method_passString_2;
static {
try {
$method_passInt_0 = RemoteInterface.class.getMethod("passInt", new java.lang.Class[] {int.class});
$method_passObject_1 = RemoteInterface.class.getMethod("passObject", new java.lang.Class[] {java.lang.Object.class});
$method_passString_2 = RemoteInterface.class.getMethod("passString", new java.lang.Class[] {java.lang.String.class});
} catch (java.lang.NoSuchMethodException e) {
throw new java.lang.NoSuchMethodError(
"stub class initialization failed");
}
}
// constructors
public UseDynamicProxies_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
// methods from remote interfaces
// implementation of passInt(int)
public int passInt(int $param_int_1)
throws java.io.IOException
{
try {
Object $result = ref.invoke(this, $method_passInt_0, new java.lang.Object[] {new java.lang.Integer($param_int_1)}, 8655249712495061761L);
return ((java.lang.Integer) $result).intValue();
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.io.IOException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
// implementation of passObject(Object)
public java.lang.Object passObject(java.lang.Object $param_Object_1)
throws java.io.IOException
{
try {
Object $result = ref.invoke(this, $method_passObject_1, new java.lang.Object[] {$param_Object_1}, 3074202549763602823L);
return ((java.lang.Object) $result);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.io.IOException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
// implementation of passString(String)
public java.lang.String passString(java.lang.String $param_String_1)
throws java.io.IOException
{
try {
Object $result = ref.invoke(this, $method_passString_2, new java.lang.Object[] {$param_String_1}, 6627880292288702000L);
return ((java.lang.String) $result);
} catch (java.lang.RuntimeException e) {
throw e;
} catch (java.io.IOException e) {
throw e;
} catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}