Program: 34317
Project: 34317
Buggy source:
public static int getTimeSeries(String[] args){
  List<PortableTimeSeries> tslist=null;
  int returnCode=0;
  if (args.length < 2) {
    SFIToolkit.displayln("String_Node_Str");
    return -1;
  }
  String provider=args[0];
  String tsKey=args[1];
  String start="String_Node_Str";
  String end="String_Node_Str";
  String meta="String_Node_Str";
  boolean processMeta=false;
  boolean processData=true;
  if (args.length >= 3 && !args[2].isEmpty()) {
    start=args[2];
  }
  if (args.length >= 4 && !args[3].isEmpty()) {
    end=args[3];
  }
  if (args.length >= 5) {
    meta=args[4];
    if (meta.equalsIgnoreCase("String_Node_Str")) {
      meta="String_Node_Str";
    }
    if (meta.equalsIgnoreCase("String_Node_Str")) {
      SFIToolkit.displayln("String_Node_Str");
    }
 else     if (meta.equalsIgnoreCase("String_Node_Str")) {
      SFIToolkit.displayln("String_Node_Str");
      processMeta=true;
    }
 else     if (meta.equalsIgnoreCase("String_Node_Str")) {
      SFIToolkit.displayln("String_Node_Str");
      processMeta=true;
      processData=false;
    }
 else {
      SFIToolkit.displayln("String_Node_Str" + meta);
    }
  }
  try {
    int dataLength=0;
    tslist=SdmxClientHandler.getTimeSeries(provider,tsKey,start,end);
    if (tslist == null) {
      SFIToolkit.displayln("String_Node_Str");
      return -1;
    }
 else {
      SFIToolkit.displayln("String_Node_Str" + tslist.size() + "String_Node_Str");
    }
    if (processData) {
      for (Iterator<PortableTimeSeries> iterator=tslist.iterator(); iterator.hasNext(); ) {
        PortableTimeSeries ts=(PortableTimeSeries)iterator.next();
        dataLength+=ts.getObservations().size();
      }
    }
 else {
      dataLength=tslist.size();
    }
    if (dataLength > 0) {
      int name=0;
      int date=0;
      int val=0;
      Data.setObsCount(dataLength);
      Data.addVarStr("String_Node_Str",10);
      name=Data.getVarIndex("String_Node_Str");
      int lastPos=name;
      if (processData) {
        SFIToolkit.displayln("String_Node_Str" + dataLength + "String_Node_Str");
        Data.addVarStr("String_Node_Str",5);
        Data.addVarDouble("String_Node_Str");
        date=Data.getVarIndex("String_Node_Str");
        val=Data.getVarIndex("String_Node_Str");
        lastPos=val;
      }
      int i=0;
      for (Iterator<PortableTimeSeries> iterator=tslist.iterator(); iterator.hasNext(); ) {
        PortableTimeSeries ts=(PortableTimeSeries)iterator.next();
        String tsname=ts.getName();
        if (processData) {
          List<Double> tsobs=ts.getObservations();
          List<String> tsdates=ts.getTimeSlots();
          int j=0;
          for (Iterator<Double> iterator2=tsobs.iterator(); iterator2.hasNext(); ) {
            Data.storeStr(name,i + j + 1,tsname);
            Data.storeNum(val,i + j + 1,iterator2.next());
            Data.storeStr(date,i + j + 1,tsdates.get(j));
            if (processMeta) {
              List<String> dimensions=ts.getDimensions();
              List<String> attributes=ts.getAttributes();
              attributes.addAll(dimensions);
              for (Iterator<String> iterator3=attributes.iterator(); iterator3.hasNext(); ) {
                String attr=(String)iterator3.next();
                String[] tokens=attr.split("String_Node_Str");
                String key=tokens[0];
                String value=tokens[1];
                if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) {
                  int attrPos=Data.getVarIndex(key);
                  if (attrPos > lastPos) {
                    lastPos=attrPos;
                    Data.addVarStr(key,value.length());
                  }
                  Data.storeStr(attrPos,i + j + 1,value);
                }
              }
              List<String> obsAttrNames=ts.getObsLevelAttributesNames();
              for (Iterator<String> iterator3=obsAttrNames.iterator(); iterator3.hasNext(); ) {
                String attrName=(String)iterator3.next();
                List<String> obsAttr=ts.getObsLevelAttributes(attrName);
                if (obsAttr != null && !obsAttr.isEmpty()) {
                  int attrPos=Data.getVarIndex(attrName);
                  if (attrPos > lastPos) {
                    lastPos=attrPos;
                    Data.addVarStr(attrName,1);
                  }
                  Data.storeStr(attrPos,i + j + 1,obsAttr.get(j));
                }
              }
            }
            j++;
          }
          i++;
        }
 else {
          Data.storeStr(name,i + 1,tsname);
          List<String> dimensions=ts.getDimensions();
          List<String> attributes=ts.getAttributes();
          attributes.addAll(dimensions);
          for (Iterator<String> iterator3=attributes.iterator(); iterator3.hasNext(); ) {
            String attr=(String)iterator3.next();
            String[] tokens=attr.split("String_Node_Str");
            String key=tokens[0];
            String value=tokens[1];
            if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) {
              int attrPos=Data.getVarIndex(key);
              if (attrPos > lastPos) {
                lastPos=attrPos;
                Data.addVarStr(key,10);
              }
              Data.storeStr(attrPos,i + 1,value);
            }
          }
          i++;
        }
      }
    }
 else {
      SFIToolkit.displayln("String_Node_Str");
    }
  }
 catch (  Exception e) {
    SFIToolkit.displayln("String_Node_Str" + e.getClass().getName() + "String_Node_Str"+ e.getMessage());
    logger.log(Level.FINER,"String_Node_Str",e);
    returnCode=-1;
  }
  return returnCode;
}

Fixed version (ground truth):
public static int getTimeSeries(String[] args){
  List<PortableTimeSeries> tslist=null;
  int returnCode=0;
  if (args.length < 2) {
    SFIToolkit.displayln("String_Node_Str");
    return -1;
  }
  String provider=args[0];
  String tsKey=args[1];
  String start="String_Node_Str";
  String end="String_Node_Str";
  String meta="String_Node_Str";
  boolean processMeta=false;
  boolean processData=true;
  if (args.length >= 3 && !args[2].isEmpty()) {
    start=args[2];
  }
  if (args.length >= 4 && !args[3].isEmpty()) {
    end=args[3];
  }
  if (args.length >= 5) {
    meta=args[4];
    if (meta.equalsIgnoreCase("String_Node_Str")) {
      meta="String_Node_Str";
    }
    if (meta.equalsIgnoreCase("String_Node_Str")) {
      SFIToolkit.displayln("String_Node_Str");
    }
 else     if (meta.equalsIgnoreCase("String_Node_Str")) {
      SFIToolkit.displayln("String_Node_Str");
      processMeta=true;
    }
 else     if (meta.equalsIgnoreCase("String_Node_Str")) {
      SFIToolkit.displayln("String_Node_Str");
      processMeta=true;
      processData=false;
    }
 else {
      SFIToolkit.displayln("String_Node_Str" + meta);
    }
  }
  try {
    int dataLength=0;
    tslist=SdmxClientHandler.getTimeSeries(provider,tsKey,start,end);
    if (tslist == null) {
      SFIToolkit.displayln("String_Node_Str");
      return -1;
    }
 else {
      SFIToolkit.displayln("String_Node_Str" + tslist.size() + "String_Node_Str");
    }
    if (processData) {
      for (Iterator<PortableTimeSeries> iterator=tslist.iterator(); iterator.hasNext(); ) {
        PortableTimeSeries ts=(PortableTimeSeries)iterator.next();
        dataLength+=ts.getObservations().size();
      }
    }
 else {
      dataLength=tslist.size();
    }
    if (dataLength > 0) {
      int name=0;
      int date=0;
      int val=0;
      Data.setObsCount(dataLength);
      Data.addVarStr("String_Node_Str",10);
      name=Data.getVarIndex("String_Node_Str");
      int lastPos=name;
      if (processData) {
        SFIToolkit.displayln("String_Node_Str" + dataLength + "String_Node_Str");
        Data.addVarStr("String_Node_Str",5);
        Data.addVarDouble("String_Node_Str");
        date=Data.getVarIndex("String_Node_Str");
        val=Data.getVarIndex("String_Node_Str");
        lastPos=val;
      }
      int i=0;
      int rowOffset=0;
      for (Iterator<PortableTimeSeries> iterator=tslist.iterator(); iterator.hasNext(); ) {
        PortableTimeSeries ts=(PortableTimeSeries)iterator.next();
        String tsname=ts.getName();
        if (processData) {
          List<Double> tsobs=ts.getObservations();
          List<String> tsdates=ts.getTimeSlots();
          int j=0;
          for (Iterator<Double> iterator2=tsobs.iterator(); iterator2.hasNext(); ) {
            Data.storeStr(name,rowOffset + j + 1,tsname);
            Data.storeNum(val,rowOffset + j + 1,iterator2.next());
            Data.storeStr(date,rowOffset + j + 1,tsdates.get(j));
            if (processMeta) {
              List<String> dimensions=ts.getDimensions();
              List<String> attributes=ts.getAttributes();
              attributes.addAll(dimensions);
              for (Iterator<String> iterator3=attributes.iterator(); iterator3.hasNext(); ) {
                String attr=(String)iterator3.next();
                String[] tokens=attr.split("String_Node_Str");
                String key=tokens[0];
                String value=tokens[1];
                if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) {
                  int attrPos=Data.getVarIndex(key);
                  if (attrPos > lastPos) {
                    lastPos=attrPos;
                    Data.addVarStr(key,value.length());
                  }
                  Data.storeStr(attrPos,rowOffset + j + 1,value);
                }
              }
              if (processMeta) {
                List<String> obsAttrNames=ts.getObsLevelAttributesNames();
                for (Iterator<String> iterator3=obsAttrNames.iterator(); iterator3.hasNext(); ) {
                  String attrName=(String)iterator3.next();
                  List<String> obsAttr=ts.getObsLevelAttributes(attrName);
                  if (obsAttr != null && !obsAttr.isEmpty()) {
                    int attrPos=Data.getVarIndex(attrName);
                    if (attrPos > lastPos) {
                      lastPos=attrPos;
                      Data.addVarStr(attrName,1);
                    }
                    Data.storeStr(attrPos,rowOffset + j + 1,obsAttr.get(j));
                  }
                }
              }
            }
            j++;
          }
          rowOffset=j;
        }
 else {
          Data.storeStr(name,i + 1,tsname);
          List<String> dimensions=ts.getDimensions();
          List<String> attributes=ts.getAttributes();
          attributes.addAll(dimensions);
          for (Iterator<String> iterator3=attributes.iterator(); iterator3.hasNext(); ) {
            String attr=(String)iterator3.next();
            String[] tokens=attr.split("String_Node_Str");
            String key=tokens[0];
            String value=tokens[1];
            if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) {
              int attrPos=Data.getVarIndex(key);
              if (attrPos > lastPos) {
                lastPos=attrPos;
                Data.addVarStr(key,10);
              }
              Data.storeStr(attrPos,i + 1,value);
            }
          }
        }
        i++;
      }
    }
 else {
      SFIToolkit.displayln("String_Node_Str");
    }
  }
 catch (  Exception e) {
    SFIToolkit.displayln("String_Node_Str" + e.getClass().getName() + "String_Node_Str"+ e.getMessage());
    logger.log(Level.FINER,"String_Node_Str",e);
    returnCode=-1;
  }
  return returnCode;
}