Program: 123474
Project: 123474
Buggy source:
/** 
 * DOC amaumont Comment method "buildCondition".
 * @param sbWhere
 * @param table
 * @param isFirstClause
 * @param dbMapEntry
 * @param writeCr TODO
 */
private boolean buildCondition(DbMapComponent component,StringBuilder sbWhere,ExternalDbMapTable table,boolean isFirstClause,ExternalDbMapEntry dbMapEntry,boolean writeCr){
  String expression=dbMapEntry.getExpression();
  expression=initExpression(component,dbMapEntry);
  IDbOperator dbOperator=getOperatorsManager().getOperatorFromValue(dbMapEntry.getOperator());
  boolean operatorIsSet=dbOperator != null;
  boolean expressionIsSet=expression != null && expression.trim().length() > 0;
  boolean conditionWritten=false;
  if (operatorIsSet) {
    if (writeCr) {
      sbWhere.append(DbMapSqlConstants.NEW_LINE);
      sbWhere.append(DbMapSqlConstants.SPACE);
    }
    if (!isFirstClause) {
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(DbMapSqlConstants.AND);
      sbWhere.append(DbMapSqlConstants.SPACE);
    }
    String entryName=dbMapEntry.getName();
    entryName=getOriginalColumnName(entryName,component,table);
    String locationInputEntry=language.getLocation(table.getName(),entryName);
    sbWhere.append(DbMapSqlConstants.SPACE);
    sbWhere.append(locationInputEntry);
    sbWhere.append(getSpecialRightJoin(table));
    sbWhere.append(DbMapSqlConstants.SPACE);
    if (operatorIsSet) {
      sbWhere.append(dbOperator.getOperator()).append(DbMapSqlConstants.SPACE);
    }
 else     if (!operatorIsSet && expressionIsSet) {
      sbWhere.append(DbMapSqlConstants.LEFT_COMMENT);
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(Messages.getString("String_Node_Str",entryName));
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(DbMapSqlConstants.RIGHT_COMMENT);
    }
    if (operatorIsSet && !expressionIsSet && !dbOperator.isMonoOperand()) {
      String str=table.getName() + DbMapSqlConstants.DOT + entryName;
      sbWhere.append(DbMapSqlConstants.LEFT_COMMENT);
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(Messages.getString("String_Node_Str",str));
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(DbMapSqlConstants.RIGHT_COMMENT);
    }
 else     if (expressionIsSet) {
      sbWhere.append(expression);
      sbWhere.append(getSpecialLeftJoin(table));
    }
    conditionWritten=true;
  }
  return conditionWritten;
}

Fixed version (ground truth):
/** 
 * DOC amaumont Comment method "buildCondition".
 * @param sbWhere
 * @param table
 * @param isFirstClause
 * @param dbMapEntry
 * @param writeCr TODO
 */
private boolean buildCondition(DbMapComponent component,StringBuilder sbWhere,ExternalDbMapTable table,boolean isFirstClause,ExternalDbMapEntry dbMapEntry,boolean writeCr){
  String expression=dbMapEntry.getExpression();
  expression=initExpression(component,dbMapEntry);
  IDbOperator dbOperator=getOperatorsManager().getOperatorFromValue(dbMapEntry.getOperator());
  boolean operatorIsSet=dbOperator != null;
  boolean expressionIsSet=expression != null && expression.trim().length() > 0;
  boolean conditionWritten=false;
  if (operatorIsSet) {
    if (writeCr) {
      sbWhere.append(DbMapSqlConstants.NEW_LINE);
      sbWhere.append(DbMapSqlConstants.SPACE);
    }
    if (!isFirstClause) {
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(DbMapSqlConstants.AND);
      sbWhere.append(DbMapSqlConstants.SPACE);
    }
    String entryName=dbMapEntry.getName();
    entryName=getOriginalColumnName(entryName,component,table);
    String locationInputEntry=language.getLocation(table.getName(),entryName);
    locationInputEntry=addQuit(locationInputEntry);
    sbWhere.append(DbMapSqlConstants.SPACE);
    sbWhere.append(locationInputEntry);
    sbWhere.append(getSpecialRightJoin(table));
    sbWhere.append(DbMapSqlConstants.SPACE);
    if (operatorIsSet) {
      sbWhere.append(dbOperator.getOperator()).append(DbMapSqlConstants.SPACE);
    }
 else     if (!operatorIsSet && expressionIsSet) {
      sbWhere.append(DbMapSqlConstants.LEFT_COMMENT);
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(Messages.getString("String_Node_Str",entryName));
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(DbMapSqlConstants.RIGHT_COMMENT);
    }
    if (operatorIsSet && !expressionIsSet && !dbOperator.isMonoOperand()) {
      String str=table.getName() + DbMapSqlConstants.DOT + entryName;
      sbWhere.append(DbMapSqlConstants.LEFT_COMMENT);
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(Messages.getString("String_Node_Str",str));
      sbWhere.append(DbMapSqlConstants.SPACE);
      sbWhere.append(DbMapSqlConstants.RIGHT_COMMENT);
    }
 else     if (expressionIsSet) {
      sbWhere.append(expression);
      sbWhere.append(getSpecialLeftJoin(table));
    }
    conditionWritten=true;
  }
  return conditionWritten;
}