Program: 127707
Project: 127707
Buggy source:
private void exportSysconfig(File dest){
  MemoryMXBean memoryMXBean=ManagementFactory.getMemoryMXBean();
  MemoryUsage memoryUsage=memoryMXBean.getHeapMemoryUsage();
  MemoryUsage memoryNoHeapUsage=memoryMXBean.getNonHeapMemoryUsage();
  long used=memoryUsage.getUsed() / (1024 * 1024);
  String usedMemo=String.valueOf(used) + "String_Node_Str";
  long max=memoryUsage.getMax() / (1024 * 1024);
  String maxMemo=String.valueOf(max) + "String_Node_Str";
  long committed=memoryUsage.getCommitted() / (1024 * 1024);
  String committedMemo=String.valueOf(committed) + "String_Node_Str";
  long noHeapUsed=memoryNoHeapUsage.getUsed() / (1024 * 1024);
  String noHeapUsedMemo=String.valueOf(noHeapUsed) + "String_Node_Str";
  long noHeapMaxUnUsed=memoryNoHeapUsage.getMax() / (1024 * 1024);
  String noHeapMaxUnUsedMemo=String.valueOf(noHeapMaxUnUsed) + "String_Node_Str";
  long noHeapCommitted=memoryNoHeapUsage.getCommitted() / (1024 * 1024);
  String noHeapCommittedMemo=String.valueOf(noHeapCommitted) + "String_Node_Str";
  OperatingSystemMXBean osmxb=(OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
  long totalPhysicalMemo=osmxb.getTotalPhysicalMemorySize() / (1024 * 1024);
  String totalPhysicalMemorySize=String.valueOf(totalPhysicalMemo) + "String_Node_Str";
  long freePhysicalMemo=osmxb.getFreePhysicalMemorySize() / (1024 * 1024);
  String freePhysicalMemorySize=String.valueOf(freePhysicalMemo) + "String_Node_Str";
  ThreadGroup parentThread;
  for (parentThread=Thread.currentThread().getThreadGroup(); parentThread.getParent() != null; parentThread=parentThread.getParent())   ;
  int totalThread=parentThread.activeCount();
  String totalThreadCount=String.valueOf(totalThread);
  String osName=System.getProperty("String_Node_Str");
  int cpuRatio=0;
  if (osName.toLowerCase().startsWith("String_Node_Str")) {
    cpuRatio=(int)this.getCpuRatioForWindows();
  }
  String cpuUsed=String.valueOf(cpuRatio) + "String_Node_Str";
  StringBuffer sb=new StringBuffer();
  Properties p=new Properties();
  p.putAll(System.getProperties());
  sb.append("String_Node_Str");
  for (  Entry<Object,Object> en : p.entrySet()) {
    sb.append(en.getKey() + "String_Node_Str" + en.getValue()+ "String_Node_Str");
  }
  p.clear();
  p.put("String_Node_Str",cpuUsed);
  p.put("String_Node_Str",totalThreadCount);
  p.put("String_Node_Str",totalPhysicalMemorySize);
  p.put("String_Node_Str",freePhysicalMemorySize);
  p.put("String_Node_Str",usedMemo);
  p.put("String_Node_Str",maxMemo);
  p.put("String_Node_Str",committedMemo);
  p.put("String_Node_Str",noHeapUsedMemo);
  p.put("String_Node_Str",noHeapMaxUnUsedMemo);
  p.put("String_Node_Str",noHeapCommittedMemo);
  sb.append("String_Node_Str");
  for (  Entry<Object,Object> en : p.entrySet()) {
    sb.append(en.getKey() + "String_Node_Str" + en.getValue()+ "String_Node_Str");
  }
  String zipFile=dest.getAbsolutePath();
  String tmpFolder=JavaJobExportReArchieveCreator.getTmpFolder();
  String destFile=new File(tmpFolder + File.separator + new File("String_Node_Str")).getAbsolutePath();
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(destFile);
    out.write(sb.toString().getBytes());
    out.flush();
    if (!addLogsButton.getSelection()) {
      ZipToFile.zipFile(tmpFolder,zipFile);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (out != null)       out.close();
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
private void exportSysconfig(File dest){
  MemoryMXBean memoryMXBean=ManagementFactory.getMemoryMXBean();
  MemoryUsage memoryUsage=memoryMXBean.getHeapMemoryUsage();
  MemoryUsage memoryNoHeapUsage=memoryMXBean.getNonHeapMemoryUsage();
  long used=memoryUsage.getUsed() / (1024 * 1024);
  String usedMemo=String.valueOf(used) + "String_Node_Str";
  long max=memoryUsage.getMax() / (1024 * 1024);
  String maxMemo=String.valueOf(max) + "String_Node_Str";
  long committed=memoryUsage.getCommitted() / (1024 * 1024);
  String committedMemo=String.valueOf(committed) + "String_Node_Str";
  long noHeapUsed=memoryNoHeapUsage.getUsed() / (1024 * 1024);
  String noHeapUsedMemo=String.valueOf(noHeapUsed) + "String_Node_Str";
  long noHeapMaxUnUsed=memoryNoHeapUsage.getMax() / (1024 * 1024);
  String noHeapMaxUnUsedMemo=String.valueOf(noHeapMaxUnUsed) + "String_Node_Str";
  long noHeapCommitted=memoryNoHeapUsage.getCommitted() / (1024 * 1024);
  String noHeapCommittedMemo=String.valueOf(noHeapCommitted) + "String_Node_Str";
  OperatingSystemMXBean osmxb=(OperatingSystemMXBean)ManagementFactory.getOperatingSystemMXBean();
  long totalPhysicalMemo=osmxb.getTotalPhysicalMemorySize() / (1024 * 1024);
  String totalPhysicalMemorySize=String.valueOf(totalPhysicalMemo) + "String_Node_Str";
  long freePhysicalMemo=osmxb.getFreePhysicalMemorySize() / (1024 * 1024);
  String freePhysicalMemorySize=String.valueOf(freePhysicalMemo) + "String_Node_Str";
  ThreadGroup parentThread;
  for (parentThread=Thread.currentThread().getThreadGroup(); parentThread.getParent() != null; parentThread=parentThread.getParent()) {
    ;
  }
  int totalThread=parentThread.activeCount();
  String totalThreadCount=String.valueOf(totalThread);
  String osName=System.getProperty("String_Node_Str");
  int cpuRatio=0;
  if (osName.toLowerCase().startsWith("String_Node_Str")) {
    cpuRatio=(int)this.getCpuRatioForWindows();
  }
  String cpuUsed=String.valueOf(cpuRatio) + "String_Node_Str";
  StringBuffer sb=new StringBuffer();
  Properties p=new Properties();
  p.putAll(System.getProperties());
  sb.append("String_Node_Str");
  for (  Entry<Object,Object> en : p.entrySet()) {
    sb.append(en.getKey() + "String_Node_Str" + en.getValue()+ "String_Node_Str");
  }
  p.clear();
  p.put("String_Node_Str",cpuUsed);
  p.put("String_Node_Str",totalThreadCount);
  p.put("String_Node_Str",totalPhysicalMemorySize);
  p.put("String_Node_Str",freePhysicalMemorySize);
  p.put("String_Node_Str",usedMemo);
  p.put("String_Node_Str",maxMemo);
  p.put("String_Node_Str",committedMemo);
  p.put("String_Node_Str",noHeapUsedMemo);
  p.put("String_Node_Str",noHeapMaxUnUsedMemo);
  p.put("String_Node_Str",noHeapCommittedMemo);
  sb.append("String_Node_Str");
  for (  Entry<Object,Object> en : p.entrySet()) {
    sb.append(en.getKey() + "String_Node_Str" + en.getValue()+ "String_Node_Str");
  }
  String zipFile=dest.getAbsolutePath();
  String tmpFolder=JavaJobExportReArchieveCreator.getTmpFolder();
  String destFile=new File(tmpFolder + File.separator + new File("String_Node_Str")).getAbsolutePath();
  FileOutputStream out=null;
  try {
    out=new FileOutputStream(destFile);
    out.write(sb.toString().getBytes());
    out.flush();
    if (!addLogsButton.getSelection()) {
      ZipToFile.zipFile(tmpFolder,zipFile);
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
 finally {
    try {
      if (out != null) {
        out.close();
      }
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
}