Program: 48475
Project: 48475
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;
    Configuration.setBoolean(SERENGETI_EXTENSION_REGISTERED,true);
    Configuration.save();
    logger.debug("String_Node_Str");
  }
 catch (  Exception e) {
    logger.error("String_Node_Str" + evsURL,e);
  }
 finally {
    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 {
    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);
      }
    }
  }
}