Program: 167832
Project: 167832
Buggy source:
public synchronized void persistProperties() throws IOException {
  Properties toSave=(Properties)properties.clone();
  File backup=new File(propertiesFile.getCanonicalPath() + "String_Node_Str");
  if (backup.exists()) {
    if (backup.delete() == false) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  if (propertiesFile.renameTo(backup) == false) {
    throw new IllegalStateException("String_Node_Str");
  }
  FileReader fr=new FileReader(backup);
  BufferedReader br=new BufferedReader(fr);
  BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propertiesFile),"String_Node_Str"));
  try {
    String line;
    while ((line=br.readLine()) != null) {
      String trimmed=line.trim();
      if (trimmed.startsWith("String_Node_Str")) {
        bw.append(line);
        bw.newLine();
      }
 else       if (trimmed.length() == 0) {
        bw.newLine();
      }
 else {
        int equals=trimmed.indexOf('=');
        if (equals > 0) {
          String userName=trimmed.substring(0,equals);
          if (toSave.containsKey(userName)) {
            String escapedUserName=escapeString(userName,ESCAPE_ARRAY);
            bw.append(escapedUserName + "String_Node_Str" + toSave.getProperty(userName));
            bw.newLine();
            toSave.remove(userName);
          }
        }
      }
    }
    for (    Object currentKey : toSave.keySet()) {
      String escapedUserName=escapeString((String)currentKey,ESCAPE_ARRAY);
      bw.append(escapedUserName + "String_Node_Str" + toSave.getProperty((String)currentKey));
      bw.newLine();
    }
    bw.newLine();
  }
  finally {
    safeClose(bw);
    safeClose(br);
    safeClose(fr);
  }
}

Fixed version (ground truth):
public synchronized void persistProperties() throws IOException {
  Properties toSave=(Properties)properties.clone();
  File backup=new File(propertiesFile.getCanonicalPath() + "String_Node_Str");
  if (backup.exists()) {
    if (backup.delete() == false) {
      throw new IllegalStateException("String_Node_Str");
    }
  }
  if (propertiesFile.renameTo(backup) == false) {
    throw new IllegalStateException("String_Node_Str");
  }
  FileReader fr=new FileReader(backup);
  BufferedReader br=new BufferedReader(fr);
  BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(propertiesFile),"String_Node_Str"));
  try {
    String line;
    while ((line=br.readLine()) != null) {
      String trimmed=line.trim();
      if (trimmed.startsWith("String_Node_Str")) {
        bw.append(line);
        bw.newLine();
      }
 else       if (trimmed.length() == 0) {
        bw.newLine();
      }
 else {
        int equals=trimmed.indexOf('=');
        if (equals > 0) {
          String userName=trimmed.substring(0,equals);
          if (toSave.containsKey(userName)) {
            String escapedUserName=escapeString(userName,ESCAPE_ARRAY);
            bw.append(escapedUserName + "String_Node_Str" + toSave.getProperty(userName));
            bw.newLine();
            toSave.remove(userName);
          }
        }
      }
    }
    for (    Object currentKey : toSave.keySet()) {
      String escapedUserName=escapeString((String)currentKey,ESCAPE_ARRAY);
      bw.append(escapedUserName + "String_Node_Str" + toSave.getProperty((String)currentKey));
      bw.newLine();
    }
  }
  finally {
    safeClose(bw);
    safeClose(br);
    safeClose(fr);
  }
}