You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by da...@apache.org on 2007/05/25 23:46:25 UTC
svn commit: r541789 -
/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
Author: dain
Date: Fri May 25 14:46:24 2007
New Revision: 541789
URL: http://svn.apache.org/viewvc?view=rev&rev=541789
Log:
Throw an IllegalStateException if someone calls getEJBObject on a bean without a remote interface or getEJBLocalObject on a bean without a local interface
Modified:
incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java?view=diff&rev=541789&r1=541788&r2=541789
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java Fri May 25 14:46:24 2007
@@ -83,6 +83,10 @@
ThreadContext threadContext = ThreadContext.getThreadContext();
DeploymentInfo di = threadContext.getDeploymentInfo();
+ if (di.getLocalInterface() == null) {
+ throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface");
+ }
+
EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>());
try {
@@ -97,12 +101,16 @@
ThreadContext threadContext = ThreadContext.getThreadContext();
DeploymentInfo di = threadContext.getDeploymentInfo();
+ if (di.getRemoteInterface() == null) {
+ throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface");
+ }
+
EjbObjectProxyHandler handler = new EntityEjbObjectHandler(((RpcContainer) di.getContainer()).getDeploymentInfo(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>());
try {
Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class};
return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler);
} catch (IllegalAccessException iae) {
- throw new InternalErrorException("Could not create IVM proxy for " + di.getLocalInterface() + " interface", iae);
+ throw new InternalErrorException("Could not create IVM proxy for " + di.getRemoteInterface() + " interface", iae);
}
}