Program: 111514
Project: 111514
Buggy source:
public void checkServerTrusted(X509Certificate[] chain,String authType) throws CertificateException {
  MessageDigest md=null;
  try {
    md=MessageDigest.getInstance("String_Node_Str");
    tm.checkServerTrusted(chain,authType);
  }
 catch (  CertificateException e) {
    if (e.getCause() instanceof CertPathBuilderException) {
      Object[] answer={"String_Node_Str","String_Node_Str"};
      X509Certificate cert=chain[0];
      md.update(cert.getEncoded());
      String thumbprint=DatatypeConverter.printHexBinary(md.digest());
      thumbprint=thumbprint.replaceAll("String_Node_Str","String_Node_Str");
      int ret=JOptionPane.showOptionDialog(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str" + cert.getSubjectX500Principal().getName() + "String_Node_Str"+ "String_Node_Str"+ cert.getIssuerX500Principal().getName()+ "String_Node_Str"+ "String_Node_Str"+ cert.getSerialNumber()+ "String_Node_Str"+ "String_Node_Str"+ cert.getVersion()+ "String_Node_Str"+ "String_Node_Str"+ cert.getPublicKey().getAlgorithm()+ "String_Node_Str"+ "String_Node_Str"+ cert.getNotBefore()+ "String_Node_Str"+ "String_Node_Str"+ cert.getNotAfter()+ "String_Node_Str"+ "String_Node_Str"+ thumbprint+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,answer,answer[0]);
      if (ret == JOptionPane.YES_OPTION) {
        File vncDir=new File(FileUtils.getVncHomeDir());
        if (!vncDir.exists() && !vncDir.mkdir()) {
          vlog.info("String_Node_Str");
          return;
        }
        Collection<? extends X509Certificate> cacerts=null;
        String castore=FileUtils.getVncHomeDir() + "String_Node_Str";
        File caFile=new File(castore);
        try {
          caFile.createNewFile();
        }
 catch (        IOException ioe) {
          vlog.error(ioe.getCause().getMessage());
          return;
        }
        InputStream caStream=new MyFileInputStream(caFile);
        CertificateFactory cf=CertificateFactory.getInstance("String_Node_Str");
        cacerts=(Collection<? extends X509Certificate>)cf.generateCertificates(caStream);
        for (int i=0; i < chain.length; i++) {
          if (cacerts == null || !cacerts.contains(chain[i])) {
            byte[] der=chain[i].getEncoded();
            String pem=DatatypeConverter.printBase64Binary(der);
            pem=pem.replaceAll("String_Node_Str","String_Node_Str");
            FileWriter fw=null;
            try {
              fw=new FileWriter(castore,true);
              fw.write("String_Node_Str");
              fw.write(pem + "String_Node_Str");
              fw.write("String_Node_Str");
            }
 catch (            IOException ioe) {
              throw new Exception(ioe.getCause().getMessage());
            }
 finally {
              try {
                if (fw != null)                 fw.close();
              }
 catch (              IOException ioe2) {
                throw new Exception(ioe2.getCause().getMessage());
              }
            }
          }
        }
      }
 else {
        System.exit(1);
      }
    }
 else {
      throw new Exception(e.getCause().getMessage());
    }
  }
catch (  java.lang.Exception e) {
    throw new Exception(e.getCause().getMessage());
  }
}

Fixed version (ground truth):
public void checkServerTrusted(X509Certificate[] chain,String authType) throws CertificateException {
  MessageDigest md=null;
  try {
    md=MessageDigest.getInstance("String_Node_Str");
    tm.checkServerTrusted(chain,authType);
  }
 catch (  CertificateException e) {
    if (e.getCause() instanceof CertPathBuilderException) {
      Object[] answer={"String_Node_Str","String_Node_Str"};
      X509Certificate cert=chain[0];
      md.update(cert.getEncoded());
      String thumbprint=DatatypeConverter.printHexBinary(md.digest());
      thumbprint=thumbprint.replaceAll("String_Node_Str","String_Node_Str");
      int ret=JOptionPane.showOptionDialog(null,"String_Node_Str" + "String_Node_Str" + "String_Node_Str" + cert.getSubjectX500Principal().getName() + "String_Node_Str"+ "String_Node_Str"+ cert.getIssuerX500Principal().getName()+ "String_Node_Str"+ "String_Node_Str"+ cert.getSerialNumber()+ "String_Node_Str"+ "String_Node_Str"+ cert.getVersion()+ "String_Node_Str"+ "String_Node_Str"+ cert.getPublicKey().getAlgorithm()+ "String_Node_Str"+ "String_Node_Str"+ cert.getNotBefore()+ "String_Node_Str"+ "String_Node_Str"+ cert.getNotAfter()+ "String_Node_Str"+ "String_Node_Str"+ thumbprint+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str","String_Node_Str",JOptionPane.YES_NO_OPTION,JOptionPane.WARNING_MESSAGE,null,answer,answer[0]);
      if (ret == JOptionPane.YES_OPTION) {
        File vncDir=new File(FileUtils.getVncHomeDir());
        if (!vncDir.exists() && !vncDir.mkdir()) {
          vlog.info("String_Node_Str");
          return;
        }
        Collection<? extends X509Certificate> cacerts=null;
        String castore=FileUtils.getVncHomeDir() + "String_Node_Str";
        File caFile=new File(castore);
        try {
          caFile.createNewFile();
        }
 catch (        IOException ioe) {
          vlog.error(ioe.getCause().getMessage());
          return;
        }
        InputStream caStream=new MyFileInputStream(caFile);
        CertificateFactory cf=CertificateFactory.getInstance("String_Node_Str");
        cacerts=(Collection<? extends X509Certificate>)cf.generateCertificates(caStream);
        for (int i=0; i < chain.length; i++) {
          if (cacerts == null || !cacerts.contains(chain[i])) {
            byte[] der=chain[i].getEncoded();
            String pem=DatatypeConverter.printBase64Binary(der);
            pem=pem.replaceAll("String_Node_Str","String_Node_Str");
            FileWriter fw=null;
            try {
              fw=new FileWriter(castore,true);
              fw.write("String_Node_Str");
              fw.write(pem + "String_Node_Str");
              fw.write("String_Node_Str");
            }
 catch (            IOException ioe) {
              throw new Exception(ioe.getCause().getMessage());
            }
 finally {
              try {
                if (fw != null)                 fw.close();
              }
 catch (              IOException ioe2) {
                throw new Exception(ioe2.getCause().getMessage());
              }
            }
          }
        }
      }
 else {
        throw new WarningException("String_Node_Str");
      }
    }
 else {
      throw new SystemException(e.getCause().getMessage());
    }
  }
catch (  java.lang.Exception e) {
    throw new Exception(e.getCause().getMessage());
  }
}