Program: 57745
Project: 57745
Buggy source:
@Override public Object childEvaluate(Parser parser,String function,List<Object> params) throws ParserException {
  if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkNumberOfParameters("String_Node_Str",params,0,1);
    String delim="String_Node_Str";
    if (params.size() > 0) {
      delim=params.get(0).toString();
    }
    if ("String_Node_Str".equalsIgnoreCase(delim))     return JSONArray.fromObject(getTableList(MapTool.getPlayer().isGM()));
    return StringUtils.join(getTableList(MapTool.getPlayer().isGM()),delim);
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getVisible() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String visible=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setVisible(AbstractTokenAccessorFunction.getBooleanValue(visible));
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return lookupTable.getVisible() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getAllowLookup() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String access=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setAllowLookup(AbstractTokenAccessorFunction.getBooleanValue(access));
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return lookupTable.getAllowLookup() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getRoll();
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String roll=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setRoll(roll);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return lookupTable.getRoll();
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.clearEntries();
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,4,5);
    String name=params.get(0).toString();
    String min=params.get(1).toString();
    String max=params.get(2).toString();
    String value=params.get(3).toString();
    MD5Key asset=null;
    if (params.size() > 4) {
      asset=new MD5Key(params.get(4).toString());
    }
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.addEntry(Integer.valueOf(min),Integer.valueOf(max),value,asset);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String roll=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    LookupEntry entry=lookupTable.getLookup(roll);
    if (entry != null) {
      List<LookupEntry> oldlist=new ArrayList<LookupEntry>(lookupTable.getEntryList());
      lookupTable.clearEntries();
      for (      LookupEntry e : oldlist)       if (e != entry)       lookupTable.addEntry(e.getMin(),e.getMax(),e.getValue(),e.getImageId());
    }
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,3,4);
    String name=params.get(0).toString();
    String visible=params.get(1).toString();
    String lookups=params.get(2).toString();
    MD5Key asset=null;
    if (params.size() > 3) {
      asset=new MD5Key(params.get(3).toString());
    }
    LookupTable lookupTable=new LookupTable();
    lookupTable.setName(name);
    lookupTable.setVisible(AbstractTokenAccessorFunction.getBooleanValue(visible));
    lookupTable.setAllowLookup(AbstractTokenAccessorFunction.getBooleanValue(lookups));
    if (asset != null)     lookupTable.setTableImage(asset);
    MapTool.getCampaign().getLookupTableMap().put(name,lookupTable);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    if (lookupTable != null) {
      MapTool.getCampaign().getLookupTableMap().remove(name);
      MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    }
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getTableImage();
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    MD5Key asset=new MD5Key(params.get(1).toString());
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setTableImage(asset);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String oldName=params.get(0).toString();
    String newName=params.get(1).toString();
    LookupTable oldTable=getMaptoolTable(oldName,function);
    if (oldTable != null) {
      LookupTable newTable=new LookupTable(oldTable);
      newTable.setName(newName);
      MapTool.getCampaign().getLookupTableMap().put(newName,newTable);
      MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    }
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,3,3);
    String name=params.get(0).toString();
    String roll=params.get(1).toString();
    String result=params.get(2).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    LookupEntry entry=lookupTable.getLookup(roll);
    if (entry == null)     return 0;
    int rollInt=Integer.valueOf(roll);
    if (rollInt < entry.getMin() || rollInt > entry.getMax())     return 0;
    List<LookupEntry> oldlist=new ArrayList<LookupEntry>(lookupTable.getEntryList());
    lookupTable.clearEntries();
    for (    LookupEntry e : oldlist)     if (e != entry)     lookupTable.addEntry(e.getMin(),e.getMax(),e.getValue(),e.getImageId());
 else     lookupTable.addEntry(e.getMin(),e.getMax(),result,e.getImageId());
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return 1;
  }
 else {
    checkNumberOfParameters(function,params,1,2);
    String name=params.get(0).toString();
    String roll=null;
    if (params.size() > 1) {
      roll=params.get(1).toString().length() == 0 ? null : params.get(1).toString();
    }
    LookupTable lookupTable=MapTool.getCampaign().getLookupTableMap().get(name);
    if (!MapTool.getPlayer().isGM() && !lookupTable.getAllowLookup()) {
      if (lookupTable.getVisible()) {
        throw new ParserException(function + "String_Node_Str" + I18N.getText("String_Node_Str")+ name);
      }
 else {
        throw new ParserException(function + "String_Node_Str" + I18N.getText("String_Node_Str")+ "String_Node_Str"+ name);
      }
    }
    if (lookupTable == null) {
      throw new ParserException(I18N.getText("String_Node_Str",function,name));
    }
    LookupEntry result=lookupTable.getLookup(roll);
    if (function.equals("String_Node_Str") || function.equals("String_Node_Str")) {
      String val=result.getValue();
      try {
        BigDecimal bival=new BigDecimal(val);
        return bival;
      }
 catch (      NumberFormatException nfe) {
        return val;
      }
    }
 else {
      if (result.getImageId() == null) {
        throw new ParserException(I18N.getText("String_Node_Str",function,name));
      }
      BigDecimal size=null;
      if (params.size() > 2) {
        if (params.get(2) instanceof BigDecimal) {
          size=(BigDecimal)params.get(2);
        }
 else {
          throw new ParserException(I18N.getText("String_Node_Str",function));
        }
      }
      StringBuilder assetId=new StringBuilder("String_Node_Str");
      assetId.append(result.getImageId().toString());
      if (size != null) {
        int i=Math.max(size.intValue(),1);
        assetId.append("String_Node_Str");
        assetId.append(i);
      }
      return assetId.toString();
    }
  }
}

Fixed version (ground truth):
@Override public Object childEvaluate(Parser parser,String function,List<Object> params) throws ParserException {
  if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkNumberOfParameters("String_Node_Str",params,0,1);
    String delim="String_Node_Str";
    if (params.size() > 0) {
      delim=params.get(0).toString();
    }
    if ("String_Node_Str".equalsIgnoreCase(delim))     return JSONArray.fromObject(getTableList(MapTool.getPlayer().isGM()));
    return StringUtils.join(getTableList(MapTool.getPlayer().isGM()),delim);
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getVisible() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String visible=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setVisible(AbstractTokenAccessorFunction.getBooleanValue(visible));
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return lookupTable.getVisible() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getAllowLookup() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String access=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setAllowLookup(AbstractTokenAccessorFunction.getBooleanValue(access));
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return lookupTable.getAllowLookup() ? "String_Node_Str" : "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getRoll();
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String roll=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setRoll(roll);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return lookupTable.getRoll();
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.clearEntries();
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,4,5);
    String name=params.get(0).toString();
    String min=params.get(1).toString();
    String max=params.get(2).toString();
    String value=params.get(3).toString();
    MD5Key asset=null;
    if (params.size() > 4) {
      asset=new MD5Key(params.get(4).toString());
    }
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.addEntry(Integer.valueOf(min),Integer.valueOf(max),value,asset);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    String roll=params.get(1).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    LookupEntry entry=lookupTable.getLookup(roll);
    if (entry != null) {
      List<LookupEntry> oldlist=new ArrayList<LookupEntry>(lookupTable.getEntryList());
      lookupTable.clearEntries();
      for (      LookupEntry e : oldlist)       if (e != entry)       lookupTable.addEntry(e.getMin(),e.getMax(),e.getValue(),e.getImageId());
    }
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,3,4);
    String name=params.get(0).toString();
    String visible=params.get(1).toString();
    String lookups=params.get(2).toString();
    MD5Key asset=null;
    if (params.size() > 3) {
      asset=new MD5Key(params.get(3).toString());
    }
    LookupTable lookupTable=new LookupTable();
    lookupTable.setName(name);
    lookupTable.setVisible(AbstractTokenAccessorFunction.getBooleanValue(visible));
    lookupTable.setAllowLookup(AbstractTokenAccessorFunction.getBooleanValue(lookups));
    if (asset != null)     lookupTable.setTableImage(asset);
    MapTool.getCampaign().getLookupTableMap().put(name,lookupTable);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    if (lookupTable != null) {
      MapTool.getCampaign().getLookupTableMap().remove(name);
      MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    }
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,1,1);
    String name=params.get(0).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    return lookupTable.getTableImage();
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String name=params.get(0).toString();
    MD5Key asset=new MD5Key(params.get(1).toString());
    LookupTable lookupTable=getMaptoolTable(name,function);
    lookupTable.setTableImage(asset);
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,2,2);
    String oldName=params.get(0).toString();
    String newName=params.get(1).toString();
    LookupTable oldTable=getMaptoolTable(oldName,function);
    if (oldTable != null) {
      LookupTable newTable=new LookupTable(oldTable);
      newTable.setName(newName);
      MapTool.getCampaign().getLookupTableMap().put(newName,newTable);
      MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    }
    return "String_Node_Str";
  }
 else   if ("String_Node_Str".equalsIgnoreCase(function)) {
    checkTrusted(function);
    checkNumberOfParameters("String_Node_Str",params,3,3);
    String name=params.get(0).toString();
    String roll=params.get(1).toString();
    String result=params.get(2).toString();
    LookupTable lookupTable=getMaptoolTable(name,function);
    LookupEntry entry=lookupTable.getLookup(roll);
    if (entry == null)     return 0;
    int rollInt=Integer.valueOf(roll);
    if (rollInt < entry.getMin() || rollInt > entry.getMax())     return 0;
    List<LookupEntry> oldlist=new ArrayList<LookupEntry>(lookupTable.getEntryList());
    lookupTable.clearEntries();
    for (    LookupEntry e : oldlist)     if (e != entry)     lookupTable.addEntry(e.getMin(),e.getMax(),e.getValue(),e.getImageId());
 else     lookupTable.addEntry(e.getMin(),e.getMax(),result,e.getImageId());
    MapTool.serverCommand().updateCampaign(MapTool.getCampaign().getCampaignProperties());
    return 1;
  }
 else {
    checkNumberOfParameters(function,params,1,3);
    String name=params.get(0).toString();
    String roll=null;
    if (params.size() > 1) {
      roll=params.get(1).toString().length() == 0 ? null : params.get(1).toString();
    }
    LookupTable lookupTable=MapTool.getCampaign().getLookupTableMap().get(name);
    if (!MapTool.getPlayer().isGM() && !lookupTable.getAllowLookup()) {
      if (lookupTable.getVisible()) {
        throw new ParserException(function + "String_Node_Str" + I18N.getText("String_Node_Str")+ name);
      }
 else {
        throw new ParserException(function + "String_Node_Str" + I18N.getText("String_Node_Str")+ "String_Node_Str"+ name);
      }
    }
    if (lookupTable == null) {
      throw new ParserException(I18N.getText("String_Node_Str",function,name));
    }
    LookupEntry result=lookupTable.getLookup(roll);
    if (function.equals("String_Node_Str") || function.equals("String_Node_Str")) {
      String val=result.getValue();
      try {
        BigDecimal bival=new BigDecimal(val);
        return bival;
      }
 catch (      NumberFormatException nfe) {
        return val;
      }
    }
 else {
      if (result.getImageId() == null) {
        throw new ParserException(I18N.getText("String_Node_Str",function,name));
      }
      BigDecimal size=null;
      if (params.size() > 2) {
        if (params.get(2) instanceof BigDecimal) {
          size=(BigDecimal)params.get(2);
        }
 else {
          throw new ParserException(I18N.getText("String_Node_Str",function));
        }
      }
      StringBuilder assetId=new StringBuilder("String_Node_Str");
      assetId.append(result.getImageId().toString());
      if (size != null) {
        int i=Math.max(size.intValue(),1);
        assetId.append("String_Node_Str");
        assetId.append(i);
      }
      return assetId.toString();
    }
  }
}