Program: 152259
Project: 152259
Buggy source:
/** 
 * Save user. If new insert a new row, else update the existing row.
 */
public void save(User user) throws FtpException {
  if (user.getName() == null) {
    throw new NullPointerException("String_Node_Str");
  }
  Statement stmt=null;
  try {
    HashMap<String,Object> map=new HashMap<String,Object>();
    map.put(ATTR_LOGIN,escapeString(user.getName()));
    String password=null;
    if (user.getPassword() != null) {
      password=getPasswordEncryptor().encrypt(user.getPassword());
    }
 else {
      ResultSet rs=null;
      try {
        rs=selectUserByName(user.getName());
        if (rs.next()) {
          password=rs.getString(ATTR_PASSWORD);
        }
      }
  finally {
        closeQuitely(rs);
      }
    }
    map.put(ATTR_PASSWORD,escapeString(password));
    String home=user.getHomeDirectory();
    if (home == null) {
      home="String_Node_Str";
    }
    map.put(ATTR_HOME,escapeString(home));
    map.put(ATTR_ENABLE,String.valueOf(user.getEnabled()));
    map.put(ATTR_WRITE_PERM,String.valueOf(user.authorize(new WriteRequest()) != null));
    map.put(ATTR_MAX_IDLE_TIME,user.getMaxIdleTime());
    TransferRateRequest transferRateRequest=new TransferRateRequest();
    transferRateRequest=(TransferRateRequest)user.authorize(transferRateRequest);
    if (transferRateRequest != null) {
      map.put(ATTR_MAX_UPLOAD_RATE,transferRateRequest.getMaxUploadRate());
      map.put(ATTR_MAX_DOWNLOAD_RATE,transferRateRequest.getMaxDownloadRate());
    }
 else {
      map.put(ATTR_MAX_UPLOAD_RATE,0);
      map.put(ATTR_MAX_DOWNLOAD_RATE,0);
    }
    ConcurrentLoginRequest concurrentLoginRequest=new ConcurrentLoginRequest(0,0);
    concurrentLoginRequest=(ConcurrentLoginRequest)user.authorize(concurrentLoginRequest);
    if (concurrentLoginRequest != null) {
      map.put(ATTR_MAX_LOGIN_NUMBER,concurrentLoginRequest.getMaxConcurrentLogins());
      map.put(ATTR_MAX_LOGIN_PER_IP,concurrentLoginRequest.getMaxConcurrentLoginsPerIP());
    }
 else {
      map.put(ATTR_MAX_LOGIN_NUMBER,0);
      map.put(ATTR_MAX_LOGIN_PER_IP,0);
    }
    String sql=null;
    if (!doesExist(user.getName())) {
      sql=StringUtils.replaceString(insertUserStmt,map);
    }
 else {
      sql=StringUtils.replaceString(updateUserStmt,map);
    }
    LOG.info(sql);
    stmt=createConnection().createStatement();
    stmt.executeUpdate(sql);
  }
 catch (  SQLException ex) {
    LOG.error("String_Node_Str",ex);
    throw new FtpException("String_Node_Str",ex);
  }
 finally {
    closeQuitely(stmt);
  }
}

Fixed version (ground truth):
/** 
 * Save user. If new insert a new row, else update the existing row.
 */
public void save(User user) throws FtpException {
  if (user.getName() == null) {
    throw new NullPointerException("String_Node_Str");
  }
  Statement stmt=null;
  try {
    HashMap<String,Object> map=new HashMap<String,Object>();
    map.put(ATTR_LOGIN,escapeString(user.getName()));
    String password=null;
    if (user.getPassword() != null) {
      password=getPasswordEncryptor().encrypt(user.getPassword());
    }
 else {
      ResultSet rs=null;
      try {
        User userWithPassword=selectUserByName(user.getName());
        if (userWithPassword != null) {
          password=userWithPassword.getPassword();
        }
      }
  finally {
        closeQuitely(rs);
      }
    }
    map.put(ATTR_PASSWORD,escapeString(password));
    String home=user.getHomeDirectory();
    if (home == null) {
      home="String_Node_Str";
    }
    map.put(ATTR_HOME,escapeString(home));
    map.put(ATTR_ENABLE,String.valueOf(user.getEnabled()));
    map.put(ATTR_WRITE_PERM,String.valueOf(user.authorize(new WriteRequest()) != null));
    map.put(ATTR_MAX_IDLE_TIME,user.getMaxIdleTime());
    TransferRateRequest transferRateRequest=new TransferRateRequest();
    transferRateRequest=(TransferRateRequest)user.authorize(transferRateRequest);
    if (transferRateRequest != null) {
      map.put(ATTR_MAX_UPLOAD_RATE,transferRateRequest.getMaxUploadRate());
      map.put(ATTR_MAX_DOWNLOAD_RATE,transferRateRequest.getMaxDownloadRate());
    }
 else {
      map.put(ATTR_MAX_UPLOAD_RATE,0);
      map.put(ATTR_MAX_DOWNLOAD_RATE,0);
    }
    ConcurrentLoginRequest concurrentLoginRequest=new ConcurrentLoginRequest(0,0);
    concurrentLoginRequest=(ConcurrentLoginRequest)user.authorize(concurrentLoginRequest);
    if (concurrentLoginRequest != null) {
      map.put(ATTR_MAX_LOGIN_NUMBER,concurrentLoginRequest.getMaxConcurrentLogins());
      map.put(ATTR_MAX_LOGIN_PER_IP,concurrentLoginRequest.getMaxConcurrentLoginsPerIP());
    }
 else {
      map.put(ATTR_MAX_LOGIN_NUMBER,0);
      map.put(ATTR_MAX_LOGIN_PER_IP,0);
    }
    String sql=null;
    if (!doesExist(user.getName())) {
      sql=StringUtils.replaceString(insertUserStmt,map);
    }
 else {
      sql=StringUtils.replaceString(updateUserStmt,map);
    }
    LOG.info(sql);
    stmt=createConnection().createStatement();
    stmt.executeUpdate(sql);
  }
 catch (  SQLException ex) {
    LOG.error("String_Node_Str",ex);
    throw new FtpException("String_Node_Str",ex);
  }
 finally {
    closeQuitely(stmt);
  }
}