BF [ 1810182 ] Session lost after cache reset

http://sourceforge.net/tracker/index.php?func=detail&aid=1810182&group_id=176962&atid=879332
This commit is contained in:
teo_sarca 2007-10-09 15:48:30 +00:00
parent 5cf47c3fa2
commit d7ea4de2f5
3 changed files with 39 additions and 0 deletions

View File

@ -28,6 +28,9 @@ import org.compiere.util.*;
*
* @author Jorg Janke
* @version $Id: MSession.java,v 1.3 2006/07/30 00:58:05 jjanke Exp $
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>BF [ 1810182 ] Session lost after cache reset
*/
public class MSession extends X_AD_Session
{
@ -43,6 +46,16 @@ public class MSession extends X_AD_Session
MSession session = null;
if (AD_Session_ID > 0)
session = (MSession)s_sessions.get(new Integer(AD_Session_ID));
// Try to load
if (session == null && AD_Session_ID > 0)
{
session = new MSession(ctx, AD_Session_ID, null);
if (session.get_ID() != AD_Session_ID) {
Env.setContext (ctx, "#AD_Session_ID", AD_Session_ID);
s_sessions.put(AD_Session_ID, session);
}
}
// Create New
if (session == null && createNew)
{
session = new MSession (ctx, null); // local session

View File

@ -96,6 +96,7 @@
<test name="test.functional.MBPartnerTest" />
<test name="test.functional.MBPGroupTest" />
<test name="test.functional.MBPartnerLocationTest" />
<test name="test.functional.MSessionTest" />
<test name="test.functional.PackOutTest" />
<test name="test.functional.MWFNodePlaceHolderTest" />
<test name="test.functional.XMLValidateTest" />

View File

@ -0,0 +1,25 @@
/**
*
*/
package test.functional;
import org.compiere.model.MSession;
import org.compiere.util.Env;
import test.AdempiereTestCase;
/**
* Test MSession class
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
*/
public class MSessionTest extends AdempiereTestCase {
/**
* Test - BF [ 1810182 ] Session lost after cache reset
*/
public void testBF1810182 () {
assertNotNull("Session not found, should not fail here", MSession.get(getCtx(), true));
Env.reset(false);
assertNotNull("Session not found after cache reset", MSession.get(getCtx(), false));
}
}