Program: 149328
Project: 149328
Buggy source:
private void extractIcon(ApkInfo apkInfo,File file,File workingFolder,String output) throws Exception {
  Pattern patn=Pattern.compile("String_Node_Str" + FIELD_PATTERN + "String_Node_Str");
  Matcher match=patn.matcher(output);
  if (match.find()) {
    apkInfo.addIcon(match.group(1).trim());
  }
  patn=Pattern.compile("String_Node_Str" + FIELD_PATTERN + "String_Node_Str"+ FIELD_PATTERN+ "String_Node_Str");
  match=patn.matcher(output);
  while (match.find()) {
    apkInfo.addIcon(match.group(2).trim());
  }
  for (  String icon : apkInfo.getIcons()) {
    UnZip.extractRes(file,icon);
  }
  int maxWidth=0;
  File tempDir=new File(GlobalUtil.getTempWorkingPath());
  for (  File iconFile : tempDir.listFiles()) {
    BufferedImage bimg=ImageIO.read(iconFile);
    int width=bimg.getWidth();
    if (width == Constancts.PREFER_ICON_DIMS) {
      apkInfo.setIcon(iconFile.getPath());
      maxWidth=width;
      break;
    }
    if (width > maxWidth) {
      apkInfo.setIcon(iconFile.getPath());
      maxWidth=width;
    }
  }
  File iconFile=new File(apkInfo.getIcon());
  File targetFile=new File(workingFolder,String.format("String_Node_Str",apkInfo.getId()));
  if (maxWidth == Constancts.PREFER_ICON_DIMS) {
    iconFile.renameTo(targetFile);
  }
 else {
    Image newImage=ImageIO.read(iconFile).getScaledInstance(Constancts.PREFER_ICON_DIMS,Constancts.PREFER_ICON_DIMS,Image.SCALE_SMOOTH);
    BufferedImage newIconBufImg=new BufferedImage(Constancts.PREFER_ICON_DIMS,Constancts.PREFER_ICON_DIMS,BufferedImage.TYPE_INT_ARGB);
    newIconBufImg.getGraphics().drawImage(newImage,0,0,null);
    ImageIO.write(newIconBufImg,"String_Node_Str",new FileOutputStream(targetFile));
  }
  apkInfo.setIcon(targetFile.getPath());
  GlobalUtil.deleteDirectory(tempDir);
}

Fixed version (ground truth):
private void extractIcon(ApkInfo apkInfo,File file,File workingFolder,String output) throws Exception {
  Pattern patn=Pattern.compile("String_Node_Str" + FIELD_PATTERN + "String_Node_Str");
  Matcher match=patn.matcher(output);
  if (match.find()) {
    apkInfo.addIcon(match.group(1).trim());
  }
  patn=Pattern.compile("String_Node_Str" + FIELD_PATTERN + "String_Node_Str"+ FIELD_PATTERN+ "String_Node_Str");
  match=patn.matcher(output);
  while (match.find()) {
    apkInfo.addIcon(match.group(2).trim());
  }
  for (  String icon : apkInfo.getIcons()) {
    UnZip.extractRes(file,icon);
  }
  int maxWidth=0;
  File tempDir=new File(GlobalUtil.getTempWorkingPath());
  for (  File iconFile : tempDir.listFiles()) {
    BufferedImage bimg=ImageIO.read(iconFile);
    int width=bimg.getWidth();
    if (width == Constancts.PREFER_ICON_DIMS) {
      apkInfo.setIcon(iconFile.getPath());
      maxWidth=width;
      break;
    }
    if (width > maxWidth) {
      apkInfo.setIcon(iconFile.getPath());
      maxWidth=width;
    }
  }
  File iconFile=new File(apkInfo.getIcon());
  File targetFile=new File(workingFolder,String.format("String_Node_Str",apkInfo.getId()));
  if (maxWidth == Constancts.PREFER_ICON_DIMS) {
    iconFile.renameTo(targetFile);
  }
 else {
    Image newImage=ImageIO.read(iconFile).getScaledInstance(Constancts.PREFER_ICON_DIMS,Constancts.PREFER_ICON_DIMS,Image.SCALE_SMOOTH);
    BufferedImage newIconBufImg=new BufferedImage(Constancts.PREFER_ICON_DIMS,Constancts.PREFER_ICON_DIMS,BufferedImage.TYPE_INT_ARGB);
    newIconBufImg.getGraphics().drawImage(newImage,0,0,null);
    ImageIO.write(newIconBufImg,"String_Node_Str",new FileOutputStream(targetFile));
  }
  apkInfo.setIcon(targetFile.getPath());
  GlobalUtil.deleteDirectory(tempDir);
  apkInfo.clearIcons();
}