[jboss-cvs] JBossAS SVN: r70777 - projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 12 11:53:12 EDT 2008
Author: wolfc
Date: 2008-03-12 11:53:12 -0400 (Wed, 12 Mar 2008)
New Revision: 70777
Modified:
projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
Log:
EJBTHREE-1217: throw RemoveException on Home.remove(Object)
Modified: projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-03-12 15:41:13 UTC (rev 70776)
+++ projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/stateful/StatefulContainer.java 2008-03-12 15:53:12 UTC (rev 70777)
@@ -38,6 +38,7 @@
import javax.ejb.PrePassivate;
import javax.ejb.Remote;
import javax.ejb.RemoteHome;
+import javax.ejb.RemoveException;
import javax.ejb.TimerService;
import org.jboss.aop.Domain;
@@ -690,10 +691,8 @@
}
else if (unadvisedMethod.getName().equals("remove"))
{
- StatefulHandleImpl handle = (StatefulHandleImpl) args[0];
+ remove(args[0]);
- destroySession(handle.id);
-
return null;
}
else
@@ -777,11 +776,8 @@
}
else if (unadvisedMethod.getName().equals("remove"))
{
- StatefulHandleImpl handle = (StatefulHandleImpl) statefulInvocation
- .getArguments()[0];
+ remove(statefulInvocation.getArguments()[0]);
- destroySession(handle.id);
-
InvocationResponse response = new InvocationResponse(null);
response.setContextInfo(statefulInvocation.getResponseContextInfo());
return response;
@@ -987,6 +983,23 @@
throw new IllegalStateException("Unable to create proxy for getBusinessObject as a proxy factory was not found");
}
+ /**
+ * Remove the given object. Called when remove on Home is invoked.
+ *
+ * @param target either a Handle or a primaryKey
+ * @throws RemoveException if it's not allowed to be removed
+ */
+ private void remove(Object target) throws RemoveException
+ {
+ // EJBTHREE-1217: EJBHome.remove(Object primaryKey) must throw RemoveException
+ if(!(target instanceof Handle))
+ throw new RemoveException("EJB 3 3.6.2.2: Session beans do not have a primary key");
+
+ StatefulHandleImpl handle = (StatefulHandleImpl) target;
+
+ destroySession(handle.id);
+ }
+
protected void removeHandle(Handle arg) throws Exception
{
/*
More information about the jboss-cvs-commits
mailing list