Skip to content

Commit

Permalink
BF [ 1810182 ] Session lost after cache reset
Browse files Browse the repository at this point in the history
  • Loading branch information
teo_sarca committed Oct 9, 2007
1 parent 0ec4071 commit 349c558
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
13 changes: 13 additions & 0 deletions base/src/org/compiere/model/MSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
*
* @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
{
Expand All @@ -43,6 +46,16 @@ public static MSession get (Properties ctx, boolean createNew)
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
Expand Down
1 change: 1 addition & 0 deletions extend/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down
25 changes: 25 additions & 0 deletions extend/src/test/functional/MSessionTest.java
Original file line number Diff line number Diff line change
@@ -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));
}
}

0 comments on commit 349c558

Please sign in to comment.