nus-yam/ex-repair huggingface dataset:
Program: 47208
Project: 47208
Buggy source:
public File[] getSharedFoldersArray(boolean monitored,ArrayList<String> tags){
  String folders;
  if (monitored) {
    folders=getConfiguration().getFoldersMonitored();
  }
 else {
    folders=getConfiguration().getFolders(tags);
  }
  if (folders == null || folders.length() == 0) {
    return null;
  }
  ArrayList<File> directories=new ArrayList<>();
  String[] foldersArray=folders.split("String_Node_Str");
  for (  String folder : foldersArray) {
    folder=folder.trim();
    folder=folder.replaceAll("String_Node_Str","String_Node_Str");
    LOGGER.info("String_Node_Str" + folder);
    File file=new File(folder);
    if (file.exists()) {
      if (!file.isDirectory()) {
        LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
      }
    }
 else {
      LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
    }
    directories.add(file);
  }
  File f[]=new File[directories.size()];
  directories.toArray(f);
  return f;
}

Fixed version (ground truth):
public File[] getSharedFoldersArray(boolean monitored,ArrayList<String> tags){
  String folders;
  if (monitored) {
    folders=getConfiguration().getFoldersMonitored();
  }
 else {
    folders=getConfiguration().getFolders(tags);
  }
  if (folders == null || folders.length() == 0) {
    return null;
  }
  ArrayList<File> directories=new ArrayList<>();
  String[] foldersArray=folders.split("String_Node_Str");
  for (  String folder : foldersArray) {
    folder=folder.trim();
    folder=folder.replaceAll("String_Node_Str","String_Node_Str");
    folder=new UnicodeUnescaper().translate(folder);
    LOGGER.info("String_Node_Str" + folder);
    File file=new File(folder);
    if (file.exists()) {
      if (!file.isDirectory()) {
        LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
      }
    }
 else {
      LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
    }
    directories.add(file);
  }
  File f[]=new File[directories.size()];
  directories.toArray(f);
  return f;
}
Program: 47209
Project: 47209
Buggy source:
public File[] getSharedFoldersArray(boolean monitored,ArrayList<String> tags,PmsConfiguration configuration){
  String folders;
  if (monitored) {
    folders=configuration.getFoldersMonitored();
  }
 else {
    folders=configuration.getFolders(tags);
  }
  if (folders == null || folders.length() == 0) {
    return null;
  }
  ArrayList<File> directories=new ArrayList<>();
  String[] foldersArray=folders.split("String_Node_Str");
  for (  String folder : foldersArray) {
    folder=folder.trim();
    folder=folder.replaceAll("String_Node_Str","String_Node_Str");
    LOGGER.info("String_Node_Str" + folder);
    File file=new File(folder);
    if (file.exists()) {
      if (!file.isDirectory()) {
        LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
      }
    }
 else {
      LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
    }
    directories.add(file);
  }
  File f[]=new File[directories.size()];
  directories.toArray(f);
  return f;
}

Fixed version (ground truth):
public File[] getSharedFoldersArray(boolean monitored,ArrayList<String> tags,PmsConfiguration configuration){
  String folders;
  if (monitored) {
    folders=configuration.getFoldersMonitored();
  }
 else {
    folders=configuration.getFolders(tags);
  }
  if (folders == null || folders.length() == 0) {
    return null;
  }
  ArrayList<File> directories=new ArrayList<>();
  String[] foldersArray=folders.split("String_Node_Str");
  for (  String folder : foldersArray) {
    folder=folder.trim();
    folder=folder.replaceAll("String_Node_Str","String_Node_Str");
    folder=new UnicodeUnescaper().translate(folder);
    LOGGER.info("String_Node_Str" + folder);
    File file=new File(folder);
    if (file.exists()) {
      if (!file.isDirectory()) {
        LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
      }
    }
 else {
      LOGGER.warn("String_Node_Str" + folder + "String_Node_Str"+ Messages.getString("String_Node_Str")+ "String_Node_Str");
    }
    directories.add(file);
  }
  File f[]=new File[directories.size()];
  directories.toArray(f);
  return f;
}
Program: 47210
Project: 47210
Buggy source:
public static InputStream scaleThumb(InputStream in,RendererConfiguration r) throws IOException {
  if (in == null) {
    return in;
  }
  String ts=r.getThumbSize();
  if (StringUtils.isEmpty(ts) && StringUtils.isEmpty(r.getThumbBG())) {
    return in;
  }
  int w;
  int h;
  Color col=null;
  BufferedImage img=ImageIO.read(in);
  if (img == null) {
    return in;
  }
  w=img.getWidth();
  h=img.getHeight();
  if (StringUtils.isNotEmpty(r.getThumbSize())) {
    w=getHW(ts.split("String_Node_Str"),0);
    h=getHW(ts.split("String_Node_Str"),1);
    if (w == 0 || h == 0) {
      LOGGER.debug("String_Node_Str",ts);
      w=h=0;
    }
  }
  if (StringUtils.isNotEmpty(r.getThumbBG())) {
    try {
      Field field=Color.class.getField(r.getThumbBG());
      col=(Color)field.get(null);
    }
 catch (    Exception e) {
      LOGGER.debug("String_Node_Str" + r.getThumbBG());
    }
  }
  if (w == 0 && h == 0 && col == null) {
    return in;
  }
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  BufferedImage img1=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
  Graphics2D g=img1.createGraphics();
  if (col != null) {
    g.setColor(col);
  }
  g.fillRect(0,0,w,h);
  g.drawImage(img,0,0,w,h,null);
  ImageIO.write(img1,"String_Node_Str",out);
  out.flush();
  return new ByteArrayInputStream(out.toByteArray());
}

Fixed version (ground truth):
public static InputStream scaleThumb(InputStream in,RendererConfiguration r) throws IOException {
  if (in == null) {
    return in;
  }
  String ts=r.getThumbSize();
  if (StringUtils.isEmpty(ts) && StringUtils.isEmpty(r.getThumbBG())) {
    return in;
  }
  int w;
  int h;
  Color col=null;
  BufferedImage img;
  try {
    img=ImageIO.read(in);
  }
 catch (  Exception e) {
    LOGGER.debug("String_Node_Str" + e);
    img=null;
  }
  if (img == null) {
    return in;
  }
  w=img.getWidth();
  h=img.getHeight();
  if (StringUtils.isNotEmpty(r.getThumbSize())) {
    w=getHW(ts.split("String_Node_Str"),0);
    h=getHW(ts.split("String_Node_Str"),1);
    if (w == 0 || h == 0) {
      LOGGER.debug("String_Node_Str",ts);
      w=h=0;
    }
  }
  if (StringUtils.isNotEmpty(r.getThumbBG())) {
    try {
      Field field=Color.class.getField(r.getThumbBG());
      col=(Color)field.get(null);
    }
 catch (    Exception e) {
      LOGGER.debug("String_Node_Str" + r.getThumbBG());
    }
  }
  if (w == 0 && h == 0 && col == null) {
    return in;
  }
  ByteArrayOutputStream out=new ByteArrayOutputStream();
  BufferedImage img1=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);
  Graphics2D g=img1.createGraphics();
  if (col != null) {
    g.setColor(col);
  }
  g.fillRect(0,0,w,h);
  g.drawImage(img,0,0,w,h,null);
  ImageIO.write(img1,"String_Node_Str",out);
  out.flush();
  return new ByteArrayInputStream(out.toByteArray());
}
Program: 47232
Project: 47232
Buggy source:
@Override public void discoverChildren(){
  for (  DLNAResource r : list) {
    addChild(r);
    if (r.isResume()) {
      DLNAResource clone=r.clone();
      clone.setResume(null);
      addChild(clone);
    }
  }
}

Fixed version (ground truth):
@Override public void discoverChildren(){
  for (  DLNAResource r : list) {
    ExternalListener master=r.getMasterParent();
    addChild(r);
    r.setMasterParent(master);
    if (r.isResume()) {
      DLNAResource clone=r.clone();
      clone.setResume(null);
      addChild(clone);
      clone.setMasterParent(master);
    }
  }
}
Program: 47233
Project: 47233
Buggy source:
@Override public void discoverChildren(){
  for (  DLNAResource r : list) {
    addChild(r);
    if (r.isResume()) {
      DLNAResource clone=r.clone();
      clone.setResume(null);
      addChild(clone);
    }
  }
}

Fixed version (ground truth):
@Override public void discoverChildren(){
  for (  DLNAResource r : list) {
    ExternalListener master=r.getMasterParent();
    addChild(r);
    r.setMasterParent(master);
    if (r.isResume()) {
      DLNAResource clone=r.clone();
      clone.setResume(null);
      addChild(clone);
      clone.setMasterParent(master);
    }
  }
}
Program: 47234
Project: 47234
Buggy source:
/** 
 * Returns the maximum video width supported by the renderer as defined in the renderer configuration. The default value 0 means unlimited.
 * @return The maximum video width.
 */
public int getMaxVideoWidth(){
  return getInt(MAX_VIDEO_WIDTH,1920);
}

Fixed version (ground truth):
/** 
 * Returns the maximum video width supported by the renderer as defined in the renderer configuration. The default value 0 means unlimited.
 * @return The maximum video width.
 */
public int getMaxVideoWidth(){
  return getInt(MAX_VIDEO_WIDTH,0);
}
Program: 47235
Project: 47235
Buggy source:
/** 
 * Returns the maximum video height supported by the renderer as defined in the renderer configuration. The default value 0 means unlimited.
 * @return The maximum video height.
 */
public int getMaxVideoHeight(){
  return getInt(MAX_VIDEO_HEIGHT,1080);
}

Fixed version (ground truth):
/** 
 * Returns the maximum video height supported by the renderer as defined in the renderer configuration. The default value 0 means unlimited.
 * @return The maximum video height.
 */
public int getMaxVideoHeight(){
  return getInt(MAX_VIDEO_HEIGHT,0);
}
Program: 47236
Project: 47236
Buggy source:
private ProcessWrapperImpl getMplayerThumbnail(InputFile media) throws IOException {
  File file=media.getFile();
  String args[]=new String[14];
  args[0]=configuration.getMplayerPath();
  args[1]="String_Node_Str";
  args[2]="String_Node_Str" + new Double(getDurationInSeconds()).intValue();
  args[3]="String_Node_Str";
  if (file != null) {
    args[4]=ProcessUtil.getShortFileNameIfWideChars(file.getAbsolutePath());
  }
 else {
    args[4]="String_Node_Str";
  }
  args[5]="String_Node_Str";
  args[6]="String_Node_Str";
  args[7]="String_Node_Str";
  args[8]="String_Node_Str";
  args[9]="String_Node_Str";
  args[10]="String_Node_Str";
  args[11]="String_Node_Str";
  String frameName="String_Node_Str" + media.hashCode();
  frameName="String_Node_Str" + frameName + "String_Node_Str";
  frameName=frameName.replace(',','_');
  args[12]="String_Node_Str" + frameName;
  args[13]="String_Node_Str";
  OutputParams params=new OutputParams(configuration);
  params.workDir=configuration.getTempFolder();
  params.maxBufferSize=1;
  params.stdin=media.getPush();
  params.log=true;
  params.noexitcheck=true;
  final ProcessWrapperImpl pw=new ProcessWrapperImpl(args,params);
  setParsing(true);
  Runnable r=new Runnable(){
    @Override public void run(){
      try {
        Thread.sleep(3000);
      }
 catch (      InterruptedException e) {
      }
      pw.stopProcess();
      setParsing(false);
    }
  }
;
  Thread failsafe=new Thread(r,"String_Node_Str");
  failsafe.start();
  pw.runInSameThread();
  setParsing(false);
  return pw;
}

Fixed version (ground truth):
private ProcessWrapperImpl getMplayerThumbnail(InputFile media) throws IOException {
  File file=media.getFile();
  String args[]=new String[14];
  args[0]=configuration.getMplayerPath();
  args[1]="String_Node_Str";
  args[2]="String_Node_Str" + (int)getDurationInSeconds();
  args[3]="String_Node_Str";
  if (file != null) {
    args[4]=ProcessUtil.getShortFileNameIfWideChars(file.getAbsolutePath());
  }
 else {
    args[4]="String_Node_Str";
  }
  args[5]="String_Node_Str";
  args[6]="String_Node_Str";
  args[7]="String_Node_Str";
  args[8]="String_Node_Str";
  args[9]="String_Node_Str";
  args[10]="String_Node_Str";
  args[11]="String_Node_Str";
  String frameName="String_Node_Str" + media.hashCode();
  frameName="String_Node_Str" + frameName + "String_Node_Str";
  frameName=frameName.replace(',','_');
  args[12]="String_Node_Str" + frameName;
  args[13]="String_Node_Str";
  OutputParams params=new OutputParams(configuration);
  params.workDir=configuration.getTempFolder();
  params.maxBufferSize=1;
  params.stdin=media.getPush();
  params.log=true;
  params.noexitcheck=true;
  final ProcessWrapperImpl pw=new ProcessWrapperImpl(args,params);
  setParsing(true);
  Runnable r=new Runnable(){
    @Override public void run(){
      try {
        Thread.sleep(3000);
      }
 catch (      InterruptedException e) {
      }
      pw.stopProcess();
      setParsing(false);
    }
  }
;
  Thread failsafe=new Thread(r,"String_Node_Str");
  failsafe.start();
  pw.runInSameThread();
  setParsing(false);
  return pw;
}
Program: 47246
Project: 47246
Buggy source:
public boolean isH264(){
  return getCodecV() != null && getCodecV().contains("String_Node_Str");
}

Fixed version (ground truth):
public boolean isH264(){
  return getCodecV() != null && getCodecV().startsWith("String_Node_Str");
}
Program: 47254
Project: 47254
Buggy source:
public static String run(String... cmd){
  try {
    ProcessBuilder pb=new ProcessBuilder(cmd);
    pb.redirectErrorStream(true);
    Process p=pb.start();
    BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    StringBuilder output=new StringBuilder();
    while ((line=br.readLine()) != null) {
      output.append(line).append("String_Node_Str");
    }
    p.waitFor();
    if (p.exitValue() != 0) {
      LOGGER.debug("String_Node_Str",cmd,p.exitValue());
    }
    return output.toString();
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str" + cmd,e);
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
public static String run(String... cmd){
  try {
    ProcessBuilder pb=new ProcessBuilder(cmd);
    pb.redirectErrorStream(true);
    Process p=pb.start();
    BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    StringBuilder output=new StringBuilder();
    while ((line=br.readLine()) != null) {
      output.append(line).append("String_Node_Str");
    }
    p.waitFor();
    if (p.exitValue() != 0) {
      LOGGER.debug("String_Node_Str",Arrays.toString(cmd),p.exitValue());
    }
    return output.toString();
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str" + Arrays.toString(cmd),e);
  }
  return "String_Node_Str";
}
Program: 47257
Project: 47257
Buggy source:
/** 
 * Returns a   {@link InputStream} that represents the thumbnail used.
 * @see net.pms.dlna.DLNAResource#getThumbnailInputStream()
 */
@Override public InputStream getThumbnailInputStream(){
  return getResourceInputStream(thumbnailIcon);
}

Fixed version (ground truth):
/** 
 * Returns a   {@link InputStream} that represents the thumbnail used.
 * @see net.pms.dlna.DLNAResource#getThumbnailInputStream()
 */
@Override public InputStream getThumbnailInputStream(){
  if (thumbnailIcon == null) {
    try {
      return super.getThumbnailInputStream();
    }
 catch (    IOException e) {
      return null;
    }
  }
  return getResourceInputStream(thumbnailIcon);
}
Program: 47260
Project: 47260
Buggy source:
public String getDcTitle(String name,DLNAResource dlna){
  if (line_w == -1) {
    String s=getTextWrap();
    line_w=getIntAt(s,"String_Node_Str",0);
    if (line_w > 0) {
      line_h=getIntAt(s,"String_Node_Str",0);
      indent=getIntAt(s,"String_Node_Str",0);
      dc_date=getIntAt(s,"String_Node_Str",1) != 0;
      int ws=getIntAt(s,"String_Node_Str",9);
      inset=new String(new byte[indent]).replaceAll("String_Node_Str",Character.toString((char)ws));
      LOGGER.debug("String_Node_Str",getRendererName(),line_w,line_h,indent,ws,dc_date ? "String_Node_Str" : "String_Node_Str");
    }
  }
  if (line_w > 0 && name.length() > line_w) {
    int i=dlna.isFolder() ? 0 : indent;
    String head=name.substring(0,i + (Character.isSpace(name.charAt(i)) ? 1 : 0));
    String tail=name.substring(i);
    return head + WordUtils.wrap(tail,line_w - i,"String_Node_Str" + (dlna.isFolder() ? "String_Node_Str" : inset),true);
  }
  return name;
}

Fixed version (ground truth):
public String getDcTitle(String name,DLNAResource dlna){
  if (line_w == -1) {
    String s=getTextWrap();
    line_w=getIntAt(s,"String_Node_Str",0);
    if (line_w > 0) {
      line_h=getIntAt(s,"String_Node_Str",0);
      indent=getIntAt(s,"String_Node_Str",0);
      dc_date=getIntAt(s,"String_Node_Str",1) != 0;
      int ws=getIntAt(s,"String_Node_Str",9);
      inset=new String(new byte[indent]).replaceAll("String_Node_Str",Character.toString((char)ws));
      LOGGER.debug("String_Node_Str",getRendererName(),line_w,line_h,indent,ws,dc_date ? "String_Node_Str" : "String_Node_Str");
    }
  }
  if (line_w > 0 && name.length() > line_w) {
    int i=dlna.isFolder() ? 0 : indent;
    String head=name.substring(0,i + (Character.isSpace(name.charAt(i)) ? 1 : 0));
    String tail=name.substring(i);
    name=head + WordUtils.wrap(tail,line_w - i,"String_Node_Str" + (dlna.isFolder() ? "String_Node_Str" : inset),true);
  }
  for (  String s : charMap.keySet()) {
    name=name.replaceAll(s,charMap.get(s));
  }
  return name;
}
Program: 47262
Project: 47262
Buggy source:
@Override public void discoverChildren(){
  addChild(new VirtualVideoAction(Messages.getString("String_Node_Str"),true){
    @Override public boolean enable(){
      for (      File f : files) {
        f.delete();
      }
      getParent().getChildren().clear();
      return true;
    }
  }
);
  for (  final File f : files) {
    String name=FileUtil.getFileNameWithoutExtension(f.getName());
    name=name.replaceAll(ResumeObj.CLEAN_REG,"String_Node_Str");
    addChild(new VirtualVideoAction(name,false){
      @Override public boolean enable(){
        f.delete();
        getParent().getChildren().remove(this);
        return false;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void discoverChildren(){
  final File[] files=ResumeObj.resumeFiles();
  addChild(new VirtualVideoAction(Messages.getString("String_Node_Str"),true){
    @Override public boolean enable(){
      for (      File f : files) {
        f.delete();
      }
      getParent().getChildren().clear();
      return true;
    }
  }
);
  for (  final File f : files) {
    String name=FileUtil.getFileNameWithoutExtension(f.getName());
    name=name.replaceAll(ResumeObj.CLEAN_REG,"String_Node_Str");
    addChild(new VirtualVideoAction(name,false){
      @Override public boolean enable(){
        f.delete();
        getParent().getChildren().remove(this);
        return false;
      }
    }
);
  }
}
Program: 47265
Project: 47265
Buggy source:
private void schedule(){
  TimerTask task=new TimerTask(){
    @Override public void run(){
      scan();
    }
  }
;
  Timer t=new Timer();
  t.scheduleAtFixedRate(task,0,INTERVAL);
}

Fixed version (ground truth):
public void schedule(){
  TimerTask task=new TimerTask(){
    @Override public void run(){
      scan();
    }
  }
;
  Timer t=new Timer();
  t.scheduleAtFixedRate(task,0,INTERVAL);
}
Program: 47266
Project: 47266
Buggy source:
public TempFileMgr(){
  files=new HashMap<>();
  parseCleanFile();
  schedule();
}

Fixed version (ground truth):
public TempFileMgr(){
  files=new HashMap<>();
  parseCleanFile();
}
Program: 47267
Project: 47267
Buggy source:
private void resumeStop(){
  if (!configuration.isResumeEnabled() || !isResumeable()) {
    return;
  }
  if (resume != null) {
    resume.stop(startTime,(long)(getMedia().getDurationInSeconds() * 1000));
    if (resume.isDone()) {
      getParent().getChildren().remove(this);
    }
    notifyRefresh();
  }
 else {
    for (    DLNAResource res : getParent().getChildren()) {
      if (res.isResume() && res.getName().equals(getName())) {
        res.resume.stop(startTime,(long)(getMedia().getDurationInSeconds() * 1000));
        if (res.resume.isDone()) {
          getParent().getChildren().remove(res);
        }
        return;
      }
    }
    ResumeObj r=ResumeObj.store(this,startTime);
    if (r != null) {
      DLNAResource clone=this.clone();
      clone.resume=r;
      clone.resHash=resHash;
      if (getMedia() != null) {
        try {
          clone.setMedia((DLNAMediaInfo)getMedia().clone());
        }
 catch (        CloneNotSupportedException e) {
          LOGGER.debug("String_Node_Str" + e);
        }
      }
      clone.setPlayer(getPlayer());
      getParent().addChildInternal(clone);
    }
  }
}

Fixed version (ground truth):
private void resumeStop(){
  if (!configuration.isResumeEnabled() || !isResumeable()) {
    return;
  }
  if (resume != null) {
    resume.stop(startTime,(long)(getMedia().getDurationInSeconds() * 1000));
    if (resume.isDone()) {
      getParent().getChildren().remove(this);
    }
    notifyRefresh();
  }
 else {
    for (    DLNAResource res : getParent().getChildren()) {
      if (res.isResume() && res.getName().equals(getName())) {
        res.resume.stop(startTime,(long)(getMedia().getDurationInSeconds() * 1000));
        if (res.resume.isDone()) {
          getParent().getChildren().remove(res);
        }
        return;
      }
    }
    ResumeObj r=ResumeObj.store(this,startTime);
    if (r != null) {
      DLNAResource clone=this.clone();
      clone.resume=r;
      clone.resHash=resHash;
      clone.setMedia(getMedia());
      clone.setPlayer(getPlayer());
      getParent().addChildInternal(clone);
    }
  }
}
Program: 47270
Project: 47270
Buggy source:
public static ResumeObj create(DLNAResource r){
  if (!configuration.isResumeEnabled()) {
    return null;
  }
  File f=resumeFile(r);
  if (!f.exists()) {
    return null;
  }
  ResumeObj res=new ResumeObj(f);
  res.read();
  if (res.noResume()) {
    return null;
  }
  if (r.getMedia() != null && r.getMedia().getDurationInSeconds() != 0) {
    r.getMedia().setDuration((double)res.resDuration);
  }
  res.setMinDuration(r.minPlayTime());
  return res;
}

Fixed version (ground truth):
public static ResumeObj create(DLNAResource r){
  if (!configuration.isResumeEnabled()) {
    return null;
  }
  File f=resumeFile(r);
  if (!f.exists()) {
    return null;
  }
  ResumeObj res=new ResumeObj(f);
  res.read();
  if (res.noResume()) {
    return null;
  }
  if (r.getMedia() != null) {
    double dur=r.getMedia().getDurationInSeconds();
    if (dur == 0 || dur == DLNAMediaInfo.TRANS_SIZE) {
      r.getMedia().setDuration((double)res.resDuration / 1000);
    }
  }
  res.setMinDuration(r.minPlayTime());
  return res;
}
Program: 47271
Project: 47271
Buggy source:
@Override public void serverReady(){
  nt.addRenderers();
  pt.addPlugins();
}

Fixed version (ground truth):
@Override public void serverReady(){
  gt.addRenderers();
  pt.addPlugins();
}
Program: 47272
Project: 47272
Buggy source:
public GeneralTab getGt(){
  return nt;
}

Fixed version (ground truth):
public GeneralTab getGt(){
  return gt;
}
Program: 47273
Project: 47273
Buggy source:
public JComponent buildMain(){
  final JTabbedPane tabbedPane=new JTabbedPane(SwingConstants.TOP);
  tabbedPane.setUI(new CustomTabbedPaneUI());
  st=new StatusTab(configuration);
  tt=new TracesTab(configuration);
  tr=new TranscodingTab(configuration);
  nt=new GeneralTab(configuration);
  ft=new NavigationShareTab(configuration);
  ht=new HelpTab();
  pt=new PluginTab(configuration);
  tabbedPane.addTab(Messages.getString("String_Node_Str"),st.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),tt.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),nt.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),pt.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),ft.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),tr.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),new HelpTab().build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),new AboutTab().build());
  tabbedPane.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      int selectedIndex=tabbedPane.getSelectedIndex();
      if (HELP_PAGES[selectedIndex] != null) {
        PMS.setHelpPage(HELP_PAGES[selectedIndex]);
        ht.updateContents();
      }
    }
  }
);
  tabbedPane.setBorder(new EmptyBorder(5,5,5,5));
  Locale locale=new Locale(configuration.getLanguage());
  ComponentOrientation orientation=ComponentOrientation.getOrientation(locale);
  tabbedPane.setComponentOrientation(orientation);
  return tabbedPane;
}

Fixed version (ground truth):
public JComponent buildMain(){
  final JTabbedPane tabbedPane=new JTabbedPane(SwingConstants.TOP);
  tabbedPane.setUI(new CustomTabbedPaneUI());
  st=new StatusTab(configuration);
  tt=new TracesTab(configuration);
  gt=new GeneralTab(configuration);
  pt=new PluginTab(configuration);
  ft=new NavigationShareTab(configuration);
  tr=new TranscodingTab(configuration);
  ht=new HelpTab();
  tabbedPane.addTab(Messages.getString("String_Node_Str"),st.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),tt.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),gt.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),pt.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),ft.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),tr.build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),new HelpTab().build());
  tabbedPane.addTab(Messages.getString("String_Node_Str"),new AboutTab().build());
  tabbedPane.addChangeListener(new ChangeListener(){
    @Override public void stateChanged(    ChangeEvent e){
      int selectedIndex=tabbedPane.getSelectedIndex();
      if (HELP_PAGES[selectedIndex] != null) {
        PMS.setHelpPage(HELP_PAGES[selectedIndex]);
        ht.updateContents();
      }
    }
  }
);
  tabbedPane.setBorder(new EmptyBorder(5,5,5,5));
  Locale locale=new Locale(configuration.getLanguage());
  ComponentOrientation orientation=ComponentOrientation.getOrientation(locale);
  tabbedPane.setComponentOrientation(orientation);
  return tabbedPane;
}
Program: 47274
Project: 47274
Buggy source:
/** 
 * Default constructor. However, this is a singleton class: use  {@link #getInstance()} to retrieve an instance.
 */
private NetworkConfiguration(Enumeration<NetworkInterface> networkInterfaces){
  checkNetworkInterface(networkInterfaces,null);
}

Fixed version (ground truth):
/** 
 * Default constructor. However, this is a singleton class: use  {@link #getInstance()} to retrieve an instance.
 */
private NetworkConfiguration(Enumeration<NetworkInterface> networkInterfaces){
  System.setProperty("String_Node_Str","String_Node_Str");
  checkNetworkInterface(networkInterfaces,null);
}
Program: 47275
Project: 47275
Buggy source:
/** 
 * Gets the new multicast socket.
 * @return the new multicast socket
 * @throws IOException Signals that an I/O exception has occurred.
 */
private static MulticastSocket getNewMulticastSocket() throws IOException {
  MulticastSocket ssdpSocket=new MulticastSocket();
  ssdpSocket.setReuseAddress(true);
  NetworkInterface ni=NetworkConfiguration.getInstance().getNetworkInterfaceByServerName();
  if (ni != null) {
    ssdpSocket.setNetworkInterface(ni);
    Enumeration<InetAddress> enm=ni.getInetAddresses();
    while (enm.hasMoreElements()) {
      InetAddress ia=enm.nextElement();
      if (!(ia instanceof Inet6Address)) {
        ssdpSocket.setInterface(ia);
        break;
      }
    }
  }
 else   if (PMS.get().getServer().getNetworkInterface() != null) {
    LOGGER.trace("String_Node_Str" + PMS.get().getServer().getNetworkInterface());
    ssdpSocket.setNetworkInterface(PMS.get().getServer().getNetworkInterface());
  }
  LOGGER.trace("String_Node_Str" + ssdpSocket.getNetworkInterface());
  LOGGER.trace("String_Node_Str" + ssdpSocket.getInterface());
  ssdpSocket.setTimeToLive(32);
  LOGGER.trace("String_Node_Str" + ssdpSocket.getSoTimeout());
  LOGGER.trace("String_Node_Str" + ssdpSocket.getTimeToLive());
  return ssdpSocket;
}

Fixed version (ground truth):
/** 
 * Gets the new multicast socket.
 * @return the new multicast socket
 * @throws IOException Signals that an I/O exception has occurred.
 */
private static MulticastSocket getNewMulticastSocket() throws IOException {
  NetworkInterface networkInterface=NetworkConfiguration.getInstance().getNetworkInterfaceByServerName();
  if (networkInterface == null) {
    networkInterface=PMS.get().getServer().getNetworkInterface();
  }
  if (networkInterface == null) {
    throw new IOException("String_Node_Str");
  }
  List<InetAddress> usableAddresses=new ArrayList<>();
  List<InetAddress> networkInterfaceAddresses=Collections.list(networkInterface.getInetAddresses());
  for (  InetAddress inetAddress : networkInterfaceAddresses) {
    if (inetAddress != null && inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) {
      usableAddresses.add(inetAddress);
    }
  }
  if (usableAddresses.isEmpty()) {
    throw new IOException("String_Node_Str");
  }
  InetSocketAddress localAddress=new InetSocketAddress(usableAddresses.get(0),0);
  MulticastSocket ssdpSocket=new MulticastSocket(localAddress);
  ssdpSocket.setReuseAddress(true);
  LOGGER.trace("String_Node_Str" + ssdpSocket.getNetworkInterface());
  LOGGER.trace("String_Node_Str" + ssdpSocket.getInterface());
  ssdpSocket.setTimeToLive(32);
  LOGGER.trace("String_Node_Str" + ssdpSocket.getSoTimeout());
  LOGGER.trace("String_Node_Str" + ssdpSocket.getTimeToLive());
  return ssdpSocket;
}
Program: 47278
Project: 47278
Buggy source:
/** 
 * Gets the uPNP address.
 * @return the uPNP address
 * @throws IOException Signals that an I/O exception has occurred.
 */
private static InetAddress getUPNPAddress() throws IOException {
  return InetAddress.getByAddress(IPV4_UPNP_HOST,new byte[]{(byte)239,(byte)255,(byte)255,(byte)250});
}

Fixed version (ground truth):
/** 
 * Gets the uPNP address.
 * @return the uPNP address
 * @throws IOException Signals that an I/O exception has occurred.
 */
private static InetAddress getUPNPAddress() throws IOException {
  return InetAddress.getByName(IPV4_UPNP_HOST);
}
Program: 47280
Project: 47280
Buggy source:
public void transferAll(List<String> list){
  for (  String opt : keySet()) {
    _transfer(opt,list);
  }
}

Fixed version (ground truth):
public void transferAll(List<String> list){
  for (  Object opt : keySet().toArray()) {
    _transfer((String)opt,list);
  }
}
Program: 47285
Project: 47285
Buggy source:
private void refresh(JTable table,String[] cols){
  plugins=DownloadPlugins.downloadList();
  prepareTable(table,cols);
  DefaultTableModel tableModel=(DefaultTableModel)table.getModel();
  tableModel.setRowCount(0);
  for (int i=0; i < plugins.size(); i++) {
    tableModel.insertRow(i,(Object[])null);
    DownloadPlugins p=plugins.get(i);
    table.setValueAt(p.getName(),i,0);
    table.setValueAt(p.getVersion(),i,1);
    table.setValueAt(p.getRating(),i,2);
    table.setValueAt(p.getAuthor(),i,3);
    table.setValueAt(p.getDescription(),i,4);
  }
  tableModel.fireTableDataChanged();
}

Fixed version (ground truth):
private void refresh(JTable table,String[] cols){
  plugins=DownloadPlugins.downloadList();
  prepareTable(table,cols);
  DefaultTableModel tableModel=(DefaultTableModel)table.getModel();
  tableModel.setRowCount(1);
  for (int i=0; i < plugins.size(); i++) {
    tableModel.insertRow(i + 1,(Object[])null);
    DownloadPlugins p=plugins.get(i);
    table.setValueAt(p.getName(),i + 1,0);
    table.setValueAt(p.getVersion(),i + 1,1);
    table.setValueAt(p.getRating(),i + 1,2);
    table.setValueAt(p.getAuthor(),i + 1,3);
    table.setValueAt(p.getDescription(),i + 1,4);
  }
  tableModel.fireTableDataChanged();
}
Program: 47287
Project: 47287
Buggy source:
@Override public String getToolTipText(MouseEvent e){
  java.awt.Point p=e.getPoint();
  int rowIndex=rowAtPoint(p);
  if (rowIndex == 0) {
    return null;
  }
  DownloadPlugins plugin=plugins.get(rowIndex);
  return plugin.htmlString();
}

Fixed version (ground truth):
@Override public String getToolTipText(MouseEvent e){
  java.awt.Point p=e.getPoint();
  int rowIndex=rowAtPoint(p);
  if (rowIndex == 0) {
    return null;
  }
  DownloadPlugins plugin=plugins.get(rowIndex - 1);
  return plugin.htmlString();
}
Program: 47289
Project: 47289
Buggy source:
private void refresh(JTable table,String[] cols){
  for (int i=0; i < cols.length; i++) {
    table.setValueAt(cols[i],0,i);
  }
  DefaultTableModel tableModel=(DefaultTableModel)table.getModel();
  tableModel.setRowCount(1);
  TableColumn tcol=table.getColumnModel().getColumn(3);
  tcol.setCellRenderer(new PasswordCellRenderer());
  Iterator itr=cred.getKeys();
  int i=1;
  while (itr.hasNext()) {
    String key=(String)itr.next();
    String val=(String)cred.getProperty(key);
    String[] ownerTag=key.split("String_Node_Str",2);
    String[] usrPwd=val.split("String_Node_Str",2);
    tableModel.insertRow(i,(Object[])null);
    table.setValueAt(ownerTag[0],i,0);
    if (ownerTag.length > 1) {
      table.setValueAt(ownerTag[1],i,1);
    }
    if (usrPwd.length > 0) {
      table.setValueAt(usrPwd[0],i,2);
    }
    if (usrPwd.length > 1) {
      table.setValueAt(usrPwd[1],i,3);
    }
    i++;
  }
  tableModel.fireTableDataChanged();
}

Fixed version (ground truth):
private void refresh(JTable table,String[] cols){
  for (int i=0; i < cols.length; i++) {
    table.setValueAt(cols[i],0,i);
  }
  cred.reload();
  DefaultTableModel tableModel=(DefaultTableModel)table.getModel();
  tableModel.setRowCount(1);
  TableColumn tcol=table.getColumnModel().getColumn(3);
  tcol.setCellRenderer(new PasswordCellRenderer());
  Iterator itr=cred.getKeys();
  int i=1;
  while (itr.hasNext()) {
    String key=(String)itr.next();
    Object val=cred.getProperty(key);
    String[] ownerTag=key.split("String_Node_Str",2);
    ArrayList<String> usrPwd=null;
    if (val instanceof String) {
      usrPwd=new ArrayList<String>();
      usrPwd.add((String)val);
    }
 else     if (val instanceof List<?>) {
      usrPwd=(ArrayList<String>)val;
    }
    if (usrPwd == null) {
      continue;
    }
    for (    String val1 : usrPwd) {
      tableModel.insertRow(i,(Object[])null);
      table.setValueAt(ownerTag[0],i,0);
      if (ownerTag.length > 1) {
        table.setValueAt(ownerTag[1],i,1);
      }
      String[] tmp=val1.split("String_Node_Str",2);
      if (tmp.length > 0) {
        table.setValueAt(tmp[0],i,2);
      }
      if (tmp.length > 1) {
        table.setValueAt(tmp[1],i,3);
      }
    }
    i++;
  }
  tableModel.fireTableDataChanged();
}
Program: 47295
Project: 47295
Buggy source:
/** 
 * Returns the first   {@link Player} that matches the given mediaInfo orformat. Each of the available players is passed the provided information and the first that reports it is compatible will be returned.
 * @param resource The  {@link DLNAMediaResource} to match
 * @return The player if a match could be found, <code>null</code>otherwise.
 * @since 1.60.0
 */
public static Player getPlayer(final DLNAResource resource){
  if (resource == null) {
    return null;
  }
  for (  Player player : players) {
    if (player.isCompatible(resource)) {
      LOGGER.trace("String_Node_Str" + player.name() + "String_Node_Str");
      return player;
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the first   {@link Player} that matches the given mediaInfo orformat. Each of the available players is passed the provided information and the first that reports it is compatible will be returned.
 * @param resource The  {@link DLNAMediaResource} to match
 * @return The player if a match could be found, <code>null</code>otherwise.
 * @since 1.60.0
 */
public static Player getPlayer(final DLNAResource resource){
  if (resource == null) {
    return null;
  }
  List<String> enabledEngines=PMS.getConfiguration().getEnginesAsList(PMS.get().getRegistry());
  for (  Player player : players) {
    if (enabledEngines.contains(player.id()) && player.isCompatible(resource)) {
      LOGGER.trace("String_Node_Str" + player.name() + "String_Node_Str"+ resource.getName());
      return player;
    }
  }
  return null;
}
Program: 47296
Project: 47296
Buggy source:
/** 
 * Returns all   {@link Player}s that match the given resource and are enabled. Each of the available players is passed the provided information and each player that reports it is compatible will be returned.
 * @param resource The  {@link DLNAResource} to match
 * @return The player if a match could be found, <code>null</code>otherwise.
 * @since 1.70.0
 */
public static ArrayList<Player> getEnabledPlayers(final DLNAResource resource){
  if (resource == null) {
    return null;
  }
  List<String> enabledEngines=PMS.getConfiguration().getEnginesAsList(PMS.get().getRegistry());
  ArrayList<Player> enabledPlayers=new ArrayList<Player>();
  for (  Player player : getPlayers(resource)) {
    if (enabledEngines.contains(player.id())) {
      enabledPlayers.add(player);
    }
  }
  return enabledPlayers;
}

Fixed version (ground truth):
/** 
 * @deprecated Use {@link #getPlayers(DLNAResource)} instead.
 * @param resource The resource to match
 * @return The list of players if a match could be found, null otherwise.
 */
@Deprecated public static ArrayList<Player> getEnabledPlayers(final DLNAResource resource){
  return getPlayers(resource);
}
Program: 47297
Project: 47297
Buggy source:
/** 
 * Returns all   {@link Player}s that match the given resource. Each of the available players is passed the provided information and each player that reports it is compatible will be returned.
 * @param resource The  {@link DLNAResource} to match
 * @return The player if a match could be found, <code>null</code>otherwise.
 * @since 1.60.0
 */
public static ArrayList<Player> getPlayers(final DLNAResource resource){
  if (resource == null) {
    return null;
  }
  ArrayList<Player> compatiblePlayers=new ArrayList<Player>();
  for (  Player player : players) {
    if (player.isCompatible(resource)) {
      compatiblePlayers.add(player);
    }
  }
  return compatiblePlayers;
}

Fixed version (ground truth):
/** 
 * Returns all   {@link Player}s that match the given resource and are enabled. Each of the available players is passed the provided information and each player that reports it is compatible will be returned.
 * @param resource The  {@link DLNAResource} to match
 * @return The list of compatible players if a match could be found,<code>null</code> otherwise.
 * @since 1.60.0
 */
public static ArrayList<Player> getPlayers(final DLNAResource resource){
  if (resource == null) {
    return null;
  }
  List<String> enabledEngines=PMS.getConfiguration().getEnginesAsList(PMS.get().getRegistry());
  ArrayList<Player> compatiblePlayers=new ArrayList<Player>();
  for (  Player player : players) {
    if (enabledEngines.contains(player.id()) && player.isCompatible(resource)) {
      LOGGER.trace("String_Node_Str" + player.name() + "String_Node_Str"+ resource.getName());
      compatiblePlayers.add(player);
    }
  }
  return compatiblePlayers;
}
Program: 47299
Project: 47299
Buggy source:
public SevenZipFile(File file){
  file=file;
  setLastModified(file.lastModified());
  try {
    RandomAccessFile rf=new RandomAccessFile(file,"String_Node_Str");
    arc=SevenZip.openInArchive(null,(IInStream)new RandomAccessFileInStream(rf));
    ISimpleInArchive simpleInArchive=arc.getSimpleInterface();
    for (    ISimpleInArchiveItem item : simpleInArchive.getArchiveItems()) {
      LOGGER.debug("String_Node_Str" + item.getPath() + "String_Node_Str"+ file.getAbsolutePath());
      if (item.isFolder()) {
        continue;
      }
      addChild(new SevenZipEntry(file,item.getPath(),item.getSize()));
    }
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
catch (  SevenZipException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public SevenZipFile(File f){
  file=f;
  setLastModified(file.lastModified());
  try {
    RandomAccessFile rf=new RandomAccessFile(f,"String_Node_Str");
    arc=SevenZip.openInArchive(null,(IInStream)new RandomAccessFileInStream(rf));
    ISimpleInArchive simpleInArchive=arc.getSimpleInterface();
    for (    ISimpleInArchiveItem item : simpleInArchive.getArchiveItems()) {
      LOGGER.debug("String_Node_Str" + item.getPath() + "String_Node_Str"+ file.getAbsolutePath());
      if (item.isFolder()) {
        continue;
      }
      addChild(new SevenZipEntry(f,item.getPath(),item.getSize()));
    }
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
catch (  SevenZipException e) {
    LOGGER.error("String_Node_Str",e);
  }
}
Program: 47300
Project: 47300
Buggy source:
public static void loadJARs(URL[] jarURLs,boolean download){
  ArrayList<URL> libs=new ArrayList<URL>();
  for (int i=0; i < jarURLs.length; i++) {
    if (isLib(jarURLs[i])) {
      libs.add(jarURLs[i]);
    }
  }
  URL[] jarURLs1=new URL[libs.size() + 1];
  libs.toArray(jarURLs1);
  int pos=libs.size();
  for (int i=0; i < jarURLs.length; i++) {
    jarURLs1[pos]=jarURLs[i];
    loadJAR(jarURLs1,download);
  }
}

Fixed version (ground truth):
public static void loadJARs(URL[] jarURLs,boolean download){
  ArrayList<URL> libs=new ArrayList<URL>();
  for (int i=0; i < jarURLs.length; i++) {
    if (isLib(jarURLs[i])) {
      libs.add(jarURLs[i]);
    }
  }
  URL[] jarURLs1=new URL[libs.size() + 1];
  libs.toArray(jarURLs1);
  int pos=libs.size();
  for (int i=0; i < jarURLs.length; i++) {
    jarURLs1[pos]=jarURLs[i];
    loadJAR(jarURLs1,download,jarURLs[i]);
  }
}
Program: 47301
Project: 47301
Buggy source:
/** 
 * This method loads the jar files found in the plugin dir or if installed from the web.
 */
public static void loadJAR(URL[] jarURL,boolean download){
  URLClassLoader classLoader=new URLClassLoader(jarURL);
  Enumeration<URL> resources;
  try {
    resources=classLoader.getResources("String_Node_Str");
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
    return;
  }
  while (resources.hasMoreElements()) {
    URL url=resources.nextElement();
    try {
      InputStreamReader in=new InputStreamReader(url.openStream());
      char[] name=new char[512];
      in.read(name);
      in.close();
      String pluginMainClassName=new String(name).trim();
      LOGGER.info("String_Node_Str" + pluginMainClassName);
      if (download) {
        purgeCode(pluginMainClassName,url);
      }
      Class<?> clazz=classLoader.loadClass(pluginMainClassName);
      registerListenerClass(clazz);
      if (download) {
        downloadedListenerClasses.add(clazz);
      }
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
catch (    NoClassDefFoundError e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * This method loads the jar files found in the plugin dir or if installed from the web.
 */
public static void loadJAR(URL[] jarURL,boolean download,URL newURL){
  URLClassLoader classLoader=new URLClassLoader(jarURL);
  Enumeration<URL> resources;
  try {
    resources=classLoader.getResources("String_Node_Str");
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
    return;
  }
  while (resources.hasMoreElements()) {
    URL url=resources.nextElement();
    try {
      InputStreamReader in=new InputStreamReader(url.openStream());
      char[] name=new char[512];
      in.read(name);
      in.close();
      String pluginMainClassName=new String(name).trim();
      LOGGER.info("String_Node_Str" + pluginMainClassName);
      if (download) {
        purgeCode(pluginMainClassName,newURL);
      }
      Class<?> clazz=classLoader.loadClass(pluginMainClassName);
      registerListenerClass(clazz);
      if (download) {
        downloadedListenerClasses.add(clazz);
      }
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
catch (    NoClassDefFoundError e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
}
Program: 47302
Project: 47302
Buggy source:
private static boolean isLib(URL jar){
  URL[] jarURLs1={jar};
  URLClassLoader classLoader=new URLClassLoader(jarURLs1);
  Enumeration<URL> resources;
  try {
    resources=classLoader.getResources("String_Node_Str");
    return !resources.hasMoreElements();
  }
 catch (  IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
  return false;
}

Fixed version (ground truth):
private static boolean isLib(URL jar){
  return (getMainClass(jar) == null);
}
Program: 47303
Project: 47303
Buggy source:
private static void purgeCode(String mainClass,URL newUrl){
  Class<?> clazz1=null;
  for (  Class<?> clazz : externalListenerClasses) {
    if (mainClass.equals(clazz.getCanonicalName())) {
      clazz1=clazz;
      break;
    }
  }
  if (clazz1 == null) {
    return;
  }
  externalListenerClasses.remove(clazz1);
  ExternalListener remove=null;
  for (  ExternalListener list : externalListeners) {
    if (list.getClass().equals(clazz1)) {
      remove=list;
      break;
    }
  }
  ArrayList<RendererConfiguration> renders=RendererConfiguration.getAllRendererConfigurations();
  for (  RendererConfiguration r : renders) {
    RootFolder rf=r.getRootFolder();
    rf.reset();
  }
  if (remove != null) {
    externalListeners.remove(remove);
    remove.shutdown();
    LooksFrame frame=(LooksFrame)PMS.get().getFrame();
    frame.getGt().removePlugin(remove);
  }
  for (int i=0; i < 3; i++) {
    System.gc();
  }
  URLClassLoader cl=(URLClassLoader)clazz1.getClassLoader();
  URL[] urls=cl.getURLs();
  for (int i=0; i < urls.length; i++) {
    URL url=urls[i];
    if (isLib(url)) {
      continue;
    }
    File f=url2file(url);
    File f1=url2file(newUrl);
    if (f1 == null || f == null) {
      continue;
    }
    if (!f1.getName().equals(f.getName())) {
      addToPurgeFile(f);
    }
  }
}

Fixed version (ground truth):
private static void purgeCode(String mainClass,URL newUrl){
  Class<?> clazz1=null;
  for (  Class<?> clazz : externalListenerClasses) {
    if (mainClass.equals(clazz.getCanonicalName())) {
      clazz1=clazz;
      break;
    }
  }
  if (clazz1 == null) {
    return;
  }
  externalListenerClasses.remove(clazz1);
  ExternalListener remove=null;
  for (  ExternalListener list : externalListeners) {
    if (list.getClass().equals(clazz1)) {
      remove=list;
      break;
    }
  }
  ArrayList<RendererConfiguration> renders=RendererConfiguration.getAllRendererConfigurations();
  for (  RendererConfiguration r : renders) {
    RootFolder rf=r.getRootFolder();
    rf.reset();
  }
  if (remove != null) {
    externalListeners.remove(remove);
    remove.shutdown();
    LooksFrame frame=(LooksFrame)PMS.get().getFrame();
    frame.getGt().removePlugin(remove);
  }
  for (int i=0; i < 3; i++) {
    System.gc();
  }
  URLClassLoader cl=(URLClassLoader)clazz1.getClassLoader();
  URL[] urls=cl.getURLs();
  for (int i=0; i < urls.length; i++) {
    URL url=urls[i];
    String mainClass1=getMainClass(url);
    if (mainClass1 == null || !mainClass.equals(mainClass1)) {
      continue;
    }
    File f=url2file(url);
    File f1=url2file(newUrl);
    if (f1 == null || f == null) {
      continue;
    }
    if (!f1.getName().equals(f.getName())) {
      addToPurgeFile(f);
    }
  }
}
Program: 47304
Project: 47304
Buggy source:
private static void addToPurgeFile(File f){
  File purge=new File("String_Node_Str");
  try {
    FileOutputStream fos=new FileOutputStream(purge);
    fos.write(f.getAbsolutePath().getBytes(),0,f.getAbsolutePath().length());
    fos.flush();
    fos.close();
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
private static void addToPurgeFile(File f){
  try {
    FileWriter out=new FileWriter("String_Node_Str",true);
    out.write(f.getAbsolutePath() + "String_Node_Str");
    out.flush();
    out.close();
  }
 catch (  Exception e) {
    LOGGER.debug("String_Node_Str" + e);
  }
}