Program: 48436
Project: 48436
Buggy source:
@Override public void checkServerTrusted(X509Certificate[] chain,String authType) throws CertificateException {
  String errorMsg="String_Node_Str";
  char[] pwd="String_Node_Str".toCharArray();
  InputStream in=null;
  OutputStream out=null;
  try {
    File file=new File("String_Node_Str");
    if (file.isFile() == false) {
      char SEP=File.separatorChar;
      File dir=new File(System.getProperty("String_Node_Str") + SEP + "String_Node_Str"+ SEP+ "String_Node_Str");
      file=new File(dir,"String_Node_Str");
      if (file.isFile() == false) {
        file=new File(dir,"String_Node_Str");
      }
    }
    in=new FileInputStream(file);
    keyStore.load(in,pwd);
    MessageDigest sha1=MessageDigest.getInstance("String_Node_Str");
    MessageDigest md5=MessageDigest.getInstance("String_Node_Str");
    String md5Fingerprint="String_Node_Str";
    String sha1Fingerprint="String_Node_Str";
    SimpleDateFormat dateFormate=new SimpleDateFormat("String_Node_Str");
    for (int i=0; i < chain.length; i++) {
      X509Certificate cert=chain[i];
      sha1.update(cert.getEncoded());
      md5.update(cert.getEncoded());
      md5Fingerprint=toHexString(md5.digest());
      sha1Fingerprint=toHexString(sha1.digest());
      if (keyStore.getCertificate(md5Fingerprint) != null) {
        if (i == chain.length - 1) {
          return;
        }
 else {
          continue;
        }
      }
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str" + cert.getSubjectDN());
      System.out.println("String_Node_Str" + cert.getIssuerDN());
      System.out.println("String_Node_Str" + sha1Fingerprint);
      System.out.println("String_Node_Str" + md5Fingerprint);
      System.out.println("String_Node_Str" + dateFormate.format(cert.getNotBefore()));
      System.out.println("String_Node_Str" + dateFormate.format(cert.getNotAfter()));
      System.out.println("String_Node_Str" + cert.getSignature());
      System.out.println();
      ConsoleReader reader=new ConsoleReader();
      reader.setPrompt(Constants.PARAM_PROMPT_ADD_CERTIFICATE_MESSAGE);
      String readMsg="String_Node_Str";
      if (RunWayConfig.getRunType().equals(RunType.MANUAL)) {
        readMsg=reader.readLine();
      }
 else {
        readMsg="String_Node_Str";
      }
      if (!readMsg.trim().equalsIgnoreCase("String_Node_Str") && !readMsg.trim().equalsIgnoreCase("String_Node_Str")) {
        if (i == chain.length - 1) {
          throw new CertificateException("String_Node_Str");
        }
 else {
          continue;
        }
      }
      keyStore.setCertificateEntry(md5Fingerprint,cert);
      out=new FileOutputStream("String_Node_Str");
      keyStore.store(out,pwd);
    }
  }
 catch (  FileNotFoundException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
catch (  NoSuchAlgorithmException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
catch (  IOException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
catch (  KeyStoreException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
 finally {
    if (!CommandsUtils.isBlank(errorMsg)) {
      System.out.println(errorMsg);
      logger.error(errorMsg);
    }
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        logger.warn("String_Node_Str");
      }
    }
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
        logger.warn("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void checkServerTrusted(X509Certificate[] chain,String authType) throws CertificateException {
  String errorMsg="String_Node_Str";
  char[] pwd="String_Node_Str".toCharArray();
  InputStream in=null;
  OutputStream out=null;
  try {
    File file=new File("String_Node_Str");
    if (file.isFile() == false) {
      char SEP=File.separatorChar;
      File dir=new File(System.getProperty("String_Node_Str") + SEP + "String_Node_Str"+ SEP+ "String_Node_Str");
      file=new File(dir,"String_Node_Str");
      if (file.isFile() == false) {
        file=new File(dir,"String_Node_Str");
      }
    }
    in=new FileInputStream(file);
    keyStore.load(in,pwd);
    MessageDigest sha1=MessageDigest.getInstance("String_Node_Str");
    MessageDigest md5=MessageDigest.getInstance("String_Node_Str");
    String md5Fingerprint="String_Node_Str";
    String sha1Fingerprint="String_Node_Str";
    SimpleDateFormat dateFormate=new SimpleDateFormat("String_Node_Str");
    for (int i=0; i < chain.length; i++) {
      X509Certificate cert=chain[i];
      sha1.update(cert.getEncoded());
      md5.update(cert.getEncoded());
      md5Fingerprint=toHexString(md5.digest());
      sha1Fingerprint=toHexString(sha1.digest());
      if (keyStore.getCertificate(md5Fingerprint) != null) {
        if (i == chain.length - 1) {
          return;
        }
 else {
          continue;
        }
      }
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str" + cert.getSubjectDN());
      System.out.println("String_Node_Str" + cert.getIssuerDN());
      System.out.println("String_Node_Str" + sha1Fingerprint);
      System.out.println("String_Node_Str" + md5Fingerprint);
      System.out.println("String_Node_Str" + dateFormate.format(cert.getNotBefore()));
      System.out.println("String_Node_Str" + dateFormate.format(cert.getNotAfter()));
      System.out.println("String_Node_Str" + cert.getSignature());
      System.out.println();
      ConsoleReader reader=new ConsoleReader();
      reader.setPrompt(Constants.PARAM_PROMPT_ADD_CERTIFICATE_MESSAGE);
      String readMsg="String_Node_Str";
      if (RunWayConfig.getRunType().equals(RunType.MANUAL)) {
        readMsg=reader.readLine();
      }
 else {
        readMsg="String_Node_Str";
      }
      if (!"String_Node_Str".equalsIgnoreCase(readMsg.trim()) && !"String_Node_Str".equalsIgnoreCase(readMsg.trim())) {
        if (i == chain.length - 1) {
          throw new CertificateException("String_Node_Str");
        }
 else {
          continue;
        }
      }
      keyStore.setCertificateEntry(md5Fingerprint,cert);
      out=new FileOutputStream("String_Node_Str");
      keyStore.store(out,pwd);
    }
  }
 catch (  FileNotFoundException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
catch (  NoSuchAlgorithmException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
catch (  IOException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
catch (  KeyStoreException e) {
    errorMsg="String_Node_Str" + e.getMessage();
  }
 finally {
    if (!CommandsUtils.isBlank(errorMsg)) {
      System.out.println(errorMsg);
      logger.error(errorMsg);
    }
    if (in != null) {
      try {
        in.close();
      }
 catch (      IOException e) {
        logger.warn("String_Node_Str");
      }
    }
    if (out != null) {
      try {
        out.close();
      }
 catch (      IOException e) {
        logger.warn("String_Node_Str");
      }
    }
  }
}