Skip to content
Browse files

JBCTS-1236 Attempting to assign a deleted object as a value of a cmr-…

…field should throw an IllegalArgumentException
  • Loading branch information...
1 parent 13565b6 commit 3aec7ba07074b4caf346b3e88038eec154a83155 @stuartwdouglas stuartwdouglas committed
View
10 cmp/src/main/java/org/jboss/as/cmp/CmpMessages.java
@@ -30,20 +30,22 @@
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Set;
+
import javax.ejb.CreateException;
import javax.ejb.DuplicateKeyException;
import javax.ejb.EJBException;
import javax.ejb.FinderException;
import javax.ejb.NoSuchEJBException;
import javax.ejb.NoSuchEntityException;
+import javax.ejb.NoSuchObjectLocalException;
import javax.ejb.ObjectNotFoundException;
import javax.ejb.RemoveException;
import javax.transaction.SystemException;
import javax.transaction.Transaction;
+
import org.jboss.as.cmp.ejbql.ASTNullComparison;
import org.jboss.as.cmp.ejbql.SimpleNode;
import org.jboss.as.cmp.jdbc.bridge.CMRMessage;
-import org.jboss.as.cmp.jdbc.bridge.JDBCAbstractEntityBridge;
import org.jboss.as.cmp.jdbc.metadata.JDBCQueryMetaData;
import org.jboss.as.server.deployment.DeploymentUnit;
import org.jboss.as.server.deployment.DeploymentUnitProcessingException;
@@ -464,7 +466,7 @@
EJBException errorGettingInstanceValue(@Cause Exception e);
@Message(id = 18532, value = "Instance was already removed")
- IllegalStateException instanceAlreadyRemoved(@Cause Exception e);
+ IllegalArgumentException instanceAlreadyRemoved(@Cause Exception e);
@Message(id = 18533, value = "Error in scheduleForCascadeDelete")
EJBException errorInScheduleCascadeDelete(@Cause Exception e);
@@ -1212,4 +1214,8 @@
@Message(id = 18882, value = "Failed to insert new rows")
SQLException failedToInsertNewRows(@Cause SQLException e);
+
+
+ @Message(id = 18895, value = "Instance was already removed: id=%s")
+ NoSuchObjectLocalException instanceAlreadyRemovedLocal(Object pk);
}
View
5 cmp/src/main/java/org/jboss/as/cmp/jdbc2/schema/EntityTable.java
@@ -29,13 +29,14 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+
import javax.ejb.DuplicateKeyException;
-import javax.ejb.EJBException;
import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
import javax.transaction.Transaction;
+
import org.jboss.as.cmp.CmpConfig;
import org.jboss.as.cmp.CmpMessages;
import org.jboss.as.cmp.jdbc.JDBCEntityPersistenceStore;
@@ -1036,7 +1037,7 @@ public void insert(Object pk) throws DuplicateKeyException {
public Object getFieldValue(int i) {
if (state == DELETED) {
- throw CmpMessages.MESSAGES.instanceAlreadyRemoved(pk);
+ throw CmpMessages.MESSAGES.instanceAlreadyRemovedLocal(pk);
}
Object value = fields[i];

0 comments on commit 3aec7ba

Please sign in to comment.
Something went wrong with that request. Please try again.