Program: 133502
Project: 133502
Buggy source:
/** 
 * If the action name is ReflectivityModel.processActionName, then calculates the reflectivity and scattering density profiles for the material layers and input fields.
 * @see {@link org.eclipse.ice.item.Item#process(String)}
 */
@Override public FormStatus process(String actionName){
  FormStatus retVal=null;
  if (actionName.equals(processActionName)) {
    ListComponent<Material> matList=(ListComponent<Material>)form.getComponent(matListId);
    ArrayList<Slab> slabs=new ArrayList<Slab>();
    for (    Material mat : matList) {
      Slab slab=new Slab();
      slab.thickness=mat.getProperty("String_Node_Str");
      slab.interfaceWidth=mat.getProperty("String_Node_Str");
      slab.scatteringLength=mat.getProperty(Material.SCAT_LENGTH_DENSITY);
      slab.trueAbsLength=mat.getProperty(Material.MASS_ABS_COHERENT);
      slab.incAbsLength=mat.getProperty(Material.MASS_ABS_INCOHERENT);
      slabs.add(slab);
    }
    int numRough=Integer.parseInt(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(RoughnessEntryName).getValue());
    double deltaQ0=Double.parseDouble(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(deltaQ0EntryName).getValue());
    double deltaQ1ByQ=Double.parseDouble(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(deltaQ1ByQEntryName).getValue());
    double wavelength=Double.parseDouble(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(WaveLengthEntryName).getValue());
    double[] waveVector;
    double[] rData;
    double[] error;
    String fileName=((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(WaveEntryName).getValue();
    IFile userDataFile=project.getFile(fileName);
    Form dataForm=new CSVReader().read(userDataFile);
    ListComponent<String[]> userData=(ListComponent<String[]>)dataForm.getComponent(1);
    waveVector=new double[userData.size()];
    rData=new double[userData.size()];
    error=new double[userData.size()];
    for (int i=0; i < userData.size(); i++) {
      String[] dataLine=userData.get(i);
      double waveDataPoint=Double.parseDouble(dataLine[0]);
      waveVector[i]=waveDataPoint;
      double rDataPoint=Double.parseDouble(dataLine[1]);
      rData[i]=rDataPoint;
      double errorDataPoint=Double.parseDouble(dataLine[2]);
      error[i]=errorDataPoint;
    }
    ReflectivityCalculator calculator=new ReflectivityCalculator();
    ReflectivityProfile profile=calculator.getReflectivityProfile(slabs.toArray(new Slab[slabs.size()]),numRough,deltaQ0,deltaQ1ByQ,wavelength,waveVector,false);
    ReflectivityProfile rq4Profile=calculator.getReflectivityProfile(slabs.toArray(new Slab[slabs.size()]),numRough,deltaQ0,deltaQ1ByQ,wavelength,waveVector,true);
    double[] reflectivity=profile.reflectivity;
    double[] scatDensity=profile.scatteringDensity;
    double[] depth=profile.depth;
    double[] rq4=rq4Profile.reflectivity;
    double[] rq4Data=new double[rq4.length];
    double rChiSquare=0;
    double rq4ChiSquare=0;
    for (int i=0; i < reflectivity.length; i++) {
      double rPoint=reflectivity[i];
      double rDataPoint=rData[i];
      double rq4Point=rq4[i];
      double rq4DataPoint=rDataPoint * (Math.pow(waveVector[i],4));
      rq4Data[i]=rq4DataPoint;
      rChiSquare+=(rPoint - rDataPoint) * (rPoint - rDataPoint) / rPoint;
      rq4ChiSquare+=(rq4Point - rq4DataPoint) * (rq4Point - rq4DataPoint) / rq4Point;
    }
    ((DataComponent)form.getComponent(outputCompId)).retrieveEntry(ChiSquaredEntryName).setValue(Double.toString(rChiSquare));
    ((DataComponent)form.getComponent(outputCompId)).retrieveEntry(ChiSquaredRQ4EntryName).setValue(Double.toString(rq4ChiSquare));
    String reflectData="String_Node_Str";
    for (int i=0; i < reflectivity.length; i++) {
      reflectData+=Double.toString(waveVector[i]) + "String_Node_Str" + Double.toString(reflectivity[i])+ "String_Node_Str"+ Double.toString(rData[i])+ "String_Node_Str"+ Double.toString(error[i])+ "String_Node_Str";
    }
    ByteArrayInputStream reflectStream=new ByteArrayInputStream(reflectData.getBytes());
    String scatData="String_Node_Str";
    for (int i=0; i < depth.length; i++) {
      scatData+=Double.toString(depth[i]) + "String_Node_Str" + Double.toString(scatDensity[i])+ "String_Node_Str";
    }
    ByteArrayInputStream scatStream=new ByteArrayInputStream(scatData.getBytes());
    String rq4DataStr="String_Node_Str";
    for (int i=0; i < rq4.length; i++) {
      rq4DataStr+=Double.toString(waveVector[i]) + "String_Node_Str" + Double.toString(rq4[i])+ "String_Node_Str"+ Double.toString(rData[i])+ "String_Node_Str"+ Double.toString(error[i])+ "String_Node_Str";
    }
    ByteArrayInputStream rq4Stream=new ByteArrayInputStream(rq4DataStr.getBytes());
    ResourceComponent resources=(ResourceComponent)form.getComponent(resourceCompId);
    if (resources.isEmpty()) {
      String basename="String_Node_Str" + form.getId() + "String_Node_Str";
      IFile reflectivityFile=project.getFile(basename + "String_Node_Str");
      IFile scatteringFile=project.getFile(basename + "String_Node_Str");
      IFile rq4File=project.getFile(basename + "String_Node_Str");
      try {
        if (!reflectivityFile.exists()) {
          reflectivityFile.create(reflectStream,true,null);
        }
        if (!scatteringFile.exists()) {
          scatteringFile.create(scatStream,true,null);
        }
        if (!rq4File.exists()) {
          rq4File.create(rq4Stream,true,null);
        }
        VizResource reflectivitySource=new VizResource(reflectivityFile.getLocation().toFile());
        reflectivitySource.setName("String_Node_Str");
        reflectivitySource.setId(1);
        reflectivitySource.setDescription("String_Node_Str");
        VizResource scatDensitySource=new VizResource(scatteringFile.getLocation().toFile());
        scatDensitySource.setName("String_Node_Str");
        scatDensitySource.setId(2);
        scatDensitySource.setDescription("String_Node_Str" + "String_Node_Str");
        VizResource rq4Source=new VizResource(rq4File.getLocation().toFile());
        rq4Source.setName("String_Node_Str");
        rq4Source.setId(3);
        rq4Source.setDescription("String_Node_Str");
        resources.addResource(reflectivitySource);
        resources.addResource(scatDensitySource);
        resources.addResource(rq4Source);
      }
 catch (      CoreException|IOException e) {
        System.err.println("String_Node_Str" + "String_Node_Str");
        logger.error(getClass().getName() + "String_Node_Str",e);
      }
    }
 else {
      try {
        VizResource reflectSource=(VizResource)resources.get(0);
        IFile reflectivityFile=project.getFile(reflectSource.getContents().getName());
        reflectivityFile.setContents(new BufferedInputStream(reflectStream),true,false,null);
        reflectSource.setName(reflectSource.getName());
        VizResource scatSource=(VizResource)resources.get(1);
        IFile scatteringFile=project.getFile(scatSource.getContents().getName());
        scatteringFile.setContents(new BufferedInputStream(scatStream),true,false,null);
        scatSource.setName(scatSource.getName());
        VizResource rq4Source=(VizResource)resources.get(2);
        IFile rq4File=project.getFile(rq4Source.getContents().getName());
        rq4File.setContents(new BufferedInputStream(rq4Stream),true,false,null);
        rq4Source.setName(rq4Source.getName());
      }
 catch (      CoreException|NullPointerException e) {
        System.err.println("String_Node_Str" + "String_Node_Str");
        logger.error(getClass().getName() + "String_Node_Str",e);
        retVal=FormStatus.InfoError;
      }
    }
    if (retVal == null) {
      retVal=FormStatus.Processed;
    }
  }
 else {
    retVal=super.process(actionName);
  }
  return retVal;
}

Fixed version (ground truth):
/** 
 * If the action name is ReflectivityModel.processActionName, then calculates the reflectivity and scattering density profiles for the material layers and input fields.
 * @see {@link org.eclipse.ice.item.Item#process(String)}
 */
@Override public FormStatus process(String actionName){
  FormStatus retVal=null;
  if (actionName.equals(processActionName)) {
    ListComponent<Material> matList=(ListComponent<Material>)form.getComponent(matListId);
    ArrayList<Slab> slabs=new ArrayList<Slab>();
    for (    Material mat : matList) {
      Slab slab=new Slab();
      slab.thickness=mat.getProperty("String_Node_Str");
      slab.interfaceWidth=mat.getProperty("String_Node_Str");
      slab.scatteringLength=mat.getProperty(Material.SCAT_LENGTH_DENSITY);
      slab.trueAbsLength=mat.getProperty(Material.MASS_ABS_COHERENT);
      slab.incAbsLength=mat.getProperty(Material.MASS_ABS_INCOHERENT);
      slabs.add(slab);
    }
    int numRough=Integer.parseInt(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(RoughnessEntryName).getValue());
    double deltaQ0=Double.parseDouble(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(deltaQ0EntryName).getValue());
    double deltaQ1ByQ=Double.parseDouble(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(deltaQ1ByQEntryName).getValue());
    double wavelength=Double.parseDouble(((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(WaveLengthEntryName).getValue());
    double[] waveVector;
    double[] rData;
    double[] error;
    String fileName=((DataComponent)form.getComponent(paramsCompId)).retrieveEntry(WaveEntryName).getValue();
    IFile userDataFile=project.getFile(fileName);
    Form dataForm=new CSVReader().read(userDataFile);
    ListComponent<String[]> userData=(ListComponent<String[]>)dataForm.getComponent(1);
    waveVector=new double[userData.size()];
    rData=new double[userData.size()];
    error=new double[userData.size()];
    for (int i=0; i < userData.size(); i++) {
      String[] dataLine=userData.get(i);
      double waveDataPoint=Double.parseDouble(dataLine[0]);
      waveVector[i]=waveDataPoint;
      double rDataPoint=Double.parseDouble(dataLine[1]);
      rData[i]=rDataPoint;
      double errorDataPoint=Double.parseDouble(dataLine[2]);
      error[i]=errorDataPoint;
    }
    ReflectivityCalculator calculator=new ReflectivityCalculator();
    ReflectivityProfile profile=calculator.getReflectivityProfile(slabs.toArray(new Slab[slabs.size()]),numRough,deltaQ0,deltaQ1ByQ,wavelength,waveVector,false);
    ReflectivityProfile rq4Profile=calculator.getReflectivityProfile(slabs.toArray(new Slab[slabs.size()]),numRough,deltaQ0,deltaQ1ByQ,wavelength,waveVector,true);
    double[] reflectivity=profile.reflectivity;
    double[] scatDensity=profile.scatteringDensity;
    double[] depth=profile.depth;
    double[] rq4=rq4Profile.reflectivity;
    double[] rq4Data=new double[rq4.length];
    double rChiSquare=0;
    double rq4ChiSquare=0;
    for (int i=0; i < reflectivity.length; i++) {
      double rPoint=reflectivity[i];
      double rDataPoint=rData[i];
      double rq4Point=rq4[i];
      double rq4DataPoint=rDataPoint * (Math.pow(waveVector[i],4));
      rq4Data[i]=rq4DataPoint;
      rChiSquare+=(rPoint - rDataPoint) * (rPoint - rDataPoint) / rPoint;
      rq4ChiSquare+=(rq4Point - rq4DataPoint) * (rq4Point - rq4DataPoint) / rq4Point;
    }
    ((DataComponent)form.getComponent(outputCompId)).retrieveEntry(ChiSquaredEntryName).setValue(Double.toString(rChiSquare));
    ((DataComponent)form.getComponent(outputCompId)).retrieveEntry(ChiSquaredRQ4EntryName).setValue(Double.toString(rq4ChiSquare));
    String reflectData="String_Node_Str";
    for (int i=0; i < reflectivity.length; i++) {
      reflectData+=Double.toString(waveVector[i]) + "String_Node_Str" + Double.toString(reflectivity[i])+ "String_Node_Str"+ Double.toString(rData[i])+ "String_Node_Str"+ Double.toString(error[i])+ "String_Node_Str";
    }
    ByteArrayInputStream reflectStream=new ByteArrayInputStream(reflectData.getBytes());
    String scatData="String_Node_Str";
    for (int i=0; i < depth.length; i++) {
      scatData+=Double.toString(depth[i]) + "String_Node_Str" + Double.toString(scatDensity[i])+ "String_Node_Str";
    }
    ByteArrayInputStream scatStream=new ByteArrayInputStream(scatData.getBytes());
    String rq4DataStr="String_Node_Str";
    for (int i=0; i < rq4.length; i++) {
      rq4DataStr+=Double.toString(waveVector[i]) + "String_Node_Str" + Double.toString(rq4[i])+ "String_Node_Str"+ Double.toString(rq4Data[i])+ "String_Node_Str"+ Double.toString(error[i])+ "String_Node_Str";
    }
    ByteArrayInputStream rq4Stream=new ByteArrayInputStream(rq4DataStr.getBytes());
    ResourceComponent resources=(ResourceComponent)form.getComponent(resourceCompId);
    if (resources.isEmpty()) {
      String basename="String_Node_Str" + form.getId() + "String_Node_Str";
      IFile reflectivityFile=project.getFile(basename + "String_Node_Str");
      IFile scatteringFile=project.getFile(basename + "String_Node_Str");
      IFile rq4File=project.getFile(basename + "String_Node_Str");
      try {
        if (!reflectivityFile.exists()) {
          reflectivityFile.create(reflectStream,true,null);
        }
        if (!scatteringFile.exists()) {
          scatteringFile.create(scatStream,true,null);
        }
        if (!rq4File.exists()) {
          rq4File.create(rq4Stream,true,null);
        }
        VizResource reflectivitySource=new VizResource(reflectivityFile.getLocation().toFile());
        reflectivitySource.setName("String_Node_Str");
        reflectivitySource.setId(1);
        reflectivitySource.setDescription("String_Node_Str");
        VizResource scatDensitySource=new VizResource(scatteringFile.getLocation().toFile());
        scatDensitySource.setName("String_Node_Str");
        scatDensitySource.setId(2);
        scatDensitySource.setDescription("String_Node_Str" + "String_Node_Str");
        VizResource rq4Source=new VizResource(rq4File.getLocation().toFile());
        rq4Source.setName("String_Node_Str");
        rq4Source.setId(3);
        rq4Source.setDescription("String_Node_Str");
        resources.addResource(reflectivitySource);
        resources.addResource(scatDensitySource);
        resources.addResource(rq4Source);
      }
 catch (      CoreException|IOException e) {
        System.err.println("String_Node_Str" + "String_Node_Str");
        logger.error(getClass().getName() + "String_Node_Str",e);
      }
    }
 else {
      try {
        VizResource reflectSource=(VizResource)resources.get(0);
        IFile reflectivityFile=project.getFile(reflectSource.getContents().getName());
        reflectivityFile.setContents(new BufferedInputStream(reflectStream),true,false,null);
        reflectSource.setName(reflectSource.getName());
        VizResource scatSource=(VizResource)resources.get(1);
        IFile scatteringFile=project.getFile(scatSource.getContents().getName());
        scatteringFile.setContents(new BufferedInputStream(scatStream),true,false,null);
        scatSource.setName(scatSource.getName());
        VizResource rq4Source=(VizResource)resources.get(2);
        IFile rq4File=project.getFile(rq4Source.getContents().getName());
        rq4File.setContents(new BufferedInputStream(rq4Stream),true,false,null);
        rq4Source.setName(rq4Source.getName());
      }
 catch (      CoreException|NullPointerException e) {
        System.err.println("String_Node_Str" + "String_Node_Str");
        logger.error(getClass().getName() + "String_Node_Str",e);
        retVal=FormStatus.InfoError;
      }
    }
    if (retVal == null) {
      retVal=FormStatus.Processed;
    }
  }
 else {
    retVal=super.process(actionName);
  }
  return retVal;
}