Skip to content

Commit

Permalink
AS7-3716 fix NPE
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas committed Feb 13, 2012
1 parent 5d78387 commit 80f96e6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ public StatefulSessionBeanSerializabilityChecker(Class<?> beanClass) {
*/
@Override
public boolean isSerializable(Class<?> clazz) {
return this.beanClass == clazz || DEFAULT.isSerializable(clazz);
if(clazz == Object.class) {
return false;
}
return DEFAULT.isSerializable(clazz) || clazz.isAssignableFrom(this.beanClass);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ public void testPassivationMaxSize() throws Exception {
Assert.assertTrue("@PrePassivate not called, check cache configuration and client sleep time", remote2.hasBeenPassivated());
Assert.assertTrue(remote1.isPersistenceContextSame());
Assert.assertTrue(remote2.isPersistenceContextSame());
Assert.assertEquals("Super", remote1.getSuperEmployee().getName());
Assert.assertEquals("Super", remote2.getSuperEmployee().getName());

remote1.remove();
remote2.remove();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.jboss.as.test.integration.ejb.stateful.passivation;

import javax.annotation.PostConstruct;

/**
* AS7-3716
*
* We also need to make sure that a beans super class is still serialized even when it is not
* marked serializable
*
* @author Stuart Douglas
*/
public class PassivationSuperClass {

private Employee superEmployee;

@PostConstruct
private void postConstruct() {
superEmployee = new Employee();
superEmployee.setName("Super");
}

public Employee getSuperEmployee() {
return superEmployee;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@Stateful
@Remote(TestPassivationRemote.class)
@Cache("passivating")
public class TestPassivationBean implements TestPassivationRemote {
public class TestPassivationBean extends PassivationSuperClass implements TestPassivationRemote {
private static final Logger log = Logger.getLogger(TestPassivationBean.class);

@PersistenceContext(type = PersistenceContextType.EXTENDED)
Expand Down Expand Up @@ -126,4 +126,6 @@ public void setActivateFlag() {
public void remove() {
log.info("Bean [" + this.identificator + "] removing");
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ public interface TestPassivationRemote {
* Annotate for removing.
*/
void remove();

Employee getSuperEmployee();
}

0 comments on commit 80f96e6

Please sign in to comment.