Program: 48426
Project: 48426
Buggy source:
/** 
 * This sends a URL POST request to the Extension vService guest API to register a new extension. Upon success, set vcExtensionRegistered to true. Note that the extension will not be fully configured until we log in to VC as this extension and make some VMODL calls to finish the job. Note also that we only need to do this once per CMS install, not once per CMS startup, but it doesn't seem to hurt to do it every time.
 * @synchronized for preventing concurrent call to register EVS.
 */
private static synchronized void registerExtensionVService(){
  if (vcExtensionRegistered) {
    return;
  }
  logger.debug("String_Node_Str" + evsURL + "String_Node_Str"+ evsToken);
  Writer output=null;
  BufferedReader input=null;
  try {
    Certificate cert=CmsKeyStore.getCertificate(CmsKeyStore.VC_EXT_KEY);
    URL url=new URL(evsURL);
    URLConnection connection=url.openConnection();
    connection.setRequestProperty("String_Node_Str",evsToken);
    connection.setDoInput(true);
    connection.setDoOutput(true);
    connection.setUseCaches(false);
    output=new OutputStreamWriter(connection.getOutputStream());
    String evsSchema="String_Node_Str";
    String payload="String_Node_Str" + evsSchema + "String_Node_Str"+ "String_Node_Str"+ extKey+ "String_Node_Str"+ "String_Node_Str"+ CertificateToPem(cert)+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    output.write(payload);
    output.flush();
    connection.connect();
    Map<String,List<String>> headers=connection.getHeaderFields();
    for (    Map.Entry<String,List<String>> e : headers.entrySet()) {
      for (      String val : e.getValue()) {
        logger.info("String_Node_Str" + e.getKey() + "String_Node_Str"+ val);
      }
    }
    input=new BufferedReader(new InputStreamReader(connection.getInputStream()));
    for (String str=input.readLine(); str != null; str=input.readLine()) {
      logger.debug("String_Node_Str" + str);
    }
    vcExtensionRegistered=true;
    logger.debug("String_Node_Str");
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + evsURL,e);
  }
 finally {
    Configuration.setBoolean(SERENGETI_EXTENSION_REGISTERED,true);
    Configuration.save();
    if (output != null) {
      try {
        output.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str",e);
      }
    }
    if (input != null) {
      try {
        input.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * This sends a URL POST request to the Extension vService guest API to register a new extension. Upon success, set vcExtensionRegistered to true. Note that the extension will not be fully configured until we log in to VC as this extension and make some VMODL calls to finish the job. Note also that we only need to do this once per CMS install, not once per CMS startup, but it doesn't seem to hurt to do it every time.
 * @synchronized for preventing concurrent call to register EVS.
 */
private static synchronized void registerExtensionVService(){
  if (vcExtensionRegistered) {
    return;
  }
  logger.debug("String_Node_Str" + evsURL + "String_Node_Str"+ evsToken);
  Writer output=null;
  BufferedReader input=null;
  try {
    ThumbprintTrustManager thumbprintTrustManager=new ThumbprintTrustManager();
    thumbprintTrustManager.add(vcThumbprint);
    TrustManager[] trustManagers=new TrustManager[]{thumbprintTrustManager};
    HttpClient httpClient=new HttpClient();
    TlsSocketFactory tlsSocketFactory=new TlsSocketFactory(trustManagers);
    Protocol.registerProtocol("String_Node_Str",new Protocol("String_Node_Str",(ProtocolSocketFactory)tlsSocketFactory,443));
    PostMethod method=new PostMethod(evsURL);
    method.setRequestHeader("String_Node_Str",evsToken);
    Certificate cert=CmsKeyStore.getCertificate(CmsKeyStore.VC_EXT_KEY);
    String evsSchema="String_Node_Str";
    String payload="String_Node_Str" + evsSchema + "String_Node_Str"+ "String_Node_Str"+ extKey+ "String_Node_Str"+ "String_Node_Str"+ CertificateToPem(cert)+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
    RequestEntity requestEntity=new StringRequestEntity(payload,"String_Node_Str","String_Node_Str");
    method.setRequestEntity(requestEntity);
    int statusCode=httpClient.executeMethod(method);
    logger.info("String_Node_Str" + statusCode);
    for (    Header e : method.getResponseHeaders()) {
      logger.debug("String_Node_Str" + e.getName() + "String_Node_Str"+ e.getValue());
    }
    input=new BufferedReader(new InputStreamReader(method.getResponseBodyAsStream()));
    for (String str=input.readLine(); str != null; str=input.readLine()) {
      logger.debug("String_Node_Str" + str);
    }
    if (statusCode == 200) {
      vcExtensionRegistered=true;
      logger.info("String_Node_Str");
    }
 else {
      logger.error("String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + evsURL,e);
  }
 finally {
    Configuration.setBoolean(SERENGETI_EXTENSION_REGISTERED,true);
    Configuration.save();
    if (output != null) {
      try {
        output.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str",e);
      }
    }
    if (input != null) {
      try {
        input.close();
      }
 catch (      IOException e) {
        logger.error("String_Node_Str",e);
      }
    }
  }
}