IDEMPIERE-194 Handling null context variable / Thanks to Nicolas Micoud

This commit is contained in:
Carlos Ruiz 2012-08-29 23:17:37 -05:00
parent 9f753252e0
commit 2b6de08510
1 changed files with 13 additions and 0 deletions

View File

@ -1328,9 +1328,22 @@ public final class Env
token = inStr.substring(0, j);
// IDEMPIERE-194 Handling null context variable
String defaultV = null;
int idx = token.indexOf(":"); // or clause
if (idx >= 0)
{
defaultV = token.substring(idx+1, token.length());
token = token.substring(0, idx);
}
String ctxInfo = getContext(ctx, WindowNo, token, onlyWindow); // get context
if (ctxInfo.length() == 0 && (token.startsWith("#") || token.startsWith("$")) )
ctxInfo = getContext(ctx, token); // get global context
if (ctxInfo.length() == 0 && defaultV != null)
ctxInfo = defaultV;
if (ctxInfo.length() == 0)
{
getLogger().config("No Context Win=" + WindowNo + " for: " + token);