nus-yam/ex-repair huggingface dataset:
Program: 127891
Project: 127891
Buggy source:
/** 
 * Set up the URL by checking the current hive mode. Added by Marvin Wang on Sep 4, 2012.
 * @return
 */
private String getStringConnection(){
  String s=null;
  String versionStr=dbVersionCombo.getText();
  if (isContextMode()) {
    s=DBConnectionContextUtils.getUrlConnectionString(connectionItem,true);
  }
 else {
    if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbTypeCombo.getText())) {
      s=DatabaseConnStrUtil.getHiveURLString(getConnection(),getConnection().getServerName(),getConnection().getPort(),getConnection().getSID());
    }
 else {
      EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(versionStr);
      if (version != null) {
        versionStr=version.getVersionValue();
      }
      s=DatabaseConnStrUtil.getURLString(dbTypeCombo.getText(),versionStr,serverText.getText(),usernameText.getText(),passwordText.getText(),portText.getText(),sidOrDatabaseText.getText(),fileField.getText(),datasourceText.getText(),directoryField.getText(),additionParamText.getText());
    }
  }
  return s;
}

Fixed version (ground truth):
/** 
 * Set up the URL by checking the current hive mode. Added by Marvin Wang on Sep 4, 2012.
 * @return
 */
private String getStringConnection(){
  String s=null;
  String versionStr=dbVersionCombo.getText();
  if (isContextMode()) {
    s=DBConnectionContextUtils.getUrlConnectionString(connectionItem,true);
  }
 else {
    if (EDatabaseTypeName.HIVE.getDisplayName().equals(dbTypeCombo.getText())) {
      String template=null;
      if (HiveServerVersionInfo.HIVE_SERVER_2.getDisplayName().equals(hiveServerVersionCombo.getText())) {
        template=DbConnStrForHive.URL_HIVE_2_TEMPLATE;
      }
 else {
        template=DbConnStrForHive.URL_HIVE_1_TEMPLATE;
      }
      s=DatabaseConnStrUtil.getHiveURLString(getConnection(),getConnection().getServerName(),getConnection().getPort(),getConnection().getSID(),template);
    }
 else {
      EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersionDisplay(versionStr);
      if (version != null) {
        versionStr=version.getVersionValue();
      }
      s=DatabaseConnStrUtil.getURLString(dbTypeCombo.getText(),versionStr,serverText.getText(),usernameText.getText(),passwordText.getText(),portText.getText(),sidOrDatabaseText.getText(),fileField.getText(),datasourceText.getText(),directoryField.getText(),additionParamText.getText());
    }
  }
  return s;
}
Program: 127892
Project: 127892
Buggy source:
public static String getHiveURLString(DatabaseConnection dbConn,String server,String port,String sidOrDatabase){
  String hiveModel=dbConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
  String url=dbConn.getURL();
  if (url != null) {
    if (url.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)) {
      if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equalsIgnoreCase(hiveModel)) {
        url=getHive2EmbeddedURLString();
      }
 else {
        url=getHive2StandaloneURLString(false,server,port,sidOrDatabase);
      }
    }
 else     if (url.startsWith(DbConnStrForHive.URL_HIVE_1_TEMPLATE)) {
      if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equalsIgnoreCase(hiveModel)) {
        url=getHive1EmbeddedURLString();
      }
 else {
        url=getHive1StandaloneURLString(false,server,port,sidOrDatabase);
      }
    }
  }
 else {
    url=getHive1EmbeddedURLString();
  }
  return url;
}

Fixed version (ground truth):
public static String getHiveURLString(DatabaseConnection dbConn,String server,String port,String sidOrDatabase){
  String hiveModel=dbConn.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
  String url=dbConn.getURL();
  if (url != null) {
    if (url.startsWith(DbConnStrForHive.URL_HIVE_2_TEMPLATE)) {
      if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equalsIgnoreCase(hiveModel)) {
        url=getHive2EmbeddedURLString();
      }
 else {
        url=getHive2StandaloneURLString(false,server,port,sidOrDatabase);
      }
    }
 else     if (url.startsWith(DbConnStrForHive.URL_HIVE_1_TEMPLATE)) {
      if (HiveConnVersionInfo.MODE_EMBEDDED.getKey().equalsIgnoreCase(hiveModel)) {
        url=getHive1EmbeddedURLString();
      }
 else {
        url=getHive1StandaloneURLString(false,server,port,sidOrDatabase);
      }
    }
 else {
      url=getHive1EmbeddedURLString();
    }
  }
 else {
    url=getHive1EmbeddedURLString();
  }
  return url;
}
Program: 127894
Project: 127894
Buggy source:
/** 
 * The contents only show up when the current db type is hive and hive mode is embedded. Contents include name node url and job tracker url. Added by Marvin Wang on Oct. 15, 2012.
 * @param parent
 */
private void createHadoopUIContentsForHiveEmbedded(Composite parent){
  GridLayout layout2=(GridLayout)parent.getLayout();
  hadoopPropGrp=new Group(parent,SWT.NONE);
  hadoopPropGrp.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.fillDefaults().span(layout2.numColumns,1).applyTo(hadoopPropGrp);
  hadoopPropGrp.setLayout(new GridLayout(2,false));
  nameNodeURLTxt=new LabelledText(hadoopPropGrp,Messages.getString("String_Node_Str"),1);
  jobTrackerURLTxt=new LabelledText(hadoopPropGrp,Messages.getString("String_Node_Str"),1);
  setHideHadoopInfoWidgets(true);
}

Fixed version (ground truth):
/** 
 * The contents only show up when the current db type is hive and hive mode is embedded. Contents include name node url and job tracker url. Added by Marvin Wang on Oct. 15, 2012.
 * @param parent
 */
private void createHadoopUIContentsForHiveEmbedded(Composite parent){
  GridLayout layout2=(GridLayout)parent.getLayout();
  hadoopPropGrp=new Group(parent,SWT.NONE);
  hadoopPropGrp.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.fillDefaults().span(layout2.numColumns,1).applyTo(hadoopPropGrp);
  GridLayout layout=new GridLayout(2,false);
  layout.marginHeight=0;
  hadoopPropGrp.setLayout(layout);
  nameNodeURLTxt=new LabelledText(hadoopPropGrp,Messages.getString("String_Node_Str"),1);
  jobTrackerURLTxt=new LabelledText(hadoopPropGrp,Messages.getString("String_Node_Str"),1);
  setHideHadoopInfoWidgets(true);
}
Program: 127896
Project: 127896
Buggy source:
/** 
 * Check DBType is AS400,set systemButton and stardardButton visible.a
 */
private void checkDBTypeAS400(){
  if (dbTypeCombo.getSelectionIndex() == 16 || dbTypeCombo.getSelectionIndex() == 25 || dbTypeCombo.getSelectionIndex() == 26) {
    standardButton.setVisible(true);
    systemButton.setVisible(true);
  }
 else {
    standardButton.setVisible(false);
    systemButton.setVisible(false);
  }
}

Fixed version (ground truth):
/** 
 * Check DBType is AS400,set systemButton and stardardButton visible.a
 */
private void checkDBTypeAS400(){
  if (isDBTypeSelected(EDatabaseConnTemplate.AS400)) {
    standardButton.setVisible(true);
    systemButton.setVisible(true);
  }
 else {
    standardButton.setVisible(false);
    systemButton.setVisible(false);
  }
}
Program: 127898
Project: 127898
Buggy source:
public String getLabel(){
  return this.label;
}

Fixed version (ground truth):
public String getLabel(){
  if (this.label == null) {
    if (isStaticNode()) {
      return super.toString();
    }
 else {
      return getType();
    }
  }
  return this.label;
}
Program: 127899
Project: 127899
Buggy source:
public int compare(IConnection connection1,IConnection connection2){
  EConnectionType lineStyle=connection1.getLineStyle();
  EConnectionType lineStyle2=connection2.getLineStyle();
  if ("String_Node_Str".equals(connection1.getConnectorName())) {
    return -1;
  }
  if ("String_Node_Str".equals(connection2.getConnectorName())) {
    return 1;
  }
  if (lineStyle == EConnectionType.FLOW_MAIN || lineStyle == EConnectionType.FLOW_MERGE) {
    return -1;
  }
  if (lineStyle2 == EConnectionType.FLOW_MAIN || lineStyle2 == EConnectionType.FLOW_MERGE) {
    return 1;
  }
  return 0;
}

Fixed version (ground truth):
@Override public int compare(IConnection connection1,IConnection connection2){
  EConnectionType lineStyle=connection1.getLineStyle();
  EConnectionType lineStyle2=connection2.getLineStyle();
  if ("String_Node_Str".equals(connection1.getConnectorName())) {
    return -1;
  }
  if ("String_Node_Str".equals(connection2.getConnectorName())) {
    return 1;
  }
  if (lineStyle == EConnectionType.FLOW_MAIN || lineStyle == EConnectionType.FLOW_MERGE) {
    return -1;
  }
  if (lineStyle2 == EConnectionType.FLOW_MAIN || lineStyle2 == EConnectionType.FLOW_MERGE) {
    return 1;
  }
  return 0;
}
Program: 127900
Project: 127900
Buggy source:
/** 
 * DOC jyhu <p> function:get the node from generating nodes by unique name. aim:to get the property value from any node. </p> Notice: It is used to get property values from the pointed node.
 * @param node:node from the job @param uniqueName:the unique name of the pointed node.
 * @return 
 */
public static INode getNodeByUniqueName(final IProcess process,String uniqueName){
  List<INode> nodes=(List<INode>)process.getGeneratingNodes();
  INode return_node=null;
  for (  INode current_node : nodes) {
    if (uniqueName.equals(current_node.getUniqueName())) {
      return_node=current_node;
    }
  }
  return return_node;
}

Fixed version (ground truth):
/** 
 * DOC jyhu <p> function:get the node from generating nodes by unique name. aim:to get the property value from any node. </p> Notice: It is used to get property values from the pointed node.
 * @param node:node from the job @param uniqueName:the unique name of the pointed node.
 * @return
 */
public static INode getNodeByUniqueName(final IProcess process,String uniqueName){
  List<INode> nodes=(List<INode>)process.getGeneratingNodes();
  INode return_node=null;
  for (  INode current_node : nodes) {
    if (uniqueName.equals(current_node.getUniqueName())) {
      return_node=current_node;
    }
  }
  return return_node;
}
Program: 127902
Project: 127902
Buggy source:
public static List<? extends IConnection> getOutgoingSortedConnections(INode node){
  List<IConnection> conns=null;
  List<? extends IConnection> outgoingConnections=node.getOutgoingConnections();
  if (outgoingConnections != null) {
    conns=new ArrayList<IConnection>(outgoingConnections);
    Collections.sort(conns,new Comparator<IConnection>(){
      public int compare(      IConnection connection1,      IConnection connection2){
        EConnectionType lineStyle=connection1.getLineStyle();
        EConnectionType lineStyle2=connection2.getLineStyle();
        if ("String_Node_Str".equals(connection1.getConnectorName())) {
          return -1;
        }
        if ("String_Node_Str".equals(connection2.getConnectorName())) {
          return 1;
        }
        if (lineStyle == EConnectionType.FLOW_MAIN || lineStyle == EConnectionType.FLOW_MERGE) {
          return -1;
        }
        if (lineStyle2 == EConnectionType.FLOW_MAIN || lineStyle2 == EConnectionType.FLOW_MERGE) {
          return 1;
        }
        return 0;
      }
    }
);
  }
  return conns;
}

Fixed version (ground truth):
public static List<? extends IConnection> getOutgoingSortedConnections(INode node){
  List<IConnection> conns=null;
  List<? extends IConnection> outgoingConnections=node.getOutgoingConnections();
  if (outgoingConnections != null) {
    conns=new ArrayList<IConnection>(outgoingConnections);
    Collections.sort(conns,new Comparator<IConnection>(){
      @Override public int compare(      IConnection connection1,      IConnection connection2){
        EConnectionType lineStyle=connection1.getLineStyle();
        EConnectionType lineStyle2=connection2.getLineStyle();
        if ("String_Node_Str".equals(connection1.getConnectorName())) {
          return -1;
        }
        if ("String_Node_Str".equals(connection2.getConnectorName())) {
          return 1;
        }
        if (lineStyle == EConnectionType.FLOW_MAIN || lineStyle == EConnectionType.FLOW_MERGE) {
          return -1;
        }
        if (lineStyle2 == EConnectionType.FLOW_MAIN || lineStyle2 == EConnectionType.FLOW_MERGE) {
          return 1;
        }
        return 0;
      }
    }
);
  }
  return conns;
}
Program: 127904
Project: 127904
Buggy source:
/** 
 * Returns the distribution <code>HiveConnVersionInfo</code> object by the given <code>index</code> from level 0. Added by Marvin Wang on Aug 13, 2012.
 * @param index
 * @return
 */
public static HiveConnVersionInfo getDistributionObj(int index){
  List<HiveConnVersionInfo> distributions=getObjectsByLevel(0);
  if (distributions != null && distributions.size() > 0) {
    return distributions.get(index);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Returns the distribution <code>HiveConnVersionInfo</code> object by the given <code>index</code> from level 0. Added by Marvin Wang on Aug 13, 2012.
 * @param index
 * @return
 */
public static HiveConnVersionInfo getDistributionObj(int index){
  List<HiveConnVersionInfo> distributions=getObjectsByLevel(0);
  if (distributions != null && distributions.size() > 0 && index != -1) {
    return distributions.get(index);
  }
  return null;
}
Program: 127907
Project: 127907
Buggy source:
/** 
 * ggu Comment method "isLinkCDCNode". for cdc
 */
private boolean isLinkCDCNode(RepositoryNode node){
  if (node != null) {
    if (ENodeType.STABLE_SYSTEM_FOLDER.equals(node.getType())) {
      if (node.getParent() != null) {
        RepositoryNode pNode=node.getParent().getParent();
        if (pNode != null) {
          ERepositoryObjectType nodeType=(ERepositoryObjectType)pNode.getProperties(EProperties.CONTENT_TYPE);
          if (ERepositoryObjectType.METADATA_CONNECTIONS.equals(nodeType) && pNode.getObject() != null && pNode.getObject().getProperty().getItem() instanceof DatabaseConnectionItem) {
            DatabaseConnection connection=(DatabaseConnection)((DatabaseConnectionItem)pNode.getObject().getProperty().getItem()).getConnection();
            if (connection != null) {
              CDCConnection cdcConns=connection.getCdcConns();
              return cdcConns != null;
            }
          }
        }
      }
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * ggu Comment method "isLinkCDCNode". for cdc
 */
private boolean isLinkCDCNode(RepositoryNode node){
  if (node != null) {
    if (ENodeType.STABLE_SYSTEM_FOLDER.equals(node.getType())) {
      if (node.getParent() != null) {
        RepositoryNode pNode=node.getParent().getParent();
        if (pNode != null) {
          ERepositoryObjectType nodeType=(ERepositoryObjectType)pNode.getProperties(EProperties.CONTENT_TYPE);
          if (nodeType.equals(ERepositoryObjectType.METADATA_CONNECTIONS) && pNode.getObject() != null && pNode.getObject().getProperty().getItem() instanceof DatabaseConnectionItem) {
            DatabaseConnection connection=(DatabaseConnection)((DatabaseConnectionItem)pNode.getObject().getProperty().getItem()).getConnection();
            if (connection != null) {
              CDCConnection cdcConns=connection.getCdcConns();
              return cdcConns != null;
            }
          }
        }
      }
    }
  }
  return false;
}
Program: 127908
Project: 127908
Buggy source:
@Override protected void init(RepositoryNode node){
  ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
  if (!ERepositoryObjectType.METADATA_FILE_DELIMITED.equals(nodeType)) {
    return;
  }
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
switch (node.getType()) {
case SIMPLE_FOLDER:
    if (node.getObject() != null && node.getObject().getProperty().getItem().getState().isDeleted()) {
      setEnabled(false);
      return;
    }
case SYSTEM_FOLDER:
  if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(node)) {
    setEnabled(false);
    return;
  }
this.setText(CREATE_LABEL);
collectChildNames(node);
this.setImageDescriptor(createImage);
creation=true;
break;
case REPOSITORY_ELEMENT:
if (factory.isPotentiallyEditable(node.getObject())) {
this.setText(EDIT_LABEL);
this.setImageDescriptor(defaultImage);
collectSiblingNames(node);
}
 else {
this.setText(OPEN_LABEL);
this.setImageDescriptor(defaultImage);
}
collectSiblingNames(node);
creation=false;
break;
default :
return;
}
setEnabled(true);
}

Fixed version (ground truth):
@Override protected void init(RepositoryNode node){
  ERepositoryObjectType nodeType=(ERepositoryObjectType)node.getProperties(EProperties.CONTENT_TYPE);
  if (ERepositoryObjectType.METADATA_FILE_DELIMITED != null && !ERepositoryObjectType.METADATA_FILE_DELIMITED.equals(nodeType)) {
    return;
  }
  IProxyRepositoryFactory factory=ProxyRepositoryFactory.getInstance();
switch (node.getType()) {
case SIMPLE_FOLDER:
    if (node.getObject() != null && node.getObject().getProperty().getItem().getState().isDeleted()) {
      setEnabled(false);
      return;
    }
case SYSTEM_FOLDER:
  if (factory.isUserReadOnlyOnCurrentProject() || !ProjectManager.getInstance().isInCurrentMainProject(node)) {
    setEnabled(false);
    return;
  }
this.setText(CREATE_LABEL);
collectChildNames(node);
this.setImageDescriptor(createImage);
creation=true;
break;
case REPOSITORY_ELEMENT:
if (factory.isPotentiallyEditable(node.getObject())) {
this.setText(EDIT_LABEL);
this.setImageDescriptor(defaultImage);
collectSiblingNames(node);
}
 else {
this.setText(OPEN_LABEL);
this.setImageDescriptor(defaultImage);
}
collectSiblingNames(node);
creation=false;
break;
default :
return;
}
setEnabled(true);
}
Program: 127910
Project: 127910
Buggy source:
@Override public boolean isDeleted(){
  return repObj.isDeleted();
}

Fixed version (ground truth):
@Override public boolean isDeleted(){
  return SubItemHelper.isDeleted(query);
}
Program: 127912
Project: 127912
Buggy source:
@Override public boolean isDeleted(){
  return repObj.isDeleted();
}

Fixed version (ground truth):
@Override public boolean isDeleted(){
  return SubItemHelper.isDeleted(query);
}
Program: 127914
Project: 127914
Buggy source:
/** 
 * DOC ycbai Comment method "invokeMethod". Returns the value of a method.
 * @param owner
 * @param methodName
 * @param args
 * @param argTypes
 * @return
 * @throws NoSuchMethodException
 * @throws SecurityException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws IllegalArgumentException
 */
public static Object invokeMethod(Object owner,String methodName,Object[] args,Class... argTypes) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
  Object returnValue=null;
  Class ownerClass=owner.getClass();
  Class[] argsClass=new Class[args.length];
  if (argTypes != null && argTypes.length == args.length) {
    argsClass=argTypes;
  }
 else {
    for (int i=0, j=args.length; i < j; i++) {
      argsClass[i]=args[i].getClass();
    }
  }
  Method method=ownerClass.getMethod(methodName,argsClass);
  method.setAccessible(true);
  returnValue=method.invoke(owner,args);
  return returnValue;
}

Fixed version (ground truth):
/** 
 * DOC ycbai Comment method "invokeMethod". Returns the value of a method.
 * @param owner
 * @param methodName
 * @param args
 * @param argTypes
 * @return
 * @throws NoSuchMethodException
 * @throws SecurityException
 * @throws InvocationTargetException
 * @throws IllegalAccessException
 * @throws IllegalArgumentException
 */
public static Object invokeMethod(Object owner,String methodName,Object[] args,Class... argTypes) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
  Object returnValue=null;
  Class ownerClass=owner.getClass();
  Class[] argsClass=new Class[args.length];
  if (argTypes.length > 0 && argTypes.length == args.length) {
    argsClass=argTypes;
  }
 else {
    for (int i=0, j=args.length; i < j; i++) {
      argsClass[i]=args[i].getClass();
    }
  }
  Method method=ownerClass.getMethod(methodName,argsClass);
  method.setAccessible(true);
  returnValue=method.invoke(owner,args);
  return returnValue;
}
Program: 127915
Project: 127915
Buggy source:
/** 
 * DOC xqliu Comment method "addTypesToSql".
 * @param sql
 * @param types
 * @param and
 * @return
 */
private String addTypesToSql(String sql,String[] types,String and){
  String result=sql;
  boolean checkContainTable=checkContainTable(types);
  String typeClause="String_Node_Str";
  if (checkContainTable && types.length > 1) {
    typeClause+="String_Node_Str";
  }
  if (types != null && types.length > 0) {
    typeClause+="String_Node_Str";
    int len=types.length;
    String comma="String_Node_Str";
    for (int i=0; i < len; ++i) {
      if (TABLE.equals(types[i])) {
        continue;
      }
      typeClause=typeClause + comma + "String_Node_Str"+ getDb2zosTypeName(types[i])+ "String_Node_Str";
      comma="String_Node_Str";
    }
    if (checkContainTable && types.length == 1) {
      typeClause=typeClause + "String_Node_Str" + getDb2zosTypeName(types[0])+ "String_Node_Str"+ "String_Node_Str";
    }
 else {
      typeClause=typeClause + "String_Node_Str";
    }
    result=sql + and + typeClause;
    if (checkContainTable && types.length > 1) {
      result=result + "String_Node_Str";
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "addTypesToSql".
 * @param sql
 * @param types
 * @param and
 * @return
 */
private String addTypesToSql(String sql,String[] types,String and){
  String result=sql;
  if (types != null && types.length > 0) {
    String typeClause="String_Node_Str";
    int len=types.length;
    for (int i=0; i < len; ++i) {
      String comma="String_Node_Str";
      if (i > 0) {
        comma="String_Node_Str";
      }
      typeClause=typeClause + comma + "String_Node_Str"+ getDb2zosTypeName(types[i])+ "String_Node_Str";
    }
    typeClause=typeClause + "String_Node_Str";
    result=sql + and + typeClause;
  }
  return result;
}
Program: 127916
Project: 127916
Buggy source:
public static String getHive1EmbeddedURLString(DatabaseConnection dbConn,boolean supportContext){
  return EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE_EMBEDDED);
}

Fixed version (ground truth):
private static String getHive1EmbeddedURLString(){
  return EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE_EMBEDDED);
}
Program: 127917
Project: 127917
Buggy source:
private static String searchGoodRegex(String currentDbType,String dbVersion,String stringConnection){
  String startStringConnection;
  String startTemplateString;
  EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersion(dbVersion);
  for (  EDatabaseConnTemplate template : EDatabaseConnTemplate.values()) {
    String urlTemplate=template.getUrlTemplate(version);
    startTemplateString=urlTemplate.substring(0,urlTemplate.indexOf("String_Node_Str"));
    if (startTemplateString.length() <= stringConnection.length()) {
      startStringConnection=stringConnection.substring(0,startTemplateString.length());
      if (stringConnection.contains("String_Node_Str")) {
        return EDatabaseConnTemplate.ORACLESN.getDBDisplayName();
      }
 else       if (!startTemplateString.equals("String_Node_Str") && startTemplateString.equals(startStringConnection)) {
        return template.getDBDisplayName();
      }
    }
  }
  return currentDbType;
}

Fixed version (ground truth):
private static String searchGoodRegex(String currentDbType,String dbVersion,String stringConnection){
  String startStringConnection;
  String startTemplateString;
  EDatabaseVersion4Drivers version=EDatabaseVersion4Drivers.indexOfByVersion(dbVersion);
  for (  EDatabaseConnTemplate template : EDatabaseConnTemplate.values()) {
    String urlTemplate=template.getUrlTemplate(version);
    if (urlTemplate.indexOf("String_Node_Str") != -1) {
      startTemplateString=urlTemplate.substring(0,urlTemplate.indexOf("String_Node_Str"));
      if (startTemplateString.length() <= stringConnection.length()) {
        startStringConnection=stringConnection.substring(0,startTemplateString.length());
        if (stringConnection.contains("String_Node_Str")) {
          return EDatabaseConnTemplate.ORACLESN.getDBDisplayName();
        }
 else         if (!startTemplateString.equals("String_Node_Str") && startTemplateString.equals(startStringConnection)) {
          return template.getDBDisplayName();
        }
      }
    }
  }
  return currentDbType;
}
Program: 127918
Project: 127918
Buggy source:
public static String getHive2StandaloneURLString(DatabaseConnection dbConn,boolean supportContext){
  String s=EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE_2_STANDALONE);
  if (s != null) {
    if (supportContext) {
      s=TalendQuoteUtils.addQuotes(s);
    }
    s=getStringReplace(s,EDatabaseConnVar.LOGIN.getVariable(),dbConn.getUsername(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.PASSWORD.getVariable(),dbConn.getPassword(),supportContext,true);
    s=getStringReplace(s,EDatabaseConnVar.HOST.getVariable(),dbConn.getServerName(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.PORT.getVariable(),dbConn.getPort(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.SID.getVariable(),dbConn.getSID(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.SERVICE_NAME.getVariable(),dbConn.getSID(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.DATASOURCE.getVariable(),dbConn.getDatasourceName(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.FILENAME.getVariable(),dbConn.getFileFieldName(),supportContext);
  }
  return s;
}

Fixed version (ground truth):
private static String getHive2StandaloneURLString(boolean supportContext,String server,String port,String sid){
  String s=EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE_2_STANDALONE);
  return getHiveStandaloneURlString(s,supportContext,server,port,sid);
}
Program: 127919
Project: 127919
Buggy source:
public static String getHive2EmbeddedURLString(DatabaseConnection dbConn,boolean supportContext){
  return EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE_2_EMBEDDED);
}

Fixed version (ground truth):
private static String getHive2EmbeddedURLString(){
  return EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE_2_EMBEDDED);
}
Program: 127920
Project: 127920
Buggy source:
public static String getHive1StandaloneURLString(DatabaseConnection dbConn,boolean supportContext){
  String s=EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE);
  if (s != null) {
    if (supportContext) {
      s=TalendQuoteUtils.addQuotes(s);
    }
    s=getStringReplace(s,EDatabaseConnVar.LOGIN.getVariable(),dbConn.getUsername(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.PASSWORD.getVariable(),dbConn.getPassword(),supportContext,true);
    s=getStringReplace(s,EDatabaseConnVar.HOST.getVariable(),dbConn.getServerName(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.PORT.getVariable(),dbConn.getPort(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.SID.getVariable(),dbConn.getSID(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.SERVICE_NAME.getVariable(),dbConn.getSID(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.DATASOURCE.getVariable(),dbConn.getDatasourceName(),supportContext);
    s=getStringReplace(s,EDatabaseConnVar.FILENAME.getVariable(),dbConn.getFileFieldName(),supportContext);
  }
  return s;
}

Fixed version (ground truth):
private static String getHive1StandaloneURLString(boolean supportContext,String server,String port,String sid){
  String s=EDatabaseConnTemplate.HIVE.getUrlTemplate(EDatabaseVersion4Drivers.HIVE);
  return getHiveStandaloneURlString(s,supportContext,server,port,sid);
}
Program: 127921
Project: 127921
Buggy source:
@Override String getUrlTemplate(EDatabaseVersion4Drivers version){
switch (version) {
case HIVE:
    return URL_HIVE_1_STANDALONE;
case HIVE_EMBEDDED:
  return URL_HIVE_1_EMBEDDED;
case HIVE_2_EMBEDDED:
return URL_HIVE_2_EMBEDDED;
case HIVE_2_STANDALONE:
return URL_HIVE_2_STANDALONE;
default :
return super.getUrlTemplate(version);
}
}

Fixed version (ground truth):
@Override String getUrlTemplate(EDatabaseVersion4Drivers version){
switch (version) {
case HIVE:
    return URL_HIVE_1_STANDALONE;
case HIVE_EMBEDDED:
  return URL_HIVE_1_TEMPLATE;
case HIVE_2_EMBEDDED:
return URL_HIVE_2_TEMPLATE;
case HIVE_2_STANDALONE:
return URL_HIVE_2_STANDALONE;
default :
return super.getUrlTemplate(version);
}
}
Program: 127922
Project: 127922
Buggy source:
@Override String getUrlPattern(EDatabaseVersion4Drivers version){
switch (version) {
case HIVE:
    return calcPattern(URL_HIVE_1_STANDALONE);
case HIVE_EMBEDDED:
  return calcPattern(URL_HIVE_1_EMBEDDED);
case HIVE_2_EMBEDDED:
return calcPattern(URL_HIVE_2_EMBEDDED);
case HIVE_2_STANDALONE:
return calcPattern(URL_HIVE_2_STANDALONE);
default :
return super.getUrlPattern(version);
}
}

Fixed version (ground truth):
@Override String getUrlPattern(EDatabaseVersion4Drivers version){
switch (version) {
case HIVE:
    return calcPattern(URL_HIVE_1_STANDALONE);
case HIVE_EMBEDDED:
  return calcPattern(URL_HIVE_1_TEMPLATE);
case HIVE_2_EMBEDDED:
return calcPattern(URL_HIVE_2_TEMPLATE);
case HIVE_2_STANDALONE:
return calcPattern(URL_HIVE_2_STANDALONE);
default :
return super.getUrlPattern(version);
}
}
Program: 127932
Project: 127932
Buggy source:
/** 
 * DOC xqliu Comment method "addTypesToSql".
 * @param sql
 * @param types
 * @param and
 * @return
 */
private String addTypesToSql(String sql,String[] types,String and){
  String result=sql;
  boolean checkContainTable=checkContainTable(types);
  String typeClause="String_Node_Str";
  if (checkContainTable && types.length > 1) {
    typeClause+="String_Node_Str";
  }
  if (types != null && types.length > 0) {
    typeClause+="String_Node_Str";
    int len=types.length;
    String comma="String_Node_Str";
    for (int i=0; i < len; ++i) {
      if (TABLE.equals(types[i])) {
        continue;
      }
      typeClause=typeClause + comma + "String_Node_Str"+ getDb2zosTypeName(types[i])+ "String_Node_Str";
      comma="String_Node_Str";
    }
    if (checkContainTable && types.length == 1) {
      typeClause=typeClause + "String_Node_Str" + getDb2zosTypeName(types[0])+ "String_Node_Str"+ "String_Node_Str";
    }
 else {
      typeClause=typeClause + "String_Node_Str";
    }
    result=sql + and + typeClause;
    if (checkContainTable && types.length > 1) {
      result=result + "String_Node_Str";
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * DOC xqliu Comment method "addTypesToSql".
 * @param sql
 * @param types
 * @param and
 * @return
 */
private String addTypesToSql(String sql,String[] types,String and){
  String result=sql;
  if (types != null && types.length > 0) {
    String typeClause="String_Node_Str";
    int len=types.length;
    for (int i=0; i < len; ++i) {
      String comma="String_Node_Str";
      if (i > 0) {
        comma="String_Node_Str";
      }
      typeClause=typeClause + comma + "String_Node_Str"+ getDb2zosTypeName(types[i])+ "String_Node_Str";
    }
    typeClause=typeClause + "String_Node_Str";
    result=sql + and + typeClause;
  }
  return result;
}
Program: 127933
Project: 127933
Buggy source:
public static boolean addSchemas(Collection<Schema> schemas,Catalog catalog){
  return addPackages(schemas,catalog);
}

Fixed version (ground truth):
public static boolean addSchemas(Schema schema,Catalog catalog){
  return addPackage(schema,catalog);
}
Program: 127934
Project: 127934
Buggy source:
public void validateRegistration(){
  if (registNumber == null) {
    return;
  }
  URL registURL=null;
  try {
    IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    registURL=new URL("String_Node_Str" + DefaultTokenCollector.calcUniqueId() + "String_Node_Str"+ brandingService.getAcronym());
    PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(registURL);
  }
 catch (  PartInitException e) {
    try {
      Runtime.getRuntime().exec("String_Node_Str" + registURL.toString());
    }
 catch (    IOException e2) {
      if (PlatformUI.getWorkbench().getBrowserSupport().isInternalWebBrowserAvailable()) {
        IWebBrowser browser;
        try {
          browser=PlatformUI.getWorkbench().getBrowserSupport().createBrowser("String_Node_Str");
          browser.openURL(registURL);
        }
 catch (        PartInitException e1) {
          ExceptionHandler.process(e);
        }
      }
 else {
        ExceptionHandler.process(e);
      }
    }
  }
catch (  MalformedURLException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
public void validateRegistration(){
  if (registNumber == null) {
    return;
  }
  URL registURL=null;
  try {
    IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    String uniqueId=DefaultTokenCollector.calcUniqueId();
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    uniqueId=uniqueId.replace("String_Node_Str","String_Node_Str");
    registURL=new URL("String_Node_Str" + uniqueId + "String_Node_Str"+ brandingService.getAcronym());
    PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(registURL);
  }
 catch (  PartInitException e) {
    try {
      Runtime.getRuntime().exec("String_Node_Str" + registURL.toString());
    }
 catch (    IOException e2) {
      if (PlatformUI.getWorkbench().getBrowserSupport().isInternalWebBrowserAvailable()) {
        IWebBrowser browser;
        try {
          browser=PlatformUI.getWorkbench().getBrowserSupport().createBrowser("String_Node_Str");
          browser.openURL(registURL);
        }
 catch (        PartInitException e1) {
          ExceptionHandler.process(e);
        }
      }
 else {
        ExceptionHandler.process(e);
      }
    }
  }
catch (  MalformedURLException e) {
    ExceptionHandler.process(e);
  }
}
Program: 127937
Project: 127937
Buggy source:
protected void createOnlinePage(Document dom,Element parent){
  HttpURLConnection urlConnection=null;
  try {
    URL url=new URL(getOnlinePageURL());
    urlConnection=(HttpURLConnection)url.openConnection();
    urlConnection.setRequestMethod("String_Node_Str");
    urlConnection.setDoOutput(true);
    urlConnection.setDoInput(true);
    urlConnection.setUseCaches(false);
    urlConnection.setReadTimeout(1000);
    urlConnection.getInputStream();
    setDIVStyle(dom,true);
  }
 catch (  Exception e) {
    setDIVStyle(dom,false);
    return;
  }
 finally {
    urlConnection.disconnect();
  }
  Element tdElem=dom.createElement("String_Node_Str");
  setTDAttribute(tdElem);
  parent.appendChild(tdElem);
  Element div=dom.createElement("String_Node_Str");
  div.setAttribute("String_Node_Str","String_Node_Str");
  tdElem.appendChild(div);
  Element spanElem=dom.createElement("String_Node_Str");
  spanElem.setAttribute("String_Node_Str","String_Node_Str");
  spanElem.appendChild(dom.createTextNode(Messages.getString("String_Node_Str")));
  div.appendChild(spanElem);
  div.appendChild(dom.createElement("String_Node_Str"));
  Element iFrame=dom.createElement("String_Node_Str");
  iFrame.setAttribute("String_Node_Str",getOnlinePageURL());
  iFrame.setAttribute("String_Node_Str","String_Node_Str");
  iFrame.setAttribute("String_Node_Str","String_Node_Str");
  iFrame.setAttribute("String_Node_Str","String_Node_Str");
  iFrame.appendChild(dom.createTextNode("String_Node_Str"));
  div.appendChild(iFrame);
}

Fixed version (ground truth):
protected void createOnlinePage(Document dom,Element parent){
  HttpURLConnection urlConnection=null;
  try {
    URL url=new URL(getOnlinePageURL());
    urlConnection=(HttpURLConnection)url.openConnection();
    urlConnection.setRequestMethod("String_Node_Str");
    urlConnection.setDoOutput(true);
    urlConnection.setDoInput(true);
    urlConnection.setUseCaches(false);
    urlConnection.setReadTimeout(2000);
    urlConnection.getInputStream();
    setDIVStyle(dom,true);
  }
 catch (  Exception e) {
    setDIVStyle(dom,false);
    return;
  }
 finally {
    urlConnection.disconnect();
  }
  Element tdElem=dom.createElement("String_Node_Str");
  setTDAttribute(tdElem);
  parent.appendChild(tdElem);
  Element div=dom.createElement("String_Node_Str");
  div.setAttribute("String_Node_Str","String_Node_Str");
  tdElem.appendChild(div);
  Element spanElem=dom.createElement("String_Node_Str");
  spanElem.setAttribute("String_Node_Str","String_Node_Str");
  spanElem.appendChild(dom.createTextNode(Messages.getString("String_Node_Str")));
  div.appendChild(spanElem);
  div.appendChild(dom.createElement("String_Node_Str"));
  Element iFrame=dom.createElement("String_Node_Str");
  iFrame.setAttribute("String_Node_Str",getOnlinePageURL());
  iFrame.setAttribute("String_Node_Str","String_Node_Str");
  iFrame.setAttribute("String_Node_Str","String_Node_Str");
  iFrame.setAttribute("String_Node_Str","String_Node_Str");
  iFrame.appendChild(dom.createTextNode("String_Node_Str"));
  div.appendChild(iFrame);
}
Program: 127943
Project: 127943
Buggy source:
@Override public void initialize(IWorkbenchConfigurer configurer){
  super.initialize(configurer);
  configurer.setSaveAndRestore(true);
  PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT,true);
  PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,false);
  PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,IWorkbenchPreferenceConstants.TOP_RIGHT);
}

Fixed version (ground truth):
@Override public void initialize(IWorkbenchConfigurer configurer){
  super.initialize(configurer);
  configurer.setSaveAndRestore(true);
  TrayDialog.setDialogHelpAvailable(false);
  PlatformUI.getPreferenceStore().setValue(IWorkbenchPreferenceConstants.CLOSE_EDITORS_ON_EXIT,true);
  PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS,false);
  PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.DOCK_PERSPECTIVE_BAR,IWorkbenchPreferenceConstants.TOP_RIGHT);
}
Program: 127946
Project: 127946
Buggy source:
public static boolean isBrandingChanged(){
  if (!initialized) {
    if (CommonUIPlugin.isFullyHeadless()) {
      isBrandingChanged=false;
    }
 else {
      IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
      if (brandingService instanceof AbstractBrandingService) {
        isBrandingChanged=false;
      }
 else {
        final String fullProductName=brandingService.getFullProductName();
        Display display=Display.getDefault();
        if (display == null) {
          display=Display.getCurrent();
        }
        display.syncExec(new Runnable(){
          @Override public void run(){
            IPreferenceStore preferenceStore=CoreRuntimePlugin.getInstance().getPreferenceStore();
            String oldBrandingName=preferenceStore.getString(LAST_STARTED_PRODUCT);
            if (oldBrandingName == null || oldBrandingName.equals("String_Node_Str") || !oldBrandingName.equals(fullProductName)) {
              isBrandingChanged=true;
              preferenceStore.setValue(LAST_STARTED_PRODUCT,fullProductName);
            }
          }
        }
);
      }
    }
    initialized=true;
  }
  return isBrandingChanged;
}

Fixed version (ground truth):
public static boolean isBrandingChanged(){
  if (!initialized) {
    if (CommonUIPlugin.isFullyHeadless()) {
      isBrandingChanged=false;
    }
 else {
      IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
      final String fullProductName=brandingService.getFullProductName();
      Display display=Display.getDefault();
      if (display == null) {
        display=Display.getCurrent();
      }
      display.syncExec(new Runnable(){
        @Override public void run(){
          IPreferenceStore preferenceStore=CoreRuntimePlugin.getInstance().getPreferenceStore();
          String oldBrandingName=preferenceStore.getString(LAST_STARTED_PRODUCT);
          if (oldBrandingName == null || oldBrandingName.equals("String_Node_Str") || !oldBrandingName.equals(fullProductName)) {
            isBrandingChanged=true;
            preferenceStore.setValue(LAST_STARTED_PRODUCT,fullProductName);
          }
        }
      }
);
    }
    initialized=true;
  }
  return isBrandingChanged;
}
Program: 127950
Project: 127950
Buggy source:
public void validateRegistration(){
  if (registNumber == null) {
    return;
  }
  URL registURL=null;
  try {
    IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    registURL=new URL("String_Node_Str" + brandingService.getAcronym() + "String_Node_Str"+ registNumber);
    PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(registURL);
  }
 catch (  PartInitException e) {
    try {
      Runtime.getRuntime().exec("String_Node_Str" + registURL.toString());
    }
 catch (    IOException e2) {
      if (PlatformUI.getWorkbench().getBrowserSupport().isInternalWebBrowserAvailable()) {
        IWebBrowser browser;
        try {
          browser=PlatformUI.getWorkbench().getBrowserSupport().createBrowser("String_Node_Str");
          browser.openURL(registURL);
        }
 catch (        PartInitException e1) {
          ExceptionHandler.process(e);
        }
      }
 else {
        ExceptionHandler.process(e);
      }
    }
  }
catch (  MalformedURLException e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
public void validateRegistration(){
  if (registNumber == null) {
    return;
  }
  URL registURL=null;
  try {
    IBrandingService brandingService=(IBrandingService)GlobalServiceRegister.getDefault().getService(IBrandingService.class);
    registURL=new URL("String_Node_Str" + DefaultTokenCollector.calcUniqueId() + "String_Node_Str"+ brandingService.getAcronym());
    PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(registURL);
  }
 catch (  PartInitException e) {
    try {
      Runtime.getRuntime().exec("String_Node_Str" + registURL.toString());
    }
 catch (    IOException e2) {
      if (PlatformUI.getWorkbench().getBrowserSupport().isInternalWebBrowserAvailable()) {
        IWebBrowser browser;
        try {
          browser=PlatformUI.getWorkbench().getBrowserSupport().createBrowser("String_Node_Str");
          browser.openURL(registURL);
        }
 catch (        PartInitException e1) {
          ExceptionHandler.process(e);
        }
      }
 else {
        ExceptionHandler.process(e);
      }
    }
  }
catch (  MalformedURLException e) {
    ExceptionHandler.process(e);
  }
}
Program: 127956
Project: 127956
Buggy source:
@Override protected void createBottomPart(Composite parent){
  convertBtn=new Button(parent,SWT.PUSH);
  convertBtn.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.swtDefaults().span(2,1).align(SWT.CENTER,SWT.CENTER).grab(false,false).applyTo(convertBtn);
  convertBtn.setEnabled(!isReadOnly());
}

Fixed version (ground truth):
@Override protected void createBottomPart(Composite parent){
  convertBtn=new Button(parent,SWT.PUSH);
  convertBtn.setText(Messages.getString("String_Node_Str"));
  GridDataFactory.swtDefaults().span(2,1).align(SWT.CENTER,SWT.CENTER).grab(false,false).applyTo(convertBtn);
  convertBtn.setEnabled(!isReadOnly());
  convertBtn.setVisible(PluginChecker.isMapReducePluginLoader());
}
Program: 127957
Project: 127957
Buggy source:
public void getNotInstalledModules(String[] names,List<ModuleToInstall> toInstall,IModulesListener listener){
  StringBuffer jars=new StringBuffer();
  if (names != null && names.length > 0) {
    for (    String module : names) {
      String moduleName=module.trim();
      ModuleToInstall moduleToInstall=cache.get(moduleName);
      if (moduleToInstall != null) {
        moduleToInstall.setContext("String_Node_Str");
        toInstall.add(moduleToInstall);
      }
 else {
        if (jars.length() != 0) {
          jars.append(SEPARATOR);
        }
 else {
          jars.append(moduleName);
        }
      }
    }
  }
  String jarNames=jars.toString();
  if (jarNames.isEmpty()) {
    listener.listModulesDone();
    return;
  }
  getModuleUrlsFromWebService(jarNames,toInstall,null,listener,false);
}

Fixed version (ground truth):
public void getNotInstalledModules(String[] names,List<ModuleToInstall> toInstall,IModulesListener listener){
  StringBuffer jars=new StringBuffer();
  if (names != null && names.length > 0) {
    for (    String module : names) {
      String moduleName=module.trim();
      ModuleToInstall moduleToInstall=cache.get(moduleName);
      if (moduleToInstall != null) {
        moduleToInstall.setContext("String_Node_Str");
        toInstall.add(moduleToInstall);
      }
 else {
        if (jars.length() != 0) {
          jars.append(SEPARATOR);
          jars.append(moduleName);
        }
 else {
          jars.append(moduleName);
        }
      }
    }
  }
  String jarNames=jars.toString();
  if (jarNames.isEmpty()) {
    listener.listModulesDone();
    return;
  }
  getModuleUrlsFromWebService(jarNames,toInstall,null,listener,false);
}
Program: 127958
Project: 127958
Buggy source:
private void initializeByConnectionParameters(){
  DatabaseConnection connection=getConnection();
  EMap<String,String> parameters=connection.getParameters();
  if (connection.getDatabaseType() == null) {
    connection.setDatabaseType(parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_TYPE));
  }
  if (connection.getProductId() == null) {
    connection.setProductId(parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_PRODUCT));
  }
  if (connection.getServerName() == null) {
    connection.setServerName(parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_SERVER));
  }
  if (connection.getPort() == null) {
    connection.setPort(parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_PORT));
  }
}

Fixed version (ground truth):
private void initializeByConnectionParameters(){
  DatabaseConnection connection=getConnection();
  EMap<String,String> parameters=connection.getParameters();
  if (connection.getDatabaseType() == null) {
    connection.setDatabaseType(parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_TYPE));
  }
  String productId=connection.getProductId();
  if (productId == null) {
    connection.setProductId(productId=parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_PRODUCT));
    String mapping=null;
    if (productId == null || productId.equals(EDatabaseConnTemplate.GENERAL_JDBC.getDBDisplayName())) {
      mapping=generalMappingFileText.getText();
    }
 else {
      if (MetadataTalendType.getDefaultDbmsFromProduct(productId) != null) {
        mapping=MetadataTalendType.getDefaultDbmsFromProduct(productId).getId();
      }
    }
    if (mapping == null) {
      mapping="String_Node_Str";
    }
    connection.setDbmsId(mapping);
  }
  if (connection.getServerName() == null) {
    connection.setServerName(parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_SERVER));
  }
  if (connection.getPort() == null) {
    connection.setPort(parameters.get(ConnParameterKeys.CONN_PARA_KEY_DB_PORT));
  }
}