IDEMPIERE-2756 Background threads losing context when user log out

This commit is contained in:
Carlos Ruiz 2015-08-07 10:03:18 -05:00
parent 45ce71ef48
commit d726d9c75a
1 changed files with 8 additions and 0 deletions

View File

@ -1989,6 +1989,7 @@ public abstract class PO
*/
public boolean save()
{
checkValidContext();
CLogger.resetLast();
boolean newRecord = is_new(); // save locally as load resets
if (!newRecord && !is_Changed())
@ -3107,6 +3108,7 @@ public abstract class PO
*/
public boolean delete (boolean force)
{
checkValidContext();
CLogger.resetLast();
if (is_new())
return true;
@ -4670,4 +4672,10 @@ public abstract class PO
log.saveError(msg, info);
}
}
private void checkValidContext() {
if (getCtx().size() == 0)
throw new AdempiereException("Context lost");
}
} // PO