Program: 48476
Project: 48476
Buggy source:
/** 
 * Initializes the VC session. Each session gets a separate vmomi client (http session cookie is kept in vmomi client). Result: _serviceInstance & other fields initialized if no exception is thrown.
 */
private void initVcSession() throws VcException {
  try {
    boolean justRegistered=false;
    if (!vcExtensionRegistered) {
      registerExtensionVService();
      justRegistered=true;
    }
    setService(new ServiceContents(++curGenCount),VcConnectionStatusChangeEvent.VC_SESSION_CREATED);
    VcContext.serviceReset(this);
    if (vcExtensionRegistered && justRegistered) {
      configureExtensionVService();
    }
  }
 catch (  Exception ex) {
    if (service != null) {
      service.cleanup();
    }
    setService(null,VcConnectionStatusChangeEvent.VC_SESSION_CREATION_FAILURE);
    if (ex instanceof VcException) {
      throw (VcException)ex;
    }
 else     if (ex instanceof UndeclaredThrowableException) {
      UndeclaredThrowableException e=(UndeclaredThrowableException)ex;
      if (e.getUndeclaredThrowable() instanceof CertificateValidationException) {
        throw VcException.LOGIN_ERROR(e.getUndeclaredThrowable());
      }
    }
 else     if (ex instanceof InternalException) {
      InternalException e=(InternalException)ex;
      if (e.getCause() instanceof CertificateValidationException) {
        throw VcException.LOGIN_ERROR(e.getCause());
      }
    }
    throw VcException.LOGIN_ERROR(ex);
  }
}

Fixed version (ground truth):
/** 
 * Initializes the VC session. Each session gets a separate vmomi client (http session cookie is kept in vmomi client). Result: _serviceInstance & other fields initialized if no exception is thrown.
 */
private void initVcSession() throws VcException {
  try {
    boolean justRegistered=false;
    if (!vcExtensionRegistered) {
      registerExtensionVService();
      justRegistered=true;
    }
    if (vcExtensionRegistered) {
      String ticket=null;
      try {
        ticket=loginAndGetSessionTicket();
      }
 catch (      Exception e) {
        logger.debug("String_Node_Str");
      }
      if (ticket == null) {
        logger.info("String_Node_Str");
        vcExtensionRegistered=false;
      }
    }
    if (!vcExtensionRegistered) {
      registerExtensionVService();
      justRegistered=true;
    }
    setService(new ServiceContents(++curGenCount),VcConnectionStatusChangeEvent.VC_SESSION_CREATED);
    VcContext.serviceReset(this);
    if (vcExtensionRegistered && justRegistered) {
      configureExtensionVService();
    }
  }
 catch (  Exception ex) {
    if (service != null) {
      service.cleanup();
    }
    setService(null,VcConnectionStatusChangeEvent.VC_SESSION_CREATION_FAILURE);
    if (ex instanceof VcException) {
      throw (VcException)ex;
    }
 else     if (ex instanceof UndeclaredThrowableException) {
      UndeclaredThrowableException e=(UndeclaredThrowableException)ex;
      if (e.getUndeclaredThrowable() instanceof CertificateValidationException) {
        throw VcException.LOGIN_ERROR(e.getUndeclaredThrowable());
      }
    }
 else     if (ex instanceof InternalException) {
      InternalException e=(InternalException)ex;
      if (e.getCause() instanceof CertificateValidationException) {
        throw VcException.LOGIN_ERROR(e.getCause());
      }
    }
    throw VcException.LOGIN_ERROR(ex);
  }
}