| Summary: | DatabaseSessionImpl.finalize() leads to ClassCastException | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Oliver Michels <omichels> |
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | andrei.ilitchev, eclipselink.foundation-inbox, peter.krogh |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
Suggested fix in SessionBroker:
public void logout() throws DatabaseException {
if(!isLoggedIn) {
return;
}
if (!isClientSessionBroker()) {
for (Iterator sessionEnum = getSessionsByName().values().iterator();
sessionEnum.hasNext();) {
DatabaseSessionImpl session = (DatabaseSessionImpl)sessionEnum.next();
session.logout();
}
if(hasExternalTransactionController()) {
getExternalTransactionController().clearSequencingListeners();
}
}
sequencing = null;
isLoggedIn = false;
}
Our SessionBroker Feature is being looked at in 2.3.0, this bug is being looked at the same time. Fixed in rev.9276 as part of a patch for Bug 328404 - JPA Persistence Unit Composition . The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Build Identifier: 2.1.1.v20100817-r8050 SessionBroker.logout() is called from the finalize method of its super class DatabaseSessionImpl. then in logout() there is an explizit cast from all Sessions to DatabaseSessionImpl: for (Iterator sessionEnum = getSessionsByName().values().iterator(); sessionEnum.hasNext();) { DatabaseSessionImpl session = (DatabaseSessionImpl)sessionEnum.next(); session.logout(); } but in SessionBroker.internalRegisterSession() clientBroker.internalRegisterSession(sessionName, ((ServerSession)serverSession).acquireClientSession()); resulting to register a ClientSession. But ClientSession is not a subclass of DatabaseSessionImpl leading to ClassCastException. Reproducible: Always Steps to Reproduce: read the code