Program: 2439
Project: 2439
Buggy source:
/** 
 * If this looks like a POST request (form submission) containing a username and password, give the user the option of saving them. Will either do nothing, or block until the UI interaction is complete. Called directly by WebKit.
 * @param postData The data about to be sent as the body of a POST request.
 * @param username The username entered by the user (sniffed from the DOM).
 * @param password The password entered by the user (sniffed from the DOM).
 */
private void maybeSavePassword(byte[] postData,String username,String password){
  if (postData == null || username == null || username.isEmpty() || password == null || password.isEmpty()) {
    return;
  }
  if (!mSettings.getSavePassword()) {
    return;
  }
  try {
    if (DebugFlags.BROWSER_FRAME) {
      Assert.assertNotNull(mCallbackProxy.getBackForwardList().getCurrentItem());
    }
    WebAddress uri=new WebAddress(mCallbackProxy.getBackForwardList().getCurrentItem().getUrl());
    String schemePlusHost=uri.getScheme() + SCHEME_HOST_DELIMITER + uri.getHost();
    String postString=new String(postData);
    WebViewDatabaseClassic db=WebViewDatabaseClassic.getInstance(mContext);
    if (postString.contains(URLEncoder.encode(username)) && postString.contains(URLEncoder.encode(password))) {
      String[] saved=db.getUsernamePassword(schemePlusHost);
      if (saved != null) {
        if (saved[0] != null) {
          db.setUsernamePassword(schemePlusHost,username,password);
        }
      }
 else {
        mCallbackProxy.onSavePassword(schemePlusHost,username,password,null);
      }
    }
  }
 catch (  ParseException ex) {
  }
}

Fixed version (ground truth):
/** 
 * If this looks like a POST request (form submission) containing a username and password, give the user the option of saving them. Will either do nothing, or block until the UI interaction is complete. Called directly by WebKit.
 * @param postData The data about to be sent as the body of a POST request.
 * @param username The username entered by the user (sniffed from the DOM).
 * @param password The password entered by the user (sniffed from the DOM).
 */
private void maybeSavePassword(byte[] postData,String username,String password){
  if (postData == null || username == null || username.isEmpty() || password == null || password.isEmpty()) {
    return;
  }
  if (!mSettings.getSavePassword()) {
    return;
  }
  try {
    if (DebugFlags.BROWSER_FRAME) {
      Assert.assertNotNull(mCallbackProxy.getBackForwardList().getCurrentItem());
    }
    WebAddress uri=new WebAddress(mCallbackProxy.getBackForwardList().getCurrentItem().getUrl());
    String schemePlusHost=uri.getScheme() + SCHEME_HOST_DELIMITER + uri.getHost();
    String postString=new String(postData);
    if (postString.contains(URLEncoder.encode(username)) && postString.contains(URLEncoder.encode(password))) {
      String[] saved=mDatabase.getUsernamePassword(schemePlusHost);
      if (saved != null) {
        if (saved[0] != null) {
          mDatabase.setUsernamePassword(schemePlusHost,username,password);
        }
      }
 else {
        mCallbackProxy.onSavePassword(schemePlusHost,username,password,null);
      }
    }
  }
 catch (  ParseException ex) {
  }
}