nus-yam/ex-repair huggingface dataset:
Program: 137392
Project: 137392
Buggy source:
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the valid Value of select column
 */
public String getValidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString) + functionReturnValue;
  return getValuesStatement(columnName,regexCmp);
}

Fixed version (ground truth):
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the valid Value of select column
 */
public String getValidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regularFunctionBodyWithReturnValue(columnName,regexPatternString);
  return getValuesStatement(columnName,regexCmp);
}
Program: 137393
Project: 137393
Buggy source:
public boolean isImplementRegexFunction(String menuLabel){
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  if (menuLabel.equals(MENU_VIEW_ROWS) || menuLabel.equals(MENU_VIEW_VALID_VALUES)) {
    if (dbmsLanguage.regexLike(columnName,regexPatternString) != null) {
      return true;
    }
  }
 else   if (menuLabel.equals(DataExplorer.MENU_VIEW_INVALID_ROWS) || menuLabel.equals(MENU_VIEW_INVALID_VALUES)) {
    if (dbmsLanguage.regexNotLike(columnName,regexPatternString) != null) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isImplementRegexFunction(String menuLabel){
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  if (menuLabel.equals(MENU_VIEW_ROWS) || menuLabel.equals(MENU_VIEW_VALID_VALUES)) {
    if (dbmsLanguage.regularFunctionBody(columnName,regexPatternString) != null) {
      return true;
    }
  }
 else   if (menuLabel.equals(DataExplorer.MENU_VIEW_INVALID_ROWS) || menuLabel.equals(MENU_VIEW_INVALID_VALUES)) {
    if (dbmsLanguage.notRegularFunctionBody(columnName,regexPatternString) != null) {
      return true;
    }
  }
  return false;
}
Program: 137394
Project: 137394
Buggy source:
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the invalid Value of select column
 */
public String getInvalidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString) + functionReturnValue;
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getValuesStatement(columnName,pattCondStr);
}

Fixed version (ground truth):
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the invalid Value of select column
 */
public String getInvalidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.notRegularFunctionBodyWithReturnValue(columnName,regexPatternString);
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getValuesStatement(columnName,pattCondStr);
}
Program: 137395
Project: 137395
Buggy source:
@Override protected String getInstantiatedClause(){
  String function=getFunction();
  if (function != null && (DbmsLanguageFactory.isInfomix(this.dbmsLanguage.getDbmsName()) || DbmsLanguageFactory.isOracle(this.dbmsLanguage.getDbmsName()))) {
    function=columnName;
  }
  String clause=entity.isLabelNull() || function == null ? columnName + dbmsLanguage.isNull() : SOUNDEX_PREFIX + "String_Node_Str" + function+ "String_Node_Str"+ dbmsLanguage.equal()+ SOUNDEX_PREFIX+ "String_Node_Str"+ entity.getKey()+ "String_Node_Str";
  return clause;
}

Fixed version (ground truth):
@Override protected String getInstantiatedClause(){
  String function=getFunction();
  if (function != null && (DbmsLanguageFactory.isInfomix(this.dbmsLanguage.getDbmsName()) || DbmsLanguageFactory.isOracle(this.dbmsLanguage.getDbmsName()))) {
    function=columnName;
  }
  String clause=entity.isLabelNull() || function == null ? columnName + dbmsLanguage.isNull() : dbmsLanguage.getSoundexPrefix() + "String_Node_Str" + function+ "String_Node_Str"+ dbmsLanguage.equal()+ dbmsLanguage.getSoundexPrefix()+ "String_Node_Str"+ entity.getKey()+ "String_Node_Str";
  return clause;
}
Program: 137396
Project: 137396
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.dbms.MySQLDbmsLanguage#regexLike(java.lang.String,java.lang.String)}.
 */
@Test public void testRegexLike(){
  String regexLike=mySQLDbmsLanguage.regexLike(REGEXP_1,REGEXP_2);
  Assert.assertNotNull(regexLike);
  Assert.assertEquals(regexLike,SPACE + REGEXP_1 + "String_Node_Str"+ REGEXP_2+ SPACE);
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.dbms.MySQLDbmsLanguage#regexLike(java.lang.String,java.lang.String)}.
 */
@Test public void testRegexLike(){
  String regexLike=mySQLDbmsLanguage.regexLike(REGEXP_1,REGEXP_2);
  Assert.assertNotNull(regexLike);
  Assert.assertEquals(SPACE + REGEXP_1 + "String_Node_Str"+ REGEXP_2+ SPACE,regexLike);
}
Program: 137397
Project: 137397
Buggy source:
/** 
 * Test method for   {@link org.talend.dq.dbms.MySQLDbmsLanguage#regexNotLike(java.lang.String,java.lang.String)}.
 */
@Test public void testRegexNotLike(){
  String regexLike=mySQLDbmsLanguage.regexNotLike(REGEXP_1,REGEXP_2);
  Assert.assertNotNull(regexLike);
  Assert.assertEquals(regexLike,SPACE + REGEXP_1 + "String_Node_Str"+ REGEXP_2+ SPACE);
}

Fixed version (ground truth):
/** 
 * Test method for   {@link org.talend.dq.dbms.MySQLDbmsLanguage#regexNotLike(java.lang.String,java.lang.String)}.
 */
@Test public void testRegexNotLike(){
  String regexLike=mySQLDbmsLanguage.regexNotLike(REGEXP_1,REGEXP_2);
  Assert.assertNotNull(regexLike);
  Assert.assertEquals(SPACE + REGEXP_1 + "String_Node_Str"+ REGEXP_2+ SPACE,regexLike);
}
Program: 137399
Project: 137399
Buggy source:
/** 
 * get the Valid Rows Statement.
 * @return
 */
public String getValidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regularFunctionBodyWithReturnValue(columnName,regexPatternString);
  return getRowsStatement(regexCmp);
}

Fixed version (ground truth):
/** 
 * get the Valid Rows Statement.
 * @return
 */
public String getValidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  return getRowsStatement(regexCmp);
}
Program: 137400
Project: 137400
Buggy source:
/** 
 * get the Invalid Rows Statement.
 * @return
 */
public String getInvalidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.notRegularFunctionBodyWithReturnValue(columnName,regexPatternString);
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getRowsStatement(pattCondStr);
}

Fixed version (ground truth):
/** 
 * get the Invalid Rows Statement.
 * @return
 */
public String getInvalidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getRowsStatement(pattCondStr);
}
Program: 137401
Project: 137401
Buggy source:
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
  if (ColumnsetPackage.eINSTANCE.getAllMatchIndicator().isSuperTypeOf(indicator.eClass())) {
    return map;
  }
  boolean isSqlEngine=ExecutionLanguage.SQL.equals(this.analysis.getParameters().getExecutionLanguage());
  EList<Expression> instantiatedExpressions=this.indicator.getInstantiatedExpressions();
  if (instantiatedExpressions.size() > 0) {
    Expression expression=instantiatedExpressions.get(0);
    String regularExpressionFunctionName=dbmsLanguage.extractRegularExpressionFunction(expression);
    dbmsLanguage.setRegularExpressionFunction(regularExpressionFunctionName);
  }
  map.put(MENU_VIEW_INVALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_INVALID_VALUES) + getInvalidValuesStatement() : null);
  map.put(MENU_VIEW_VALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_VALID_VALUES) + getValidValuesStatement() : null);
  map.put(MENU_VIEW_INVALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_INVALID_ROWS) + getInvalidRowsStatement() : null);
  map.put(MENU_VIEW_VALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_VALID_ROWS) + getValidRowsStatement() : null);
  return map;
}

Fixed version (ground truth):
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
  if (ColumnsetPackage.eINSTANCE.getAllMatchIndicator().isSuperTypeOf(indicator.eClass())) {
    return map;
  }
  boolean isSqlEngine=ExecutionLanguage.SQL.equals(this.analysis.getParameters().getExecutionLanguage());
  EList<Expression> instantiatedExpressions=this.indicator.getInstantiatedExpressions();
  if (instantiatedExpressions.size() > 0) {
    Expression expression=instantiatedExpressions.get(0);
    String regularExpressionFunctionName=dbmsLanguage.extractRegularExpressionFunction(expression);
    dbmsLanguage.setRegularExpressionFunction(regularExpressionFunctionName);
    dbmsLanguage.setFunctionReturnValue(expression);
  }
  map.put(MENU_VIEW_INVALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_INVALID_VALUES) + getInvalidValuesStatement() : null);
  map.put(MENU_VIEW_VALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_VALID_VALUES) + getValidValuesStatement() : null);
  map.put(MENU_VIEW_INVALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_INVALID_ROWS) + getInvalidRowsStatement() : null);
  map.put(MENU_VIEW_VALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_VALID_ROWS) + getValidRowsStatement() : null);
  return map;
}
Program: 137402
Project: 137402
Buggy source:
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the valid Value of select column
 */
public String getValidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regularFunctionBodyWithReturnValue(columnName,regexPatternString);
  return getValuesStatement(columnName,regexCmp);
}

Fixed version (ground truth):
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the valid Value of select column
 */
public String getValidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  return getValuesStatement(columnName,regexCmp);
}
Program: 137403
Project: 137403
Buggy source:
public boolean isImplementRegexFunction(String menuLabel){
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  if (menuLabel.equals(MENU_VIEW_VALID_ROWS) || menuLabel.equals(MENU_VIEW_VALID_VALUES)) {
    if (dbmsLanguage.regularFunctionBody(columnName,regexPatternString) != null) {
      return true;
    }
  }
 else   if (menuLabel.equals(DataExplorer.MENU_VIEW_INVALID_ROWS) || menuLabel.equals(MENU_VIEW_INVALID_VALUES)) {
    if (dbmsLanguage.notRegularFunctionBody(columnName,regexPatternString) != null) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean isImplementRegexFunction(String menuLabel){
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  if (menuLabel.equals(MENU_VIEW_VALID_ROWS) || menuLabel.equals(MENU_VIEW_VALID_VALUES)) {
    if (dbmsLanguage.regexLike(columnName,regexPatternString) != null) {
      return true;
    }
  }
 else   if (menuLabel.equals(DataExplorer.MENU_VIEW_INVALID_ROWS) || menuLabel.equals(MENU_VIEW_INVALID_VALUES)) {
    if (dbmsLanguage.regexNotLike(columnName,regexPatternString) != null) {
      return true;
    }
  }
  return false;
}
Program: 137404
Project: 137404
Buggy source:
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the invalid Value of select column
 */
public String getInvalidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.notRegularFunctionBodyWithReturnValue(columnName,regexPatternString);
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getValuesStatement(columnName,pattCondStr);
}

Fixed version (ground truth):
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the invalid Value of select column
 */
public String getInvalidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getValuesStatement(columnName,pattCondStr);
}
Program: 137405
Project: 137405
Buggy source:
/** 
 * get the body of not Regular function match
 * @param element
 * @param regex
 * @return
 * @deprecated use {@link #notRegularFunctionBody(String,String)} instead of it
 */
@Deprecated public String regexNotLike(String element,String regex){
  return notRegularFunctionBody(element,regex);
}

Fixed version (ground truth):
/** 
 * method "regexNotLike"
 * @param element
 * @param regex
 * @return get the String of Regular function which is not match(for example :"not regex_like(element,regex)")
 */
public String regexNotLike(String element,String regex){
  String functionNameSQL=regexLike(element,regex);
  if (functionNameSQL == null) {
    return null;
  }
  return this.not() + functionNameSQL;
}
Program: 137406
Project: 137406
Buggy source:
/** 
 * Method "getSelectRegexpTestString".
 * @param stringToCheck a string to check against the regular expression (can contain quotes at start and end)
 * @param regex a regular expression
 * @return the appropriate SQL SELECT statement that can be used to check a string against a regular expression.
 */
public String getSelectRegexpTestString(String stringToCheck,String regex){
  String surroundedTestString=(stringToCheck.startsWith("String_Node_Str") && stringToCheck.endsWith("String_Node_Str")) ? stringToCheck : surroundWith('\'',stringToCheck,'\'');
  String regexLikeExpression=regularFunctionBody(surroundedTestString,regex);
  if (regexLikeExpression == null) {
    return null;
  }
  return getSelectRegexp(regexLikeExpression);
}

Fixed version (ground truth):
/** 
 * Method "getSelectRegexpTestString".
 * @param stringToCheck a string to check against the regular expression (can contain quotes at start and end)
 * @param regex a regular expression
 * @return the appropriate SQL SELECT statement that can be used to check a string against a regular expression.
 */
public String getSelectRegexpTestString(String stringToCheck,String regex){
  String surroundedTestString=(stringToCheck.startsWith("String_Node_Str") && stringToCheck.endsWith("String_Node_Str")) ? stringToCheck : surroundWith('\'',stringToCheck,'\'');
  String regexLikeExpression=regexLike(surroundedTestString,regex);
  if (regexLikeExpression == null) {
    return null;
  }
  return getSelectRegexp(regexLikeExpression);
}
Program: 137407
Project: 137407
Buggy source:
/** 
 * remember the result value for regular expression.So that we can get complete expression and Normal it should be "=1"
 */
private void setFunctionReturnValue(String inputStr){
  String tempString=inputStr.split("String_Node_Str").length > 1 ? inputStr.split("String_Node_Str")[1] : "String_Node_Str";
  regularfunctionReturnValue=tempString.split("String_Node_Str").length > 1 ? tempString.split("String_Node_Str")[0] : "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * remember the result value for regular expression.So that we can get complete expression and Normal it should be "=1"
 * @param expression
 */
public void setFunctionReturnValue(Expression expression){
  try {
    String tempString=splictExpression(expression);
    tempString=tempString.split("String_Node_Str").length > 1 ? tempString.split("String_Node_Str")[1] : "String_Node_Str";
    tempString=tempString.split("String_Node_Str").length > 1 ? tempString.split("String_Node_Str")[0] : "String_Node_Str";
    regularfunctionReturnValue=tempString.trim();
  }
 catch (  NullPointerException e) {
    log.error(e,e);
  }
}
Program: 137408
Project: 137408
Buggy source:
/** 
 * Extract the name of regular Expression Function If current database type need to use UDF deal regular expression, the expresssion which will definition on "Regular Expression Matching.definition" should like below: "* + when REGULAR_FUNCTION(+ * +) + *". else this method will not return correct result which you want
 * @param expression
 * @return the name of regular Expression Function or null when the expression is invalid
 */
public String extractRegularExpressionFunction(Expression expression){
  String functionName=null;
  try {
    String body=expression.getBody().toUpperCase();
    String tempString=body.split("String_Node_Str").length > 1 ? body.split("String_Node_Str")[1] : "String_Node_Str";
    functionName=tempString.split("String_Node_Str").length > 1 ? tempString.split("String_Node_Str")[0] : "String_Node_Str";
    functionName=functionName.trim();
    this.setFunctionReturnValue(tempString);
  }
 catch (  NullPointerException e) {
    log.error(e,e);
  }
  return functionName;
}

Fixed version (ground truth):
/** 
 * Extract the name of regular Expression Function If current database type need to use UDF deal regular expression, the expresssion which will definition on "Regular Expression Matching.definition" should like below: "* + when REGULAR_FUNCTION(+ * +) + *". else this method will not return correct result which you want
 * @param expression
 * @return the name of regular Expression Function or null when the expression is invalid
 */
public String extractRegularExpressionFunction(Expression expression){
  String functionName=null;
  try {
    String tempString=splictExpression(expression);
    functionName=tempString.split("String_Node_Str").length > 1 ? tempString.split("String_Node_Str")[0] : "String_Node_Str";
    functionName=functionName.trim();
  }
 catch (  NullPointerException e) {
    log.error(e,e);
  }
  return functionName;
}
Program: 137409
Project: 137409
Buggy source:
/** 
 * Method "regex".
 * @param element
 * @param regex
 * @return the regular expression according to the DBMS syntax or null if not supported.\
 * @deprecated use {@link #regularFunctionBody(String,String)} instead of it
 */
@Deprecated public String regexLike(String element,String regex){
  return regularFunctionBody(element,regex);
}

Fixed version (ground truth):
/** 
 * Method "regexLike".
 * @param element
 * @param regex
 * @return get the String of Regular function(for example : "regex_like(element,regex)")
 */
public String regexLike(String element,String regex){
  if (null == regularExpressionFunction || PluginConstant.EMPTY_STRING.equals(regularExpressionFunction) || existEmptyInParameter(element,regex)) {
    return null;
  }
  String functionNameSQL=regularExpressionFunction + "String_Node_Str" + element+ "String_Node_Str"+ regex+ "String_Node_Str";
  return surroundWithSpaces(functionNameSQL);
}
Program: 137410
Project: 137410
Buggy source:
/** 
 * @deprecated use {@link #regularFunctionBody(String,String)} instead of it
 */
@Deprecated @Override public String regexLike(String element,String regex){
  return this.regularFunctionBody(element,regex);
}

Fixed version (ground truth):
@Override public String regexLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(getRegularExpressionFunction()) + regex);
}
Program: 137411
Project: 137411
Buggy source:
/** 
 * @deprecated use {@link #notRegularFunctionBody(String,String)} instead of it
 */
@Deprecated @Override public String regexNotLike(String element,String regex){
  return this.notRegularFunctionBody(element,regex);
}

Fixed version (ground truth):
@Override public String regexNotLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(this.not() + getRegularExpressionFunction()) + regex);
}
Program: 137412
Project: 137412
Buggy source:
/** 
 * @deprecated use {@link #notRegularFunctionBody(String,String)} instead of it
 */
@Deprecated @Override public String regexNotLike(String element,String regex){
  return this.notRegularFunctionBody(element,regex);
}

Fixed version (ground truth):
@Override public String regexNotLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(this.not() + getRegularExpressionFunction()) + regex);
}
Program: 137413
Project: 137413
Buggy source:
/** 
 * @deprecated use {@link #regularFunctionBody(String,String)} instead of it
 */
@Deprecated @Override public String regexLike(String element,String regex){
  return this.regularFunctionBody(element,regex);
}

Fixed version (ground truth):
@Override public String regexLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(getRegularExpressionFunction()) + regex);
}
Program: 137414
Project: 137414
Buggy source:
/** 
 * Method "regexLike".
 * @param element
 * @param regex
 * @return get the String of Regular function(for example : "regex_like(element,regex)")
 */
public String regexLike(String element,String regex){
  if (null == regularExpressionFunction || PluginConstant.EMPTY_STRING.equals(regularExpressionFunction) || existEmptyInParameter(element,regex)) {
    return null;
  }
  String functionNameSQL=regularExpressionFunction + "String_Node_Str" + element+ "String_Node_Str"+ regex+ "String_Node_Str";
  return surroundWithSpaces(functionNameSQL);
}

Fixed version (ground truth):
/** 
 * Method "regexLike". By default, it will try to extract the function name from user defined regular expression. If the database support the regex like regular expression function , the sub-class will have to override this method in order to return the correct regex like name.
 * @param element
 * @param regex
 * @return get the String of Regular function(for example : "regex_like(element,regex)").
 */
public String regexLike(String element,String regex){
  if (null == regularExpressionFunction || PluginConstant.EMPTY_STRING.equals(regularExpressionFunction) || existEmptyInParameter(element,regex)) {
    return null;
  }
  String functionNameSQL=regularExpressionFunction + "String_Node_Str" + element+ "String_Node_Str"+ regex+ "String_Node_Str";
  return surroundWithSpaces(functionNameSQL);
}
Program: 137416
Project: 137416
Buggy source:
/** 
 * get the Valid Rows Statement.
 * @return
 */
public String getValidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString) + functionReturnValue;
  return getRowsStatement(regexCmp);
}

Fixed version (ground truth):
/** 
 * get the Valid Rows Statement.
 * @return
 */
public String getValidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  return getRowsStatement(regexCmp);
}
Program: 137417
Project: 137417
Buggy source:
/** 
 * get the Invalid Rows Statement.
 * @return
 */
public String getInvalidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString) + functionReturnValue;
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getRowsStatement(pattCondStr);
}

Fixed version (ground truth):
/** 
 * get the Invalid Rows Statement.
 * @return
 */
public String getInvalidRowsStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidRowsExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getRowsStatement(pattCondStr);
}
Program: 137418
Project: 137418
Buggy source:
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
  if (ColumnsetPackage.eINSTANCE.getAllMatchIndicator().isSuperTypeOf(indicator.eClass())) {
    return map;
  }
  boolean isSqlEngine=ExecutionLanguage.SQL.equals(this.analysis.getParameters().getExecutionLanguage());
  EList<Expression> instantiatedExpressions=this.indicator.getInstantiatedExpressions();
  if (instantiatedExpressions.size() > 0) {
    Expression expression=instantiatedExpressions.get(0);
    String body=expression.getBody().toUpperCase();
    String functionName=body.split("String_Node_Str").length > 1 ? body.split("String_Node_Str")[1] : "String_Node_Str";
    functionReturnValue=functionName.split("String_Node_Str").length > 1 ? functionName.split("String_Node_Str")[1] : "String_Node_Str";
    functionName=functionName.split("String_Node_Str").length > 1 ? functionName.split("String_Node_Str")[0] : "String_Node_Str";
    dbmsLanguage.setFunctionName(functionName);
    functionReturnValue=functionReturnValue.split("String_Node_Str").length > 1 ? functionReturnValue.split("String_Node_Str")[1] : "String_Node_Str";
    functionReturnValue=functionReturnValue.split("String_Node_Str").length > 1 ? functionReturnValue.split("String_Node_Str")[0] : "String_Node_Str";
  }
  map.put(MENU_VIEW_INVALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_INVALID_VALUES) + getInvalidValuesStatement() : null);
  map.put(MENU_VIEW_VALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_VALID_VALUES) + getValidValuesStatement() : null);
  map.put(MENU_VIEW_INVALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_INVALID_ROWS) + getInvalidRowsStatement() : null);
  map.put(MENU_VIEW_VALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_VALID_ROWS) + getValidRowsStatement() : null);
  return map;
}

Fixed version (ground truth):
public Map<String,String> getQueryMap(){
  Map<String,String> map=new HashMap<String,String>();
  if (ColumnsetPackage.eINSTANCE.getAllMatchIndicator().isSuperTypeOf(indicator.eClass())) {
    return map;
  }
  boolean isSqlEngine=ExecutionLanguage.SQL.equals(this.analysis.getParameters().getExecutionLanguage());
  EList<Expression> instantiatedExpressions=this.indicator.getInstantiatedExpressions();
  if (instantiatedExpressions.size() > 0) {
    Expression expression=instantiatedExpressions.get(0);
    String regularExpressionFunctionName=dbmsLanguage.extractRegularExpressionFunction(expression);
    dbmsLanguage.setRegularExpressionFunction(regularExpressionFunctionName);
    dbmsLanguage.setFunctionReturnValue(expression);
  }
  map.put(MENU_VIEW_INVALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_INVALID_VALUES) + getInvalidValuesStatement() : null);
  map.put(MENU_VIEW_VALID_VALUES,isSqlEngine ? getComment(MENU_VIEW_VALID_VALUES) + getValidValuesStatement() : null);
  map.put(MENU_VIEW_INVALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_INVALID_ROWS) + getInvalidRowsStatement() : null);
  map.put(MENU_VIEW_VALID_ROWS,isSqlEngine ? getComment(MENU_VIEW_VALID_ROWS) + getValidRowsStatement() : null);
  return map;
}
Program: 137419
Project: 137419
Buggy source:
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the valid Value of select column
 */
public String getValidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString) + functionReturnValue;
  return getValuesStatement(columnName,regexCmp);
}

Fixed version (ground truth):
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the valid Value of select column
 */
public String getValidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewValidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  return getValuesStatement(columnName,regexCmp);
}
Program: 137420
Project: 137420
Buggy source:
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the invalid Value of select column
 */
public String getInvalidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString) + functionReturnValue;
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getValuesStatement(columnName,pattCondStr);
}

Fixed version (ground truth):
/** 
 * get the Valid Values Statement.
 * @return SELECT statement for the invalid Value of select column
 */
public String getInvalidValuesStatement(){
  IndicatorDefinition indicatorDefinition=this.indicator.getIndicatorDefinition();
  if (indicatorDefinition instanceof UDIndicatorDefinition) {
    EList<TdExpression> list=((UDIndicatorDefinition)indicatorDefinition).getViewInvalidValuesExpression();
    return getQueryAfterReplaced(indicatorDefinition,list);
  }
  String regexPatternString=dbmsLanguage.getRegexPatternString(this.indicator);
  String regexCmp=dbmsLanguage.regexNotLike(columnName,regexPatternString) + dbmsLanguage.getFunctionReturnValue();
  String nullClause=dbmsLanguage.or() + columnName + dbmsLanguage.isNull();
  String pattCondStr="String_Node_Str" + regexCmp + nullClause+ "String_Node_Str";
  return getValuesStatement(columnName,pattCondStr);
}
Program: 137421
Project: 137421
Buggy source:
@Override protected String getInstantiatedClause(){
  String function=getFunction();
  if (function != null && (DbmsLanguageFactory.isInfomix(this.dbmsLanguage.getDbmsName()) || DbmsLanguageFactory.isOracle(this.dbmsLanguage.getDbmsName()))) {
    function=columnName;
  }
  String clause=entity.isLabelNull() || function == null ? columnName + dbmsLanguage.isNull() : SOUNDEX_PREFIX + "String_Node_Str" + function+ "String_Node_Str"+ dbmsLanguage.equal()+ SOUNDEX_PREFIX+ "String_Node_Str"+ entity.getKey()+ "String_Node_Str";
  return clause;
}

Fixed version (ground truth):
@Override protected String getInstantiatedClause(){
  String function=getFunction();
  if (function != null && (DbmsLanguageFactory.isInfomix(this.dbmsLanguage.getDbmsName()) || DbmsLanguageFactory.isOracle(this.dbmsLanguage.getDbmsName()))) {
    function=columnName;
  }
  String clause=entity.isLabelNull() || function == null ? columnName + dbmsLanguage.isNull() : dbmsLanguage.getSoundexPrefix() + "String_Node_Str" + function+ "String_Node_Str"+ dbmsLanguage.equal()+ dbmsLanguage.getSoundexPrefix()+ "String_Node_Str"+ entity.getKey()+ "String_Node_Str";
  return clause;
}
Program: 137422
Project: 137422
Buggy source:
public String regexNotLike(String element,String regex){
  if (null == functionName || PluginConstant.EMPTY_STRING.equals(functionName)) {
    return null;
  }
  return surroundWithSpaces("String_Node_Str" + functionName + "String_Node_Str"+ element+ "String_Node_Str"+ regex+ "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * method "regexNotLike"
 * @param element
 * @param regex
 * @return get the String of Regular function which is not match(for example :"not regex_like(element,regex)")
 */
public String regexNotLike(String element,String regex){
  String functionNameSQL=regexLike(element,regex);
  if (functionNameSQL == null) {
    return null;
  }
  return this.not() + functionNameSQL;
}
Program: 137423
Project: 137423
Buggy source:
/** 
 * Method "regex".
 * @param element
 * @param regex
 * @return the regular expression according to the DBMS syntax or null if not supported.
 */
public String regexLike(String element,String regex){
  if (null == functionName || PluginConstant.EMPTY_STRING.equals(functionName)) {
    return null;
  }
  String functionNameSQL=functionName + "String_Node_Str";
  if (null != element && !element.equals("String_Node_Str")) {
    functionNameSQL=functionNameSQL + element;
  }
  if (null != regex && !regex.equals("String_Node_Str")) {
    functionNameSQL=functionNameSQL + "String_Node_Str" + regex;
  }
  functionNameSQL=functionNameSQL + "String_Node_Str";
  return functionNameSQL;
}

Fixed version (ground truth):
/** 
 * Method "regexLike". By default, it will try to extract the function name from user defined regular expression. If the database support the regex like regular expression function , the sub-class will have to override this method in order to return the correct regex like name.
 * @param element
 * @param regex
 * @return get the String of Regular function(for example : "regex_like(element,regex)").
 */
public String regexLike(String element,String regex){
  if (null == regularExpressionFunction || PluginConstant.EMPTY_STRING.equals(regularExpressionFunction) || existEmptyInParameter(element,regex)) {
    return null;
  }
  String functionNameSQL=regularExpressionFunction + "String_Node_Str" + element+ "String_Node_Str"+ regex+ "String_Node_Str";
  return surroundWithSpaces(functionNameSQL);
}
Program: 137424
Project: 137424
Buggy source:
@Override public String regexLike(String element,String regex){
  return surroundWithSpaces(element + "String_Node_Str" + regex);
}

Fixed version (ground truth):
@Override public String regexLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(getRegularExpressionFunction()) + regex);
}
Program: 137425
Project: 137425
Buggy source:
@Override public String regexNotLike(String element,String regex){
  return surroundWithSpaces(element + "String_Node_Str" + regex);
}

Fixed version (ground truth):
@Override public String regexNotLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(this.not() + getRegularExpressionFunction()) + regex);
}
Program: 137426
Project: 137426
Buggy source:
@Override public String regexNotLike(String element,String regex){
  return surroundWithSpaces(element + "String_Node_Str" + regex);
}

Fixed version (ground truth):
@Override public String regexNotLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(this.not() + getRegularExpressionFunction()) + regex);
}
Program: 137427
Project: 137427
Buggy source:
@Override public String regexLike(String element,String regex){
  return surroundWithSpaces(element + "String_Node_Str" + regex);
}

Fixed version (ground truth):
@Override public String regexLike(String element,String regex){
  return surroundWithSpaces(element + surroundWithSpaces(getRegularExpressionFunction()) + regex);
}
Program: 137428
Project: 137428
Buggy source:
/** 
 * Establishes a JDBC connection
 * @param user
 * @return
 * @throws ExplorerException
 * @throws SQLException
 */
public SQLConnection getConnection(User user) throws SQLException {
  Properties props=new Properties();
  if (user.getUserName() != null) {
    props.put("String_Node_Str",user.getUserName());
  }
  if (user.getPassword() != null) {
    props.put("String_Node_Str",user.getPassword());
  }
  if (!isDriverClassLoaded()) {
    try {
      registerSQLDriver();
    }
 catch (    ClassNotFoundException e) {
      throw new SQLException(Messages.getString("String_Node_Str",driverClassName) + "String_Node_Str" + Messages.getString("String_Node_Str"));
    }
  }
  if (!isDriverClassLoaded()) {
    throw new SQLException(Messages.getString("String_Node_Str",driverClassName));
  }
  Connection jdbcConn=null;
  try {
    jdbcConn=jdbcDriver.connect(user.getAlias().getUrl(),props);
  }
 catch (  SQLException e) {
    throw new SQLCannotConnectException(user,e);
  }
  if (jdbcConn == null) {
    throw new SQLCannotConnectException(user);
  }
  return new SQLConnection(user,jdbcConn,this,getDatabaseProduct().describeConnection(jdbcConn));
}

Fixed version (ground truth):
/** 
 * Establishes a JDBC connection
 * @param user
 * @return
 * @throws ExplorerException
 * @throws SQLException
 */
public SQLConnection getConnection(User user) throws SQLException {
  Properties props=new Properties();
  if (user.getUserName() != null) {
    props.put("String_Node_Str",user.getUserName());
  }
  if (user.getPassword() != null) {
    props.put("String_Node_Str",user.getPassword());
  }
  if (!isDriverClassLoaded()) {
    try {
      registerSQLDriver();
    }
 catch (    ClassNotFoundException e) {
      throw new SQLException(Messages.getString("String_Node_Str",driverClassName) + "String_Node_Str" + Messages.getString("String_Node_Str"));
    }
  }
  if (!isDriverClassLoaded()) {
    throw new SQLException(Messages.getString("String_Node_Str",driverClassName));
  }
  Connection jdbcConn=null;
  try {
    String dbUrl=user.getAlias().getUrl();
    dbUrl=ConnectionUtils.addShutDownForHSQLUrl(dbUrl,user.getMetadataConnection().getAdditionalParams());
    jdbcConn=jdbcDriver.connect(dbUrl,props);
  }
 catch (  SQLException e) {
    throw new SQLCannotConnectException(user,e);
  }
  if (jdbcConn == null) {
    throw new SQLCannotConnectException(user);
  }
  return new SQLConnection(user,jdbcConn,this,getDatabaseProduct().describeConnection(jdbcConn));
}
Program: 137429
Project: 137429
Buggy source:
/** 
 * Releases a connection; the connection will be returned to the pool, unless the pool has grown too large (in which case the connection is closed). Note that the connection may not be in the "allocated" list if it is a hidden connection (see hideConnection())
 * @param connection
 * @throws ExplorerException
 */
public void releaseConnection(SQLConnection connection) throws SQLException {
  if (connection.getConnection() == null || connection.getConnection().isClosed()) {
    disposeConnection(connection);
    return;
  }
  boolean forPool=allocated.remove(connection);
  boolean commitOnClose=SQLExplorerPlugin.getDefault().getPluginPreferences().getBoolean(IConstants.COMMIT_ON_CLOSE);
  if (!connection.getAutoCommit()) {
    if (commitOnClose) {
      connection.commit();
    }
 else {
      connection.rollback();
    }
  }
  if (forPool && unused.size() < MAX_POOL_SIZE) {
    unused.add(connection);
    return;
  }
  connection.close();
}

Fixed version (ground truth):
/** 
 * Releases a connection; the connection will be returned to the pool, unless the pool has grown too large (in which case the connection is closed). Note that the connection may not be in the "allocated" list if it is a hidden connection (see hideConnection())
 * @param connection
 * @throws ExplorerException
 */
public void releaseConnection(SQLConnection connection) throws SQLException {
  if (connection.getConnection() == null || connection.getConnection().isClosed()) {
    disposeConnection(connection);
    return;
  }
  boolean forPool=allocated.remove(connection);
  boolean commitOnClose=SQLExplorerPlugin.getDefault().getPluginPreferences().getBoolean(IConstants.COMMIT_ON_CLOSE);
  if (!connection.getAutoCommit()) {
    if (commitOnClose) {
      connection.commit();
    }
 else {
      connection.rollback();
    }
  }
  if (forPool && unused.size() < MAX_POOL_SIZE) {
    unused.add(connection);
    return;
  }
  closeConnection(connection);
}
Program: 137430
Project: 137430
Buggy source:
/** 
 * Merges the definition of the User "that" - IE takes the password, auto-commit behaviour, etc
 * @param that
 */
public void mergeWith(User that){
  password=that.getPassword();
  autoCommit=that.isAutoCommit();
  commitOnClose=that.isCommitOnClose();
  for (  SQLConnection connection : that.unused) {
    connection.setUser(this);
    if (unused.size() < MAX_POOL_SIZE) {
      unused.add(connection);
    }
 else {
      try {
        connection.close();
      }
 catch (      SQLException e) {
        SQLExplorerPlugin.error("String_Node_Str",e);
      }
    }
  }
  for (  SQLConnection connection : that.allocated) {
    connection.setUser(this);
    allocated.add(connection);
  }
  for (  Session session : that.sessions) {
    session.setUser(this);
    sessions.add(session);
  }
  metaDataSession=that.metaDataSession;
  that.unused=null;
  that.allocated=null;
  that.sessions=null;
  that.metaDataSession=null;
  that.password=null;
  SQLExplorerPlugin.getDefault().getAliasManager().modelChanged();
}

Fixed version (ground truth):
/** 
 * Merges the definition of the User "that" - IE takes the password, auto-commit behaviour, etc
 * @param that
 */
public void mergeWith(User that){
  password=that.getPassword();
  autoCommit=that.isAutoCommit();
  commitOnClose=that.isCommitOnClose();
  for (  SQLConnection connection : that.unused) {
    connection.setUser(this);
    if (unused.size() < MAX_POOL_SIZE) {
      unused.add(connection);
    }
 else {
      try {
        closeConnection(connection);
      }
 catch (      SQLException e) {
        SQLExplorerPlugin.error("String_Node_Str",e);
      }
    }
  }
  for (  SQLConnection connection : that.allocated) {
    connection.setUser(this);
    allocated.add(connection);
  }
  for (  Session session : that.sessions) {
    session.setUser(this);
    sessions.add(session);
  }
  metaDataSession=that.metaDataSession;
  that.unused=null;
  that.allocated=null;
  that.sessions=null;
  that.metaDataSession=null;
  that.password=null;
  SQLExplorerPlugin.getDefault().getAliasManager().modelChanged();
}
Program: 137431
Project: 137431
Buggy source:
/** 
 * Disposes of the connection without returning it to the pool; usually called when the connection has been closed by the server
 * @param connection
 */
public void disposeConnection(SQLConnection connection){
  allocated.remove(connection);
  try {
    connection.close();
  }
 catch (  SQLException e) {
  }
}

Fixed version (ground truth):
/** 
 * Disposes of the connection without returning it to the pool; usually called when the connection has been closed by the server
 * @param connection
 */
public void disposeConnection(SQLConnection connection){
  allocated.remove(connection);
  try {
    closeConnection(connection);
  }
 catch (  SQLException e) {
  }
}