nus-yam/ex-repair huggingface dataset:
Program: 25893
Project: 25893
Buggy source:
@Override public void implementStep(StepImpl stepImpl) throws Exception {
  List<String> paramTypes=new ArrayList<String>();
  StepValueExtractor.StepValue stepValue=new StepValueExtractor().getFor(stepImpl.getStepText());
  String className=Util.getUniqueName();
  StringBuilder classText=new StringBuilder();
  classText.append("String_Node_Str").append(className).append("String_Node_Str");
  classText.append("String_Node_Str").append(stepValue.value).append("String_Node_Str");
  if (stepImpl.isContinueOnFailure()) {
    classText.append("String_Node_Str");
  }
  classText.append("String_Node_Str").append("String_Node_Str");
  for (int i=0; i < stepValue.paramCount; i++) {
    if (i + 1 == stepValue.paramCount) {
      classText.append("String_Node_Str").append(i);
    }
 else {
      classText.append("String_Node_Str").append(i).append("String_Node_Str");
    }
    paramTypes.add("String_Node_Str");
  }
  String implementation=stepImpl.getImplementation();
  implementation=getStepImplementation(stepValue,implementation,paramTypes,stepImpl.isValidStatement());
  classText.append("String_Node_Str").append(implementation).append("String_Node_Str");
  classText.append("String_Node_Str");
  Util.appendToFile(Util.combinePath(getStepImplementationsDir(),"String_Node_Str"),classText.toString());
}

Fixed version (ground truth):
@Override public void implementStep(StepImpl stepImpl) throws Exception {
  List<String> paramTypes=new ArrayList<String>();
  StepValueExtractor stepValueExtractor=new StepValueExtractor();
  StepValueExtractor.StepValue stepValue=stepValueExtractor.getFor(stepImpl.getFirstStepText());
  ArrayList<String> stepValues=stepValueExtractor.getValueFor(stepImpl.getAllStepTexts());
  String className=Util.getUniqueName();
  StringBuilder classText=new StringBuilder();
  classText.append("String_Node_Str").append(className).append("String_Node_Str");
  classText.append(createStepTeplate(stepValueExtractor.getValueFor(stepImpl.getAllStepTexts())));
  if (stepImpl.isContinueOnFailure()) {
    classText.append("String_Node_Str");
  }
  classText.append("String_Node_Str").append("String_Node_Str");
  for (int i=0; i < stepValue.paramCount; i++) {
    if (i + 1 == stepValue.paramCount) {
      classText.append("String_Node_Str").append(i);
    }
 else {
      classText.append("String_Node_Str").append(i).append("String_Node_Str");
    }
    paramTypes.add("String_Node_Str");
  }
  String implementation=stepImpl.getImplementation();
  implementation=getStepImplementation(stepValue,implementation,paramTypes,stepImpl.isValidStatement());
  classText.append("String_Node_Str").append(implementation).append("String_Node_Str");
  classText.append("String_Node_Str");
  Util.appendToFile(Util.combinePath(getStepImplementationsDir(),"String_Node_Str"),classText.toString());
}
Program: 25894
Project: 25894
Buggy source:
/** 
 * Generate a css file that extends bootstrap to have different grid properties
 * @param num Number of columns
 * @param minify True if generated code should be minified, false otherwise
 */
private void generate(int num,boolean minify){
  try {
    if (minify) {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
 else {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
    BufferedWriter out=new BufferedWriter(new FileWriter(readFileName()));
    out.write("String_Node_Str" + nl + nl+ nl);
    String name[]={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
    printInitProperties(out,name,num);
    Object[][] tableData=divisionTable.getRowData();
    for (int i=0; i < tableData.length; i++) {
      tb="String_Node_Str";
      if (isZeroWidth((String)tableData[i][1]))       printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
 else {
        if (!minify)         tb="String_Node_Str";
        out.write(nl + "String_Node_Str" + sp+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ sp+ "String_Node_Str"+ nl);
        printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
        out.write("String_Node_Str" + nl);
      }
    }
    out.close();
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
 catch (  IOException e) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
/** 
 * Generate a css file that extends bootstrap to have different grid properties
 * @param num Number of columns
 * @param minify True if generated code should be minified, false otherwise
 */
private void generate(int num,boolean minify){
  try {
    if (minify) {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
 else {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
    BufferedWriter out=new BufferedWriter(new FileWriter(readFileName()));
    out.write("String_Node_Str" + nl + nl+ nl);
    Object[][] tableData=divisionTable.getRowData();
    printInitProperties(out,tableData,num);
    for (int i=0; i < tableData.length; i++) {
      tb="String_Node_Str";
      if (isZeroWidth((String)tableData[i][1]))       printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
 else {
        if (!minify)         tb="String_Node_Str";
        out.write(nl + "String_Node_Str" + sp+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ sp+ "String_Node_Str"+ nl);
        printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
        out.write("String_Node_Str" + nl);
      }
    }
    out.close();
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
 catch (  IOException e) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 25895
Project: 25895
Buggy source:
/** 
 * Print the initial properties that all columns share
 * @param out Output stream to file
 * @param name Array of names of different column types
 * @param num Number of columns
 * @throws IOException
 */
private void printInitProperties(BufferedWriter out,String[] name,int num) throws IOException {
  for (int i=1; i < num; i++) {
    for (int j=0; j < name.length; j++) {
      out.write(name[j] + i + "String_Node_Str"+ nl);
    }
  }
  for (int j=0; j < name.length - 1; j++) {
    out.write(name[j] + num + "String_Node_Str"+ nl);
  }
  out.write(name[name.length - 1] + num + sp+ "String_Node_Str"+ nl);
  Object[][] tableData=propertyTable.getRowData();
  for (int i=0; i < tableData.length - 1; i++) {
    out.write(sp + sp + tableData[i][0]+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ nl);
  }
  out.write(sp + sp + tableData[tableData.length - 1][0]+ "String_Node_Str"+ sp+ tableData[tableData.length - 1][1]+ sc+ nl);
  out.write("String_Node_Str" + nl + nl);
}

Fixed version (ground truth):
/** 
 * Print the initial properties that all columns share
 * @param out Output stream to file
 * @param name Array of names of different column types
 * @param num Number of columns
 * @throws IOException
 */
private void printInitProperties(BufferedWriter out,Object[][] name,int num) throws IOException {
  for (int i=1; i < num; i++) {
    for (int j=0; j < name.length; j++) {
      out.write("String_Node_Str" + name[j][0] + "String_Node_Str"+ i+ "String_Node_Str"+ nl);
    }
  }
  for (int j=0; j < name.length - 1; j++) {
    out.write("String_Node_Str" + name[j][0] + "String_Node_Str"+ num+ "String_Node_Str"+ nl);
  }
  out.write("String_Node_Str" + name[name.length - 1][0] + "String_Node_Str"+ num+ sp+ "String_Node_Str"+ nl);
  Object[][] tableData=propertyTable.getRowData();
  for (int i=0; i < tableData.length - 1; i++) {
    out.write(sp + sp + tableData[i][0]+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ nl);
  }
  out.write(sp + sp + tableData[tableData.length - 1][0]+ "String_Node_Str"+ sp+ tableData[tableData.length - 1][1]+ sc+ nl);
  out.write("String_Node_Str" + nl + nl);
}
Program: 25897
Project: 25897
Buggy source:
/** 
 * Analyzes a string to determine whether or not it is indicating a viewport width of zero If the first character is 0 and is not followed by another digit or radix point, it is taken as zero 
 * @param str String to be analyzed
 * @return Returns true if the string is determined to mean zero, false otherwise.
 */
private boolean isZeroWidth(String str){
  return (str.charAt(0) == '0' && (str.length() == 1 || (!Character.isDigit(str.charAt(1)) && str.charAt(1) != '.')));
}

Fixed version (ground truth):
/** 
 * Analyzes a string to determine whether or not it is indicating a view-port width of zero. If the string is empty, it is taken as zero. If the first character is 0 and is not followed by another digit or radix point, it is taken as zero.
 * @param str - String to be analyzed.
 * @return Returns true if the string is determined to mean zero, false otherwise.
 */
private boolean isZeroWidth(String str){
  return (str.equals("String_Node_Str") || str.charAt(0) == '0' && (str.length() == 1 || (!Character.isDigit(str.charAt(1)) && str.charAt(1) != '.')));
}
Program: 25898
Project: 25898
Buggy source:
/** 
 * Loads and sets the icons for the frame.
 * @param frame The frame for which icons are being set.
 */
private static void setFrameIcons(JFrame frame){
  ArrayList<BufferedImage> icons=new ArrayList<BufferedImage>();
  try {
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
  }
 catch (  IOException e) {
  }
  frame.setIconImages(icons);
}

Fixed version (ground truth):
/** 
 * Loads and sets the icons for the frame.
 * @param frame - The frame for which icons are being set.
 */
private static void setFrameIcons(JFrame frame){
  ArrayList<BufferedImage> icons=new ArrayList<BufferedImage>();
  try {
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
    icons.add(ImageIO.read(frame.getClass().getResource("String_Node_Str")));
  }
 catch (  IOException e) {
  }
  frame.setIconImages(icons);
}
Program: 25899
Project: 25899
Buggy source:
/** 
 * Print properties of each of each column type
 * @param out Output stream to file
 * @param name Name of the column
 * @param num Number of columns
 * @throws IOException
 */
private void printColProperties(BufferedWriter out,String name,int num) throws IOException {
  for (int i=1; i < num; i++) {
    out.write(tb + name + i+ "String_Node_Str"+ nl);
  }
  out.write(tb + name + num+ sp+ "String_Node_Str"+ nl+ tb+ sp+ sp+ "String_Node_Str"+ sp+ "String_Node_Str"+ sc+ nl+ tb+ "String_Node_Str"+ nl);
  printColItem(out,name,"String_Node_Str",num,1);
  printColItem(out,name + "String_Node_Str","String_Node_Str",num,0);
  printColItem(out,name + "String_Node_Str","String_Node_Str",num,0);
  printColItem(out,name + "String_Node_Str","String_Node_Str",num,0);
}

Fixed version (ground truth):
/** 
 * Print properties of each of each column type.
 * @param out - Output stream to file.
 * @param name - Name of the column.
 * @param num - Number of columns.
 * @throws IOException
 */
private void printColProperties(BufferedWriter out,String name,int num) throws IOException {
  printColItem(out,name,"String_Node_Str",num,1);
  printColItem(out,name + "String_Node_Str","String_Node_Str",num,0);
  printColItem(out,name + "String_Node_Str","String_Node_Str",num,0);
  printColItem(out,name + "String_Node_Str","String_Node_Str",num,0);
}
Program: 25900
Project: 25900
Buggy source:
/** 
 * Print properties of sub-types of each column type
 * @param out Output stream to file
 * @param name Name of the column
 * @param property css property that is being defined
 * @param num Number of columns
 * @param start Starting point of classes (either 0 or 1)
 * @throws IOException
 */
private void printColItem(BufferedWriter out,String name,String property,int num,int start) throws IOException {
  double inc=100.0 / num;
  for (int i=start; i < num + 1; i++) {
    out.write(nl + tb + name+ i+ sp+ "String_Node_Str"+ nl+ tb+ sp+ sp+ property+ "String_Node_Str"+ sp+ (inc * i)+ "String_Node_Str"+ sc+ nl+ tb+ "String_Node_Str"+ nl);
  }
}

Fixed version (ground truth):
/** 
 * Print properties of sub-types of each column type.
 * @param out - Output stream to file.
 * @param name - Name of the column.
 * @param property - Css property that is being defined.
 * @param num - Number of columns.
 * @param start - Starting point of classes (either 0 or 1).
 * @throws IOException
 */
private void printColItem(BufferedWriter out,String name,String property,int num,int start) throws IOException {
  double inc=100.0 / num;
  for (int i=start; i < num + 1; i++) {
    out.write(nl + tb + name+ i+ sp+ "String_Node_Str"+ nl+ tb+ sp+ sp+ property+ "String_Node_Str"+ sp+ (inc * i)+ "String_Node_Str"+ sc+ nl+ tb+ "String_Node_Str"+ nl);
  }
}
Program: 25901
Project: 25901
Buggy source:
/** 
 * Main method
 * @param args
 */
public static void main(String[] args){
  BootstrapGridGenerator gridGen=new BootstrapGridGenerator();
  JFrame frame=new JFrame();
  frame.setSize(gridGen.getWidth(),gridGen.getHeight());
  frame.setVisible(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.getContentPane().setLayout(new BorderLayout());
  setFrameIcons(frame);
  frame.getContentPane().add(gridGen,BorderLayout.CENTER);
  frame.validate();
}

Fixed version (ground truth):
/** 
 * Main method.
 * @param args
 */
public static void main(String[] args){
  BootstrapGridGenerator gridGen=new BootstrapGridGenerator();
  JFrame frame=new JFrame();
  frame.setSize(gridGen.getWidth(),gridGen.getHeight());
  frame.setVisible(true);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.getContentPane().setLayout(new BorderLayout());
  setFrameIcons(frame);
  frame.getContentPane().add(gridGen,BorderLayout.CENTER);
  frame.validate();
}
Program: 25902
Project: 25902
Buggy source:
/** 
 * Generate a css file that extends bootstrap to have different grid properties
 * @param num Number of columns
 * @param minify True if generated code should be minified, false otherwise
 */
private void generate(int num,boolean minify){
  try {
    if (minify) {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
 else {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
    BufferedWriter out=new BufferedWriter(new FileWriter(readFileName()));
    out.write("String_Node_Str" + nl + nl+ nl);
    Object[][] tableData=divisionTable.getRowData();
    printInitProperties(out,tableData,num);
    for (int i=0; i < tableData.length; i++) {
      tb="String_Node_Str";
      if (isZeroWidth((String)tableData[i][1]))       printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
 else {
        if (!minify)         tb="String_Node_Str";
        out.write(nl + "String_Node_Str" + sp+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ sp+ "String_Node_Str"+ nl);
        printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
        out.write("String_Node_Str" + nl);
      }
    }
    out.close();
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
 catch (  IOException e) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}

Fixed version (ground truth):
/** 
 * Generate a css file that extends bootstrap to have different grid properties.
 * @param num - Number of columns.
 * @param minify - True if generated code should be minified, false otherwise.
 */
private void generate(int num,boolean minify){
  try {
    if (minify) {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
 else {
      nl="String_Node_Str";
      sp="String_Node_Str";
      sc="String_Node_Str";
    }
    BufferedWriter out=new BufferedWriter(new FileWriter(readFileName()));
    if (minify)     out.write("String_Node_Str");
 else     out.write("String_Node_Str");
    Object[][] tableData=divisionTable.getRowData();
    printInitProperties(out,tableData,num);
    for (int i=0; i < tableData.length; i++) {
      tb="String_Node_Str";
      if (isZeroWidth((String)tableData[i][1]))       printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
 else {
        if (!minify)         tb="String_Node_Str";
        out.write(nl + "String_Node_Str" + sp+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ sp+ "String_Node_Str"+ nl);
        printColProperties(out,"String_Node_Str" + tableData[i][0] + "String_Node_Str",num);
        out.write("String_Node_Str" + nl);
      }
    }
    out.close();
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.INFORMATION_MESSAGE);
  }
 catch (  IOException e) {
    JOptionPane.showMessageDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.ERROR_MESSAGE);
  }
}
Program: 25903
Project: 25903
Buggy source:
/** 
 * Print the initial properties that all columns share
 * @param out Output stream to file
 * @param name Array of names of different column types
 * @param num Number of columns
 * @throws IOException
 */
private void printInitProperties(BufferedWriter out,Object[][] name,int num) throws IOException {
  for (int i=1; i < num; i++) {
    for (int j=0; j < name.length; j++) {
      out.write("String_Node_Str" + name[j][0] + "String_Node_Str"+ i+ "String_Node_Str"+ nl);
    }
  }
  for (int j=0; j < name.length - 1; j++) {
    out.write("String_Node_Str" + name[j][0] + "String_Node_Str"+ num+ "String_Node_Str"+ nl);
  }
  out.write("String_Node_Str" + name[name.length - 1][0] + "String_Node_Str"+ num+ sp+ "String_Node_Str"+ nl);
  Object[][] tableData=propertyTable.getRowData();
  for (int i=0; i < tableData.length - 1; i++) {
    out.write(sp + sp + tableData[i][0]+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ nl);
  }
  out.write(sp + sp + tableData[tableData.length - 1][0]+ "String_Node_Str"+ sp+ tableData[tableData.length - 1][1]+ sc+ nl);
  out.write("String_Node_Str" + nl + nl);
}

Fixed version (ground truth):
/** 
 * Print the initial properties that all columns share.
 * @param out - Output stream to file.
 * @param name - Array of names of different column types.
 * @param num - Number of columns.
 * @throws IOException
 */
private void printInitProperties(BufferedWriter out,Object[][] name,int num) throws IOException {
  for (int i=1; i < num; i++) {
    for (int j=0; j < name.length; j++) {
      out.write("String_Node_Str" + name[j][0] + "String_Node_Str"+ i+ "String_Node_Str"+ nl);
    }
  }
  for (int j=0; j < name.length - 1; j++) {
    out.write("String_Node_Str" + name[j][0] + "String_Node_Str"+ num+ "String_Node_Str"+ nl);
  }
  out.write("String_Node_Str" + name[name.length - 1][0] + "String_Node_Str"+ num+ sp+ "String_Node_Str"+ nl);
  Object[][] tableData=propertyTable.getRowData();
  for (int i=0; i < tableData.length - 1; i++) {
    out.write(sp + sp + tableData[i][0]+ "String_Node_Str"+ sp+ tableData[i][1]+ "String_Node_Str"+ nl);
  }
  out.write(sp + sp + tableData[tableData.length - 1][0]+ "String_Node_Str"+ sp+ tableData[tableData.length - 1][1]+ sc+ nl);
  out.write("String_Node_Str" + nl + nl);
}
Program: 25904
Project: 25904
Buggy source:
public ListTypeFacility(int position){
  capacitySortPosition=position;
  facilityName=capacitySortPosition + "String_Node_Str";
  currentCapacity=position + 2;
  requiredCapacity=position + 5;
}

Fixed version (ground truth):
public ListTypeFacility(int position){
  capacitySortPosition=position;
  facilityName=(capacitySortPosition + 1) + "String_Node_Str";
  currentCapacity=capacitySortPosition + 2;
  requiredCapacity=capacitySortPosition + 5;
}
Program: 25905
Project: 25905
Buggy source:
private ListTypeFacilityLab(Context appContext){
  mAppContext=appContext;
  mFacilities=new ArrayList<ListTypeFacility>();
  for (int i=1; i <= 100; i++) {
    ListTypeFacility ltf=new ListTypeFacility(i);
    mFacilities.add(ltf);
  }
}

Fixed version (ground truth):
private ListTypeFacilityLab(Context appContext){
  mAppContext=appContext;
  mFacilities=new ArrayList<ListTypeFacility>();
  for (int i=0; i < 100; i++) {
    ListTypeFacility ltf=new ListTypeFacility(i);
    mFacilities.add(ltf);
  }
}
Program: 25906
Project: 25906
Buggy source:
public Map<String,Object> getRecurrenceData(){
  if (name == null) {
    return null;
  }
  Map<String,Object> recurrenceData=new HashMap<>();
  Map<String,Object> configData=new HashMap<>();
  recurrenceData.put(NAME,name);
  if (name.equalsIgnoreCase(WEEKLY)) {
    configData.put(DAYS,days);
    recurrenceData.put(CONFIG,configData);
    recurrenceData.put(STEP,step);
  }
 else   if (name.equalsIgnoreCase(MONTHLY)) {
    configData.put(REPEAT_ON,repeat_on);
    recurrenceData.put(CONFIG,configData);
    recurrenceData.put(STEP,step);
  }
  recurrenceData.put(UNTIL,until);
  return recurrenceData;
}

Fixed version (ground truth):
public Map<String,Object> getRecurrenceData(){
  if (name == null) {
    return null;
  }
  Map<String,Object> recurrenceData=new HashMap<>();
  Map<String,Object> configData=new HashMap<>();
  recurrenceData.put(NAME,name);
  if (name.equalsIgnoreCase(WEEKLY)) {
    configData.put(DAYS,days);
    recurrenceData.put(CONFIG,configData);
    recurrenceData.put(STEP,step);
  }
 else   if (name.equalsIgnoreCase(MONTHLY)) {
    configData.put(REPEAT_ON,repeat_on);
    recurrenceData.put(CONFIG,configData);
    recurrenceData.put(STEP,step);
  }
 else {
    recurrenceData.put(CONFIG,configData);
  }
  recurrenceData.put(UNTIL,until);
  return recurrenceData;
}
Program: 25907
Project: 25907
Buggy source:
private CreateData addReminderRecurrenceInfo(CreateData createData){
  for (  Entry<String,List<Field.Value>> entry : unverifiedFieldValues.entrySet()) {
    String key=entry.getKey();
    if (key.equalsIgnoreCase(ReminderRecurrenceField.NAME)) {
      ReminderRecurrenceField.Value data=(ReminderRecurrenceField.Value)entry.getValue().get(0);
      if (data.getReminderData() != null) {
        createData.setReminder(data.getReminderData());
      }
      if (data.getRecurrenceData() != null) {
        createData.setRecurrence(data.getRecurrenceData());
      }
    }
    break;
  }
  return createData;
}

Fixed version (ground truth):
private CreateData addReminderRecurrenceInfo(CreateData createData){
  for (  Entry<String,List<Field.Value>> entry : unverifiedFieldValues.entrySet()) {
    String key=entry.getKey();
    if (key.equalsIgnoreCase(ReminderRecurrenceField.NAME)) {
      ReminderRecurrenceField.Value data=(ReminderRecurrenceField.Value)entry.getValue().get(0);
      if (data.getReminderData() != null) {
        createData.setReminder(data.getReminderData());
      }
      if (data.getRecurrenceData() != null) {
        createData.setRecurrence(data.getRecurrenceData());
      }
      break;
    }
  }
  return createData;
}
Program: 25908
Project: 25908
Buggy source:
public Settings(Boolean calendar,String time){
  this.calendar=calendar;
  this.time=time;
}

Fixed version (ground truth):
public Settings(Boolean calendar,String time,Boolean isCreateViewEditHidden){
  this.calendar=calendar;
  this.time=time;
  this.isCreateViewEditHidden=isCreateViewEditHidden;
}
Program: 25909
Project: 25909
Buggy source:
public DateField(CalculationField calculationField){
  super(calculationField);
  this.config=new Configuration(new Settings(calculationField.getConfiguration().isCalendar(),calculationField.getConfiguration().getTimeState()));
  this.values=new ArrayList<>();
  for (  Field.Value calcValue : calculationField.getValues()) {
    this.values.add((DateField.Value)calcValue);
  }
}

Fixed version (ground truth):
public DateField(CalculationField calculationField){
  super(calculationField);
  final CalculationField.Configuration configuration=calculationField.getConfiguration();
  this.config=new Configuration(new Settings(configuration.isCalendar(),configuration.getTimeState(),configuration.getIsHiddenCreateViewEdit()));
  this.values=new ArrayList<>();
  for (  Field.Value calcValue : calculationField.getValues()) {
    this.values.add((DateField.Value)calcValue);
  }
}
Program: 25910
Project: 25910
Buggy source:
public NumberField(CalculationField calculationField){
  super(calculationField);
  config=new Configuration(new Settings(calculationField.getConfiguration().getNumberOfDecimals()));
  this.values=new ArrayList<>();
  for (  Field.Value calcValue : calculationField.getValues()) {
    this.values.add((NumberField.Value)calcValue);
  }
}

Fixed version (ground truth):
public NumberField(CalculationField calculationField){
  super(calculationField);
  final CalculationField.Configuration configuration=calculationField.getConfiguration();
  config=new Configuration(new Settings(configuration.getNumberOfDecimals(),configuration.getIsHiddenCreateViewEdit()));
  this.values=new ArrayList<>();
  for (  Field.Value calcValue : calculationField.getValues()) {
    this.values.add((NumberField.Value)calcValue);
  }
}
Program: 25911
Project: 25911
Buggy source:
public Settings(Integer decimals){
  this.decimals=decimals;
}

Fixed version (ground truth):
public Settings(Integer decimals,boolean isCreateViewEdithidden){
  this.decimals=decimals;
  this.isCreateViewEditHidden=isCreateViewEdithidden;
}
Program: 25912
Project: 25912
Buggy source:
public Configuration(){
  settings=new Settings();
}

Fixed version (ground truth):
public Configuration(Settings settings){
  this.settings=settings;
}
Program: 25913
Project: 25913
Buggy source:
public TextField(CalculationField calculationField){
  super(calculationField);
  config=new Configuration();
  this.values=new ArrayList<>();
  for (  Field.Value calcValue : calculationField.getValues()) {
    this.values.add((TextField.Value)calcValue);
  }
}

Fixed version (ground truth):
public TextField(CalculationField calculationField){
  super(calculationField);
  config=new Configuration(new Settings(calculationField.getConfiguration().getIsHiddenCreateViewEdit()));
  this.values=new ArrayList<>();
  for (  Field.Value calcValue : calculationField.getValues()) {
    this.values.add((TextField.Value)calcValue);
  }
}
Program: 25914
Project: 25914
Buggy source:
@Override public void addValue(Value value){
  if (values != null && !values.contains(value)) {
    values.add(0,value);
  }
}

Fixed version (ground truth):
@Override public void addValue(Value value){
  if (values != null && !values.contains(value)) {
    values.add(value);
  }
}
Program: 25915
Project: 25915
Buggy source:
@Override protected VolleyError parseNetworkError(VolleyError volleyError){
  if (volleyError instanceof NoConnectionError && volleyError.getCause() instanceof UnknownHostException) {
    error=new ConnectionError(volleyError);
  }
 else   if (volleyError instanceof TimeoutError) {
    error=new NoResponseError(volleyError);
  }
 else {
    String errorJson=getResponseBody(volleyError.networkResponse);
    int responseCode=getResponseCode(volleyError.networkResponse);
    if (Utils.notEmpty(errorJson) && responseCode > 0) {
      error=new ApiError(errorJson,responseCode,volleyError);
    }
 else {
      try {
        error=new PodioError(volleyError);
      }
 catch (      Exception e) {
        error=new PodioError("String_Node_Str");
        error.setStackTrace(e.getStackTrace());
      }
    }
  }
synchronized (this) {
    notifyAll();
  }
  return volleyError;
}

Fixed version (ground truth):
@Override protected VolleyError parseNetworkError(VolleyError volleyError){
  if (volleyError instanceof NoConnectionError && volleyError.getCause() instanceof UnknownHostException) {
    error=new ConnectionError(volleyError);
  }
 else   if (volleyError instanceof TimeoutError) {
    error=new NoResponseError(volleyError);
  }
 else {
    String errorJson=getResponseBody(volleyError.networkResponse);
    int responseCode=getResponseCode(volleyError.networkResponse);
    if (Utils.notEmpty(errorJson) && responseCode > 0) {
      try {
        error=new ApiError(errorJson,responseCode,volleyError);
      }
 catch (      JsonSyntaxException jsonSyntaxException) {
        handleNoneJsonError(volleyError);
      }
    }
 else {
      handleNoneJsonError(volleyError);
    }
  }
synchronized (this) {
    notifyAll();
  }
  return volleyError;
}
Program: 25916
Project: 25916
Buggy source:
@Override public Map<String,Object> getCreateData(){
  HashMap<String,Object> data=null;
  if (createData != null) {
    data=new HashMap<String,Object>();
    data.put("String_Node_Str",createData);
  }
  return data;
}

Fixed version (ground truth):
@Override public Map<String,Object> getCreateData(){
  HashMap<String,Object> data=new HashMap<String,Object>();
  if (createData != null) {
    data.put("String_Node_Str",createData);
  }
 else   if (value != null) {
    data.put("String_Node_Str",value.getId());
  }
 else {
    data=null;
  }
  return data;
}
Program: 25917
Project: 25917
Buggy source:
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  Value value1=(Value)o;
  if (value != null ? !value.equals(value1.value) : value1.value != null)   return false;
  return !(createData != null ? !createData.equals(value1.createData) : value1.createData != null);
}

Fixed version (ground truth):
@Override public boolean equals(Object o){
  if (this == o)   return true;
  if (o == null || getClass() != o.getClass())   return false;
  Value value1=(Value)o;
  if (value != null ? !value.equals(value1.value) : value1.value != null)   return false;
  if (value.equals(value1.value))   return true;
  return !(createData != null ? !createData.equals(value1.createData) : value1.createData != null);
}
Program: 25918
Project: 25918
Buggy source:
/** 
 * Create a contact field value based on a space object
 * @param space
 */
public Value(Space space){
  createData=new ContactCreateData(space.getSpaceId(),CreateData.CreateDataTypes.space);
}

Fixed version (ground truth):
/** 
 * Create a contact field value based on a space object
 * @param space
 */
public Value(Space space){
  value=null;
  createData=new ContactCreateData(space.getSpaceId(),CreateData.CreateDataTypes.space);
}
Program: 25919
Project: 25919
Buggy source:
public T waitForResult(long maxSeconds);

Fixed version (ground truth):
/** 
 * Make sure to catch any thrown PodioError
 * @param maxSeconds
 * @return
 * @throws PodioError
 */
public T waitForResult(long maxSeconds) throws PodioError ;
Program: 25920
Project: 25920
Buggy source:
public void addErrorListener(ErrorListener listener,boolean deliverErrorNow,Throwable error){
  if (listener != null) {
    if (deliverErrorNow) {
      listener.onErrorOccured(error);
    }
 else {
synchronized (ERROR_LISTENER_LOCK) {
        errorListeners.add(listener);
      }
    }
  }
}

Fixed version (ground truth):
public void addErrorListener(ErrorListener listener,boolean deliverErrorNow,Throwable error){
  if (listener != null) {
    if (deliverErrorNow) {
      listener.onErrorOccurred(error);
    }
 else {
synchronized (ERROR_LISTENER_LOCK) {
        errorListeners.add(listener);
      }
    }
  }
}
Program: 25921
Project: 25921
Buggy source:
public void deliverError(Throwable error){
synchronized (RESULT_LISTENER_LOCK) {
    resultListeners.clear();
  }
  if (Utils.isEmpty(errorListeners) && Utils.isEmpty(GLOBAL_ERROR_LISTENERS)) {
    throw new PodioError(error);
  }
synchronized (ERROR_LISTENER_LOCK) {
    boolean isConsumed=false;
    for (    ErrorListener listener : errorListeners) {
      if (listener != null) {
        if (listener.onErrorOccured(error)) {
          isConsumed=true;
          break;
        }
      }
    }
    errorListeners.clear();
    if (isConsumed) {
      return;
    }
  }
  for (  ErrorListener listener : GLOBAL_ERROR_LISTENERS) {
    if (listener != null) {
      if (listener.onErrorOccured(error)) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
public void deliverError(Throwable error){
synchronized (RESULT_LISTENER_LOCK) {
    resultListeners.clear();
  }
  if (Utils.isEmpty(errorListeners) && Utils.isEmpty(GLOBAL_ERROR_LISTENERS)) {
    throw new PodioError(error);
  }
synchronized (ERROR_LISTENER_LOCK) {
    boolean isConsumed=false;
    for (    ErrorListener listener : errorListeners) {
      if (listener != null) {
        if (listener.onErrorOccurred(error)) {
          isConsumed=true;
          break;
        }
      }
    }
    errorListeners.clear();
    if (isConsumed) {
      return;
    }
  }
  for (  ErrorListener listener : GLOBAL_ERROR_LISTENERS) {
    if (listener != null) {
      if (listener.onErrorOccurred(error)) {
        return;
      }
    }
  }
}
Program: 25922
Project: 25922
Buggy source:
@Override public void retry(VolleyError error) throws VolleyError {
  super.retry(error);
  String accessToken=Utils.notEmpty(originalAccessToken) ? originalAccessToken : "String_Node_Str";
  if (error instanceof AuthFailureError && accessToken.equals(Session.accessToken())) {
    Uri uri=buildAuthUri();
    if (uri == null) {
      clearRequestQueue();
      throw error;
    }
    String url=parseUrl(uri);
    HashMap<String,String> params=parseParams(uri);
    VolleyRequest<Void> reAuthRequest=VolleyRequest.newAuthRequest(url,params);
    reAuthRequest.setRetryPolicy(new DefaultRetryPolicy(CLIENT_DEFAULT_TIMEOUT_MS,0,0));
    addToRefreshQueue(reAuthRequest);
    reAuthRequest.withErrorListener(new Request.ErrorListener(){
      @Override public boolean onErrorOccured(      Throwable cause){
        clearRequestQueue();
        return true;
      }
    }
).waitForResult(TimeUnit.MILLISECONDS.toSeconds(CLIENT_DEFAULT_TIMEOUT_MS));
  }
}

Fixed version (ground truth):
@Override public void retry(VolleyError error) throws VolleyError {
  super.retry(error);
  String accessToken=Utils.notEmpty(originalAccessToken) ? originalAccessToken : "String_Node_Str";
  if (error instanceof AuthFailureError && accessToken.equals(Session.accessToken())) {
    Uri uri=buildAuthUri();
    if (uri == null) {
      clearRequestQueue();
      throw error;
    }
    String url=parseUrl(uri);
    HashMap<String,String> params=parseParams(uri);
    VolleyRequest<Void> reAuthRequest=VolleyRequest.newAuthRequest(url,params);
    reAuthRequest.setRetryPolicy(new DefaultRetryPolicy(CLIENT_DEFAULT_TIMEOUT_MS,0,0));
    addToRefreshQueue(reAuthRequest);
    reAuthRequest.withErrorListener(new Request.ErrorListener(){
      @Override public boolean onErrorOccurred(      Throwable cause){
        clearRequestQueue();
        return true;
      }
    }
).waitForResult(TimeUnit.MILLISECONDS.toSeconds(CLIENT_DEFAULT_TIMEOUT_MS));
  }
}
Program: 25923
Project: 25923
Buggy source:
public void deliverError(Throwable error){
  if (Utils.isEmpty(errorListeners) && Utils.isEmpty(GLOBAL_ERROR_LISTENERS)) {
    throw new PodioError(error);
  }
  for (  ErrorListener listener : errorListeners) {
    if (listener != null) {
      if (listener.onErrorOccured(error)) {
        return;
      }
    }
  }
  for (  ErrorListener listener : GLOBAL_ERROR_LISTENERS) {
    if (listener != null) {
      if (listener.onErrorOccured(error)) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
public void deliverError(Throwable error){
  resultListeners.clear();
  if (Utils.isEmpty(errorListeners) && Utils.isEmpty(GLOBAL_ERROR_LISTENERS)) {
    throw new PodioError(error);
  }
  for (  ErrorListener listener : errorListeners) {
    if (listener != null) {
      if (listener.onErrorOccured(error)) {
        errorListeners.clear();
        return;
      }
      errorListeners.remove(listener);
    }
  }
  for (  ErrorListener listener : GLOBAL_ERROR_LISTENERS) {
    if (listener != null) {
      if (listener.onErrorOccured(error)) {
        return;
      }
    }
  }
}
Program: 25924
Project: 25924
Buggy source:
public void deliverResult(T result){
  for (  ResultListener<T> listener : resultListeners) {
    if (listener != null) {
      if (listener.onRequestPerformed(result)) {
        break;
      }
    }
  }
}

Fixed version (ground truth):
public void deliverResult(T result){
  errorListeners.clear();
  for (  ResultListener<T> listener : resultListeners) {
    if (listener != null) {
      if (listener.onRequestPerformed(result)) {
        resultListeners.clear();
        break;
      }
      resultListeners.remove(listener);
    }
  }
}
Program: 25925
Project: 25925
Buggy source:
void deliverSession(){
  String accessToken=Session.accessToken();
  String refreshToken=Session.refreshToken();
  long expires=Session.expires();
  for (  SessionListener listener : sessionListeners) {
    if (listener != null) {
      if (listener.onSessionChanged(accessToken,refreshToken,expires)) {
        return;
      }
    }
  }
  for (  SessionListener listener : GLOBAL_SESSION_LISTENERS) {
    if (listener != null) {
      if (listener.onSessionChanged(accessToken,refreshToken,expires)) {
        return;
      }
    }
  }
}

Fixed version (ground truth):
void deliverSession(){
  String accessToken=Session.accessToken();
  String refreshToken=Session.refreshToken();
  long expires=Session.expires();
  for (  SessionListener listener : sessionListeners) {
    if (listener != null) {
      if (listener.onSessionChanged(accessToken,refreshToken,expires)) {
        sessionListeners.clear();
        return;
      }
      sessionListeners.remove(listener);
    }
  }
  for (  SessionListener listener : GLOBAL_SESSION_LISTENERS) {
    if (listener != null) {
      if (listener.onSessionChanged(accessToken,refreshToken,expires)) {
        return;
      }
    }
  }
}
Program: 25926
Project: 25926
Buggy source:
public void addErrorListener(ErrorListener listener,boolean deliverErrorNow,Throwable error){
  if (listener != null) {
    errorListeners.add(listener);
    if (deliverErrorNow) {
      listener.onErrorOccured(error);
    }
  }
}

Fixed version (ground truth):
public void addErrorListener(ErrorListener listener,boolean deliverErrorNow,Throwable error){
  if (listener != null) {
    if (deliverErrorNow) {
      listener.onErrorOccured(error);
    }
 else {
      errorListeners.add(listener);
    }
  }
}
Program: 25927
Project: 25927
Buggy source:
public void addResultListener(ResultListener<T> listener,boolean deliverResultNow,T result){
  if (listener != null) {
    resultListeners.add(listener);
    if (deliverResultNow) {
      listener.onRequestPerformed(result);
    }
  }
}

Fixed version (ground truth):
public void addResultListener(ResultListener<T> listener,boolean deliverResultNow,T result){
  if (listener != null) {
    if (deliverResultNow) {
      listener.onRequestPerformed(result);
    }
 else {
      resultListeners.add(listener);
    }
  }
}
Program: 25928
Project: 25928
Buggy source:
void addSessionListener(SessionListener listener,boolean deliverSessionNow){
  if (listener != null) {
    sessionListeners.add(listener);
    if (deliverSessionNow) {
      listener.onSessionChanged(Session.accessToken(),Session.refreshToken(),Session.expires());
    }
  }
}

Fixed version (ground truth):
void addSessionListener(SessionListener listener,boolean deliverSessionNow){
  if (listener != null) {
    if (deliverSessionNow) {
      listener.onSessionChanged(Session.accessToken(),Session.refreshToken(),Session.expires());
    }
 else {
      sessionListeners.add(listener);
    }
  }
}
Program: 25929
Project: 25929
Buggy source:
private HashMap<String,ArrayList<Event>> parseEventData(String json){
  HashMap<String,ArrayList<Event>> result=new HashMap<String,ArrayList<Event>>();
  if (Utils.isEmpty(json)) {
    return result;
  }
  JsonParser jsonParser=new JsonParser();
  JsonElement root=jsonParser.parse(json);
  JsonArray jsonElements;
  if (root.isJsonArray()) {
    jsonElements=root.getAsJsonArray();
  }
 else   if (root.isJsonObject()) {
    jsonElements=new JsonArray();
    jsonElements.add(root.getAsJsonObject());
  }
 else {
    return result;
  }
  JsonObject jsonObject;
  Gson gson=new Gson();
  for (  JsonElement jsonElement : jsonElements) {
    if (jsonElement.isJsonObject()) {
      jsonObject=jsonElement.getAsJsonObject();
      JsonObject fayeData=getJsonObject(jsonObject,"String_Node_Str");
      JsonObject podioData=getJsonObject(fayeData,"String_Node_Str");
      String key=getString(jsonObject,"String_Node_Str");
      String type=getString(podioData,"String_Node_Str");
      try {
        Event.Type eventType=Event.Type.valueOf(type);
        Event event=gson.fromJson(fayeData,eventType.getClassObject());
        addEventToMap(key,event,result);
      }
 catch (      NullPointerException e) {
      }
catch (      IllegalArgumentException e) {
      }
    }
  }
  return null;
}

Fixed version (ground truth):
private HashMap<String,ArrayList<Event>> parseEventData(String json){
  HashMap<String,ArrayList<Event>> result=new HashMap<String,ArrayList<Event>>();
  if (Utils.isEmpty(json)) {
    return result;
  }
  JsonParser jsonParser=new JsonParser();
  JsonElement root=jsonParser.parse(json);
  JsonArray jsonElements;
  if (root.isJsonArray()) {
    jsonElements=root.getAsJsonArray();
  }
 else   if (root.isJsonObject()) {
    jsonElements=new JsonArray();
    jsonElements.add(root.getAsJsonObject());
  }
 else {
    return result;
  }
  JsonObject jsonObject;
  Gson gson=new Gson();
  for (  JsonElement jsonElement : jsonElements) {
    if (jsonElement.isJsonObject()) {
      jsonObject=jsonElement.getAsJsonObject();
      JsonObject fayeData=getJsonObject(jsonObject,"String_Node_Str");
      JsonObject podioData=getJsonObject(fayeData,"String_Node_Str");
      String key=getString(jsonObject,"String_Node_Str");
      String type=getString(podioData,"String_Node_Str");
      try {
        Event.Type eventType=Event.Type.valueOf(type);
        Event event=gson.fromJson(podioData,eventType.getClassObject());
        addEventToMap(key,event,result);
      }
 catch (      NullPointerException e) {
      }
catch (      IllegalArgumentException e) {
      }
    }
  }
  return null;
}
Program: 25930
Project: 25930
Buggy source:
/** 
 * Removes the given listener from the stated push channel. If   {@code null}is provided as listener, then all listeners will be removed. If there are no more listeners listening for events at the stated channel, a termination request will be sent to the Podio API.
 */
@Override public void unsubscribe(String channel,ResultListener<Event[]> listener){
  if (listener == null) {
    if (subscriptions.containsKey(channel)) {
      subscriptions.remove(channel);
      execute(new UnsubscribeRequest(channel,transport));
    }
  }
 else {
    if (subscriptions.containsKey(channel)) {
      ArrayList<EventListener> listeners=subscriptions.get(channel);
      listeners.remove(listener);
      if (listeners.size() == 0) {
        subscriptions.remove(channel);
        execute(new UnsubscribeRequest(channel,transport));
      }
    }
  }
  if (subscriptions.isEmpty()) {
    execute(new DisconnectRequest(transport));
  }
}

Fixed version (ground truth):
/** 
 * Removes the given listener from the stated push channel. If   {@code null}is provided as listener, then all listeners will be removed. If there are no more listeners listening for events at the stated channel, a termination request will be sent to the Podio API.
 */
@Override public void unsubscribe(String channel,EventListener listener){
  if (listener == null) {
    if (subscriptions.containsKey(channel)) {
      subscriptions.remove(channel);
      execute(new UnsubscribeRequest(channel,transport));
    }
  }
 else {
    if (subscriptions.containsKey(channel)) {
      ArrayList<EventListener> listeners=subscriptions.get(channel);
      listeners.remove(listener);
      if (listeners.size() == 0) {
        subscriptions.remove(channel);
        execute(new UnsubscribeRequest(channel,transport));
      }
    }
  }
  if (subscriptions.isEmpty()) {
    execute(new DisconnectRequest(transport));
  }
}
Program: 25931
Project: 25931
Buggy source:
public void unsubscribe(String channel,ResultListener<Event[]> listener);

Fixed version (ground truth):
public void unsubscribe(String channel,EventListener listener);
Program: 25932
Project: 25932
Buggy source:
/** 
 * Fetches the events for the conversation with the given id.
 * @param id The id of the conversation.
 * @param limit The number of events to fetch.
 * @param offset The number of events to skip before start fetching.
 * @return A ticket which the caller can use to identify this request with.
 */
public Request<Conversation.Event> getConversationMessages(long id,int limit,int offset){
  Path filter=new Path().withEvents(id,limit,offset);
  return get(filter,Conversation.Event.class);
}

Fixed version (ground truth):
/** 
 * Fetches the events for the conversation with the given id.
 * @param id The id of the conversation.
 * @param limit The number of events to fetch.
 * @param offset The number of events to skip before start fetching.
 * @return A ticket which the caller can use to identify this request with.
 */
public Request<Conversation.Event[]> getConversationMessages(long id,int limit,int offset){
  Path filter=new Path().withEvents(id,limit,offset);
  return get(filter,Conversation.Event[].class);
}
Program: 25933
Project: 25933
Buggy source:
/** 
 * Removes the given listener from the stated push channel. If   {@code null}is provided as listener, then all listeners will be removed. If there are no more listeners listening for events at the stated channel, a termination request will be sent to the Podio API.
 */
@Override public Request<Void> unsubscribe(String channel,ResultListener<?> listener){
  if (listener != null) {
    if (subscriptions.containsKey(channel)) {
      subscriptions.get(channel).listeners.remove(listener);
    }
    return null;
  }
 else {
    if (subscriptions.containsKey(channel)) {
      subscriptions.remove(channel);
    }
    UnsubscribeRequest request=new UnsubscribeRequest(channel,transport);
    execute(request);
    return request;
  }
}

Fixed version (ground truth):
/** 
 * Removes the given listener from the stated push channel. If   {@code null}is provided as listener, then all listeners will be removed. If there are no more listeners listening for events at the stated channel, a termination request will be sent to the Podio API.
 */
@Override public Request<Void> unsubscribe(String channel,ResultListener<?> listener){
  if (listener == null) {
    if (subscriptions.containsKey(channel)) {
      subscriptions.remove(channel);
      UnsubscribeRequest request=new UnsubscribeRequest(channel,transport);
      execute(request);
      return request;
    }
  }
 else {
    if (subscriptions.containsKey(channel)) {
      Subscription subscription=subscriptions.get(channel);
      subscription.listeners.remove(listener);
      if (subscription.listeners.size() == 0) {
        subscription=null;
        subscriptions.remove(channel);
        UnsubscribeRequest request=new UnsubscribeRequest(channel,transport);
        execute(request);
        return request;
      }
    }
  }
  return null;
}