Program: 126941
Project: 126941
Buggy source:
public List<String> connectFromCustomModuleName(String proxy){
  preparModuleInit();
  SalesforceModuleParseAPI salesforceAPI=new SalesforceModuleParseAPI();
  String[] types=null;
  DescribeGlobalSObjectResult[] dgsrs=null;
  DescribeGlobalResult describeGlobalResult=null;
  boolean socksProxy=false;
  boolean httpProxy=false;
  boolean httpsProxy=false;
  if (SalesforceModuleParseAPI.USE_SOCKS_PROXY.equals(proxy)) {
    socksProxy=true;
  }
  if (SalesforceModuleParseAPI.USE_HTTP_PROXY.equals(proxy)) {
    if (endPoint.startsWith("String_Node_Str")) {
      httpsProxy=true;
    }
 else {
      httpProxy=true;
    }
  }
  try {
    if (loginType.equals(BASIC)) {
      salesforceAPI.resetAllProxy();
      salesforceAPI.setProxy(proxyHost,proxyPort,proxyUsername,proxyPassword,httpProxy,socksProxy,httpsProxy);
      salesforceAPI.login(endPoint,username,pwd,timeOut);
      ISalesforceModuleParser currentAPI=salesforceAPI.getCurrentAPI();
      if (currentAPI instanceof SalesforceModuleParseEnterprise) {
        describeGlobalResult=describeGlobal();
        if (describeGlobalResult != null) {
          types=describeGlobalResult.getTypes();
        }
      }
 else {
        if (currentAPI instanceof SalesforceModuleParserPartner) {
          SalesforceModuleParserPartner partner=(SalesforceModuleParserPartner)currentAPI;
          SforceManagementImpl sforceManagement=partner.getSforceManagement();
          SessionHeader sessionHeader=sforceManagement.getSessionHeader();
          DescribeGlobal dg=new DescribeGlobal();
          com.salesforce.soap.partner.DescribeGlobalResult dgr=sforceManagement.getStub().describeGlobal(dg,sessionHeader,null,null).getResult();
          dgsrs=dgr.getSobjects();
        }
      }
    }
 else {
      salesforceAPI.resetAllProxy();
      salesforceAPI.setProxy(proxyHost,proxyPort,proxyUsername,proxyPassword,httpProxy,socksProxy,httpsProxy);
      Token token=salesforceAPI.login(endPointForAuth,consumerKey,consumeSecret,callbackHost,callbackPort,salesforceVersion,tokenProperties,timeOut);
      if (token != null) {
        org.talend.salesforce.SforceManagement sfMgr=new org.talend.salesforce.SforceManagementImpl();
        OAuthClient client=new OAuthClient();
        client.setBaseOAuthURL(endPointForAuth);
        client.setCallbackHost(callbackHost);
        client.setCallbackPort(Integer.parseInt(callbackPort));
        client.setClientID(consumerKey);
        client.setClientSecret(consumeSecret);
        String endpoint=client.getSOAPEndpoint(token,salesforceVersion);
        boolean result=sfMgr.login(token.getAccess_token(),endpoint,Integer.parseInt(timeOut),false);
        SessionHeader sessionHeader=sfMgr.getSessionHeader();
        DescribeGlobal dg=new DescribeGlobal();
        com.salesforce.soap.partner.DescribeGlobalResult dgr=sfMgr.getStub().describeGlobal(dg,sessionHeader,null,null).getResult();
        dgsrs=dgr.getSobjects();
      }
    }
    salesforceAPI.resetAllProxy();
    INode node=getSalesforceNode();
    List list=new ArrayList();
    IElementParameter modulesNameParam=node.getElementParameter("String_Node_Str");
    Object[] modulename=modulesNameParam.getListItemsValue();
    if (modulename != null && modulename.length > 1) {
      for (int i=0; i < modulename.length - 1; i++) {
        list.add(i,modulename[i]);
      }
    }
    if (types != null && types.length > 0) {
      for (int j=0; j < types.length; j++) {
        if (!list.contains(types[j])) {
          list.add(types[j]);
        }
      }
    }
    if (dgsrs != null && dgsrs.length > 0) {
      for (int k=0; k < dgsrs.length; k++) {
        DescribeGlobalSObjectResult dsResult=dgsrs[k];
        String name=dsResult.getName();
        if (!list.contains(name)) {
          list.add(name);
        }
      }
    }
    return list;
  }
 catch (  Exception ex) {
    ExceptionHandler.process(ex);
    return null;
  }
}

Fixed version (ground truth):
public List<String> connectFromCustomModuleName(String proxy){
  preparModuleInit();
  SalesforceModuleParseAPI salesforceAPI=new SalesforceModuleParseAPI();
  String[] types=null;
  DescribeGlobalSObjectResult[] dgsrs=null;
  DescribeGlobalResult describeGlobalResult=null;
  boolean socksProxy=false;
  boolean httpProxy=false;
  boolean httpsProxy=false;
  if (SalesforceModuleParseAPI.USE_SOCKS_PROXY.equals(proxy)) {
    socksProxy=true;
  }
  if (SalesforceModuleParseAPI.USE_HTTP_PROXY.equals(proxy)) {
    if (endPoint.startsWith("String_Node_Str")) {
      httpsProxy=true;
    }
 else {
      httpProxy=true;
    }
  }
  try {
    if (loginType.equalsIgnoreCase(BASIC)) {
      salesforceAPI.resetAllProxy();
      salesforceAPI.setProxy(proxyHost,proxyPort,proxyUsername,proxyPassword,httpProxy,socksProxy,httpsProxy);
      salesforceAPI.login(endPoint,username,pwd,timeOut);
      ISalesforceModuleParser currentAPI=salesforceAPI.getCurrentAPI();
      if (currentAPI instanceof SalesforceModuleParseEnterprise) {
        describeGlobalResult=describeGlobal();
        if (describeGlobalResult != null) {
          types=describeGlobalResult.getTypes();
        }
      }
 else {
        if (currentAPI instanceof SalesforceModuleParserPartner) {
          SalesforceModuleParserPartner partner=(SalesforceModuleParserPartner)currentAPI;
          SforceManagementImpl sforceManagement=partner.getSforceManagement();
          SessionHeader sessionHeader=sforceManagement.getSessionHeader();
          DescribeGlobal dg=new DescribeGlobal();
          com.salesforce.soap.partner.DescribeGlobalResult dgr=sforceManagement.getStub().describeGlobal(dg,sessionHeader,null,null).getResult();
          dgsrs=dgr.getSobjects();
        }
      }
    }
 else {
      salesforceAPI.resetAllProxy();
      salesforceAPI.setProxy(proxyHost,proxyPort,proxyUsername,proxyPassword,httpProxy,socksProxy,httpsProxy);
      Token token=salesforceAPI.login(endPointForAuth,consumerKey,consumeSecret,callbackHost,callbackPort,salesforceVersion,tokenProperties,timeOut);
      if (token != null) {
        org.talend.salesforce.SforceManagement sfMgr=new org.talend.salesforce.SforceManagementImpl();
        OAuthClient client=new OAuthClient();
        client.setBaseOAuthURL(endPointForAuth);
        client.setCallbackHost(callbackHost);
        client.setCallbackPort(Integer.parseInt(callbackPort));
        client.setClientID(consumerKey);
        client.setClientSecret(consumeSecret);
        String endpoint=client.getSOAPEndpoint(token,salesforceVersion);
        boolean result=sfMgr.login(token.getAccess_token(),endpoint,Integer.parseInt(timeOut),false);
        SessionHeader sessionHeader=sfMgr.getSessionHeader();
        DescribeGlobal dg=new DescribeGlobal();
        com.salesforce.soap.partner.DescribeGlobalResult dgr=sfMgr.getStub().describeGlobal(dg,sessionHeader,null,null).getResult();
        dgsrs=dgr.getSobjects();
      }
    }
    salesforceAPI.resetAllProxy();
    INode node=getSalesforceNode();
    List list=new ArrayList();
    IElementParameter modulesNameParam=node.getElementParameter("String_Node_Str");
    Object[] modulename=modulesNameParam.getListItemsValue();
    if (modulename != null && modulename.length > 1) {
      for (int i=0; i < modulename.length - 1; i++) {
        list.add(i,modulename[i]);
      }
    }
    if (types != null && types.length > 0) {
      for (int j=0; j < types.length; j++) {
        if (!list.contains(types[j])) {
          list.add(types[j]);
        }
      }
    }
    if (dgsrs != null && dgsrs.length > 0) {
      for (int k=0; k < dgsrs.length; k++) {
        DescribeGlobalSObjectResult dsResult=dgsrs[k];
        String name=dsResult.getName();
        if (!list.contains(name)) {
          list.add(name);
        }
      }
    }
    return list;
  }
 catch (  Exception ex) {
    ExceptionHandler.process(ex);
    return null;
  }
}