From f3126087251aa7bf88726f54687b48a9d6d87b28 Mon Sep 17 00:00:00 2001 From: Daniel Perano <51095634+danielperano@users.noreply.github.com> Date: Sat, 5 Oct 2019 23:55:31 -0700 Subject: [PATCH] Fixed ClassCastException in RMI implementation. (#1195) jME's RMI registry uses an internal SharedObject class to track metadata about objects that have been shared. The problem is that when you retrieve the shared object, the RMI implementation mistakenly attempts to cast the SharedObject holder to the class of the actual shared object. This PR fixes that bug by casting the actual shared object instead of the SharedObject holder. --- .../src/main/java/com/jme3/network/service/rmi/RmiRegistry.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiRegistry.java b/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiRegistry.java index 8fa23a538..d6443cfcb 100644 --- a/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiRegistry.java +++ b/jme3-networking/src/main/java/com/jme3/network/service/rmi/RmiRegistry.java @@ -194,7 +194,7 @@ public class RmiRegistry { public T getLocalObject( String name, Class type ) { local.lock.readLock().lock(); try { - return type.cast(local.byName.get(name)); + return type.cast(local.byName.get(name).object); } finally { local.lock.readLock().unlock(); }