Program: 142233
Project: 142233
Buggy source:
public MenuAdapter(Context context,CommCarePlatform platform,String menuID){
  this.mPlatform=platform;
  this.context=context;
  Vector<Object> items=new Vector<Object>();
  Hashtable<String,Entry> map=platform.getMenuMap();
  asw=CommCareApplication._().getCurrentSessionWrapper();
  EvaluationContext ec=null;
  for (  Suite s : platform.getInstalledSuites()) {
    for (    Menu m : s.getMenus()) {
      try {
        XPathExpression relevance=m.getMenuRelevance();
        if (m.getMenuRelevance() != null) {
          if (ec == null) {
            ec=asw.getEvaluationContext();
          }
          if (XPathFuncExpr.toBoolean(relevance.eval(ec)).booleanValue() == false) {
            continue;
          }
        }
      }
 catch (      XPathSyntaxException e) {
        e.printStackTrace();
      }
      if (m.getId().equals(menuID)) {
        if (menuTitle == null) {
          try {
            menuTitle=m.getName().evaluate();
          }
 catch (          Exception e) {
            e.printStackTrace();
          }
        }
        for (        String command : m.getCommandIds()) {
          try {
            XPathExpression mRelevantCondition=m.getCommandRelevance(m.indexOfCommand(command));
            if (mRelevantCondition != null) {
              if (ec == null) {
                ec=asw.getEvaluationContext();
              }
              Object ret=mRelevantCondition.eval(ec);
              try {
                if (!XPathFuncExpr.toBoolean(ret)) {
                  continue;
                }
              }
 catch (              XPathTypeMismatchException e) {
                Logger.log(AndroidLogger.TYPE_ERROR_CONFIG_STRUCTURE,"String_Node_Str" + ret);
                throw new RuntimeException("String_Node_Str" + ret);
              }
              if (!XPathFuncExpr.toBoolean(ret)) {
                continue;
              }
            }
            Entry e=map.get(command);
            if (e.getXFormNamespace() == null) {
              if (asw.getSession().getNeededDatum(e) == null) {
                continue;
              }
            }
            items.add(e);
          }
 catch (          XPathSyntaxException xpse) {
            String xpathExpression=m.getCommandRelevanceRaw(m.indexOfCommand(command));
            CommCareApplication._().triggerHandledAppExit(context,Localization.get("String_Node_Str",new String[]{xpathExpression,xpse.getMessage()}));
            objectData=new Object[0];
            return;
          }
catch (          XPathException xpe) {
            String xpathExpression=m.getCommandRelevanceRaw(m.indexOfCommand(command));
            CommCareApplication._().triggerHandledAppExit(context,Localization.get("String_Node_Str",new String[]{xpathExpression,xpe.getMessage()}));
            objectData=new Object[0];
            return;
          }
        }
        continue;
      }
      if (menuID.equals(m.getRoot())) {
        boolean idExists=false;
        for (        Object o : items) {
          if (o instanceof Menu) {
            if (((Menu)o).getId().equals(m.getId())) {
              idExists=true;
              break;
            }
          }
        }
        if (!idExists) {
          items.add(m);
        }
      }
    }
  }
  objectData=new Object[items.size()];
  items.copyInto(objectData);
}

Fixed version (ground truth):
public MenuAdapter(Context context,CommCarePlatform platform,String menuID){
  this.mPlatform=platform;
  this.context=context;
  Vector<Object> items=new Vector<Object>();
  Hashtable<String,Entry> map=platform.getMenuMap();
  asw=CommCareApplication._().getCurrentSessionWrapper();
  EvaluationContext ec=null;
  for (  Suite s : platform.getInstalledSuites()) {
    for (    Menu m : s.getMenus()) {
      try {
        XPathExpression relevance=m.getMenuRelevance();
        if (m.getMenuRelevance() != null) {
          if (ec == null) {
            ec=asw.getEvaluationContext(m.getId());
          }
          if (XPathFuncExpr.toBoolean(relevance.eval(ec)).booleanValue() == false) {
            continue;
          }
        }
      }
 catch (      XPathSyntaxException e) {
        e.printStackTrace();
      }
      if (m.getId().equals(menuID)) {
        if (menuTitle == null) {
          try {
            menuTitle=m.getName().evaluate();
          }
 catch (          Exception e) {
            e.printStackTrace();
          }
        }
        for (        String command : m.getCommandIds()) {
          try {
            XPathExpression mRelevantCondition=m.getCommandRelevance(m.indexOfCommand(command));
            if (mRelevantCondition != null) {
              if (ec == null) {
                ec=asw.getEvaluationContext();
              }
              Object ret=mRelevantCondition.eval(ec);
              try {
                if (!XPathFuncExpr.toBoolean(ret)) {
                  continue;
                }
              }
 catch (              XPathTypeMismatchException e) {
                Logger.log(AndroidLogger.TYPE_ERROR_CONFIG_STRUCTURE,"String_Node_Str" + ret);
                throw new RuntimeException("String_Node_Str" + ret);
              }
              if (!XPathFuncExpr.toBoolean(ret)) {
                continue;
              }
            }
            Entry e=map.get(command);
            if (e.getXFormNamespace() == null) {
              if (asw.getSession().getNeededDatum(e) == null) {
                continue;
              }
            }
            items.add(e);
          }
 catch (          XPathSyntaxException xpse) {
            String xpathExpression=m.getCommandRelevanceRaw(m.indexOfCommand(command));
            CommCareApplication._().triggerHandledAppExit(context,Localization.get("String_Node_Str",new String[]{xpathExpression,xpse.getMessage()}));
            objectData=new Object[0];
            return;
          }
catch (          XPathException xpe) {
            String xpathExpression=m.getCommandRelevanceRaw(m.indexOfCommand(command));
            CommCareApplication._().triggerHandledAppExit(context,Localization.get("String_Node_Str",new String[]{xpathExpression,xpe.getMessage()}));
            objectData=new Object[0];
            return;
          }
        }
        continue;
      }
      if (menuID.equals(m.getRoot())) {
        boolean idExists=false;
        for (        Object o : items) {
          if (o instanceof Menu) {
            if (((Menu)o).getId().equals(m.getId())) {
              idExists=true;
              break;
            }
          }
        }
        if (!idExists) {
          items.add(m);
        }
      }
    }
  }
  objectData=new Object[items.size()];
  items.copyInto(objectData);
}