nus-yam/ex-repair huggingface dataset:
Program: 169080
Project: 169080
Buggy source:
/** 
 * Retrieves the field name associated to a given selector (It may be both a basic field or a function. Functions must have their own process in order to get the field name. If no process is defined the function name is returned as selector field name
 * @param selector  object defining a field or a function
 * @return                  name associated to the selector
 */
public static String getSelectorFieldName(Selector selector){
  if (null == selector) {
    return null;
  }
  if (selector instanceof FunctionSelector) {
    return getFunctionSelectorFieldName((FunctionSelector)selector);
  }
  return selector.getColumnName().getName();
}

Fixed version (ground truth):
/** 
 * Retrieves the field name associated to a given selector (It may be both a basic field or a function. Functions must have their own process in order to get the field name. If no process is defined the function name is returned as selector field name
 * @param selector  object defining a field or a function
 * @return                  name associated to the selector
 */
public static String getSelectorFieldName(Selector selector){
  if (null == selector) {
    return null;
  }
  if (selector instanceof FunctionSelector) {
    return getFunctionSelectorFieldName((FunctionSelector)selector);
  }
  if (selector instanceof AliasSelector) {
    return getSelectorFieldName(((AliasSelector)selector).getReferencedSelector());
  }
  return selector.getColumnName().getName();
}
Program: 169081
Project: 169081
Buggy source:
private XContentBuilder processColumnProperties(XContentBuilder xContentBuilder,ColumnMetadata columnMetadata) throws ExecutionException, IOException {
  String columnType=TypeConverter.convert(columnMetadata.getColumnType());
  xContentBuilder=xContentBuilder.field(TYPE,columnType);
  Map<String,List<String>> columProperties=columnMetadata.getColumnType().getColumnProperties();
  if (columProperties != null && !columProperties.containsKey(INDEX)) {
    xContentBuilder.field(INDEX,getTypeIndex(columnType));
  }
  if (columProperties != null) {
    for (    String columProperty : columProperties.keySet()) {
      xContentBuilder=xContentBuilder.field(columProperty,columProperties.get(columProperty));
    }
  }
  return xContentBuilder.endObject();
}

Fixed version (ground truth):
private XContentBuilder processColumnProperties(XContentBuilder xContentBuilder,ColumnMetadata columnMetadata) throws ExecutionException, IOException {
  String columnType=TypeConverter.convert(columnMetadata.getColumnType());
  xContentBuilder=xContentBuilder.field(TYPE,columnType);
  Map<String,List<String>> columProperties=columnMetadata.getColumnType().getColumnProperties();
  if (columProperties != null && !columProperties.containsKey(INDEX)) {
    xContentBuilder.field(INDEX,getTypeIndex(columnType));
  }
  if (columProperties != null) {
    for (    String columProperty : columProperties.keySet()) {
      if (columProperties.get(columProperty).size() > 1) {
        xContentBuilder=xContentBuilder.field(columProperty,columProperties.get(columProperty));
      }
 else       if (columProperties.get(columProperty).size() == 1) {
        xContentBuilder=xContentBuilder.field(columProperty,columProperties.get(columProperty).get(0));
      }
    }
  }
  return xContentBuilder.endObject();
}
Program: 169082
Project: 169082
Buggy source:
/** 
 * Turn a relation into a queryBuilder.
 * @param relation the relation.
 * @return the queryBuilder.
 * @throws ExecutionException   if any error happens.
 * @throws UnsupportedException if the operation is not supported.
 */
private QueryBuilder createQueryBuilder(Relation relation) throws ExecutionException, UnsupportedException {
  QueryBuilder queryBuilderfilter;
  String leftTerm=SelectorHelper.getValue(String.class,relation.getLeftTerm());
  String rightTerm=SelectorHelper.getValue(String.class,relation.getRightTerm());
switch (relation.getOperator()) {
case EQ:
    queryBuilderfilter=QueryBuilders.matchQuery(leftTerm,rightTerm.toLowerCase());
  break;
case LT:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).lt(rightTerm.toLowerCase());
break;
case LET:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).lte(rightTerm.toLowerCase());
break;
case GT:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).gt(rightTerm.toLowerCase());
break;
case GET:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).gte(rightTerm.toLowerCase());
break;
default :
throw new UnsupportedException("String_Node_Str" + relation.getOperator() + "String_Node_Str");
}
return queryBuilderfilter;
}

Fixed version (ground truth):
/** 
 * Turn a relation into a queryBuilder.
 * @param relation the relation.
 * @return the queryBuilder.
 * @throws ExecutionException   if any error happens.
 * @throws UnsupportedException if the operation is not supported.
 */
private QueryBuilder createQueryBuilder(Relation relation) throws ExecutionException, UnsupportedException {
  QueryBuilder queryBuilderfilter;
  String leftTerm=SelectorHelper.getValue(String.class,relation.getLeftTerm());
  String rightTerm=SelectorHelper.getValue(String.class,relation.getRightTerm());
switch (relation.getOperator()) {
case MATCH:
case EQ:
    queryBuilderfilter=QueryBuilders.matchQuery(leftTerm,rightTerm.toLowerCase());
  break;
case LT:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).lt(rightTerm.toLowerCase());
break;
case LET:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).lte(rightTerm.toLowerCase());
break;
case GT:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).gt(rightTerm.toLowerCase());
break;
case GET:
queryBuilderfilter=QueryBuilders.rangeQuery(leftTerm).gte(rightTerm.toLowerCase());
break;
default :
throw new UnsupportedException("String_Node_Str" + relation.getOperator() + "String_Node_Str");
}
return queryBuilderfilter;
}
Program: 169083
Project: 169083
Buggy source:
public ESConnectorHelper(ClusterName clusterName) throws ConnectionException, InitializationException {
  super();
  this.clusterName=clusterName;
  String serverIP=System.getProperty("String_Node_Str");
  if (serverIP != null) {
    SERVER_IP=serverIP;
  }
  String serverPort=System.getProperty("String_Node_Str");
  if (serverPort != null) {
    SERVER_PORT=serverPort;
  }
  if (auxConection != null) {
    auxConection=new TransportClient(ElasticsearchClientConfiguration.getSettings(getConnectorClusterConfig())).addTransportAddresses(ElasticsearchClientConfiguration.getTransportAddress(getConnectorClusterConfig()));
  }
}

Fixed version (ground truth):
public ESConnectorHelper(ClusterName clusterName) throws ConnectionException, InitializationException {
  super();
  this.clusterName=clusterName;
  String serverIP=System.getProperty("String_Node_Str");
  if (serverIP != null) {
    SERVER_IP=serverIP;
  }
  String serverPort=System.getProperty("String_Node_Str");
  if (serverPort != null) {
    SERVER_PORT=serverPort;
  }
  if (auxConection == null) {
    auxConection=new TransportClient(ElasticsearchClientConfiguration.getSettings(getConnectorClusterConfig())).addTransportAddresses(ElasticsearchClientConfiguration.getTransportAddress(getConnectorClusterConfig()));
  }
}
Program: 169084
Project: 169084
Buggy source:
@Override protected IConnectorHelper getConnectorHelper(){
  ESConnectorHelper esConnectorHelper=null;
  try {
    esConnectorHelper=new ESConnectorHelper(getClusterName());
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}

Fixed version (ground truth):
@Override protected IConnectorHelper getConnectorHelper(){
  try {
    if (esConnectorHelper == null) {
      esConnectorHelper=new ESConnectorHelper(getClusterName());
    }
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}
Program: 169085
Project: 169085
Buggy source:
@Override protected IConnectorHelper getConnectorHelper(){
  ESConnectorHelper esConnectorHelper=null;
  try {
    esConnectorHelper=new ESConnectorHelper(getClusterName());
  }
 catch (  InitializationException e) {
    e.printStackTrace();
  }
catch (  ConnectionException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}

Fixed version (ground truth):
@Override protected IConnectorHelper getConnectorHelper(){
  try {
    if (esConnectorHelper == null) {
      esConnectorHelper=new ESConnectorHelper(getClusterName());
    }
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}
Program: 169086
Project: 169086
Buggy source:
@Override protected IConnectorHelper getConnectorHelper(){
  ESConnectorHelper esConnectorHelper=null;
  try {
    esConnectorHelper=new ESConnectorHelper(getClusterName());
  }
 catch (  InitializationException e) {
    e.printStackTrace();
  }
catch (  ConnectionException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}

Fixed version (ground truth):
@Override protected IConnectorHelper getConnectorHelper(){
  try {
    if (esConnectorHelper == null) {
      esConnectorHelper=new ESConnectorHelper(getClusterName());
    }
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}
Program: 169087
Project: 169087
Buggy source:
@Override protected IConnectorHelper getConnectorHelper(){
  ESConnectorHelper esConnectorHelper=null;
  try {
    esConnectorHelper=new ESConnectorHelper(getClusterName());
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}

Fixed version (ground truth):
@Override protected IConnectorHelper getConnectorHelper(){
  try {
    if (esConnectorHelper == null) {
      esConnectorHelper=new ESConnectorHelper(getClusterName());
    }
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}
Program: 169088
Project: 169088
Buggy source:
@Override protected IConnectorHelper getConnectorHelper(){
  ESConnectorHelper esConnectorHelper=null;
  try {
    esConnectorHelper=new ESConnectorHelper(getClusterName());
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}

Fixed version (ground truth):
@Override protected IConnectorHelper getConnectorHelper(){
  try {
    if (esConnectorHelper == null) {
      esConnectorHelper=new ESConnectorHelper(getClusterName());
    }
    return esConnectorHelper;
  }
 catch (  ConnectionException e) {
    e.printStackTrace();
  }
catch (  InitializationException e) {
    e.printStackTrace();
  }
  return esConnectorHelper;
}
Program: 169089
Project: 169089
Buggy source:
public ESConnectorHelper(ClusterName clusterName) throws ConnectionException, InitializationException {
  super();
  this.clusterName=clusterName;
  String serverIP=System.getProperty("String_Node_Str");
  if (serverIP != null) {
    SERVER_IP=serverIP;
  }
  String serverPort=System.getProperty("String_Node_Str");
  if (serverPort != null) {
    SERVER_PORT=serverPort;
  }
  auxConection=new TransportClient(ElasticsearchClientConfiguration.getSettings(getConnectorClusterConfig())).addTransportAddresses(ElasticsearchClientConfiguration.getTransportAddress(getConnectorClusterConfig()));
}

Fixed version (ground truth):
public ESConnectorHelper(ClusterName clusterName) throws ConnectionException, InitializationException {
  super();
  this.clusterName=clusterName;
  String serverIP=System.getProperty("String_Node_Str");
  if (serverIP != null) {
    SERVER_IP=serverIP;
  }
  String serverPort=System.getProperty("String_Node_Str");
  if (serverPort != null) {
    SERVER_PORT=serverPort;
  }
  if (auxConection != null) {
    auxConection=new TransportClient(ElasticsearchClientConfiguration.getSettings(getConnectorClusterConfig())).addTransportAddresses(ElasticsearchClientConfiguration.getTransportAddress(getConnectorClusterConfig()));
  }
}
Program: 169090
Project: 169090
Buggy source:
/** 
 * Constructor
 * @throws InitializationException if an error happens.
 */
public ElasticsearchConnector() throws InitializationException {
  connectorName=ManifestUtil.getConectorName("String_Node_Str");
  datastoreName=ManifestUtil.getDatastoreName("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Constructor.
 * @throws InitializationException if an error happens.
 */
public ElasticsearchConnector() throws InitializationException {
  connectorName=ManifestUtil.getConectorName("String_Node_Str");
  datastoreName=ManifestUtil.getDatastoreName("String_Node_Str");
}
Program: 169091
Project: 169091
Buggy source:
/** 
 * Return de connector Name.
 * @return
 */
@Override public String getConnectorName(){
  return connectorName;
}

Fixed version (ground truth):
/** 
 * Return the connector Name.
 * @return
 */
@Override public String getConnectorName(){
  return connectorName;
}
Program: 169092
Project: 169092
Buggy source:
/** 
 * Return the DataStore Name.
 * @return DataStore Name
 */
@Override public String[] getDatastoreName(){
  return datastoreName;
}

Fixed version (ground truth):
/** 
 * Return the DataStore Name.
 * @return DataStore Name
 */
@Override public String[] getDatastoreName(){
  return datastoreName.clone();
}
Program: 169093
Project: 169093
Buggy source:
public static void main(String[] args) throws InitializationException {
  ElasticsearchConnector cassandraConnector=new ElasticsearchConnector();
  ConnectorApp connectorApp=new ConnectorApp();
  connectorApp.startup(cassandraConnector);
  cassandraConnector.attachShutDownHook();
}

Fixed version (ground truth):
/** 
 * The main method.
 * @param args the arguments
 * @throws InitializationException the initialization exception
 */
public static void main(String[] args) throws InitializationException {
  ElasticsearchConnector cassandraConnector=new ElasticsearchConnector();
  ConnectorApp connectorApp=new ConnectorApp();
  connectorApp.startup(cassandraConnector);
  cassandraConnector.attachShutDownHook();
}
Program: 169094
Project: 169094
Buggy source:
public static TransportAddress[] getTransportAddress(ConnectorClusterConfig config){
  String[] hosts=ConnectorParser.hosts(config.getOptions().get(HOST.getOptionName()));
  String[] ports=ConnectorParser.ports(config.getOptions().get(PORT.getOptionName()));
  TransportAddress[] transportAddresses=new TransportAddress[hosts.length];
  for (int i=0; i < hosts.length; i++) {
    transportAddresses[i]=new InetSocketTransportAddress(hosts[i],Integer.decode(ports[i]));
  }
  return transportAddresses;
}

Fixed version (ground truth):
/** 
 * Gets the transport address.
 * @param config the configuration options.
 * @return the transport address
 */
public static TransportAddress[] getTransportAddress(ConnectorClusterConfig config){
  String[] hosts=ConnectorParser.hosts(config.getOptions().get(HOST.getOptionName()));
  String[] ports=ConnectorParser.ports(config.getOptions().get(PORT.getOptionName()));
  TransportAddress[] transportAddresses=new TransportAddress[hosts.length];
  for (int i=0; i < hosts.length; i++) {
    transportAddresses[i]=new InetSocketTransportAddress(hosts[i],Integer.decode(ports[i]));
  }
  return transportAddresses;
}
Program: 169095
Project: 169095
Buggy source:
/** 
 * Retrieves the Settings using either the Elasticsearch client configuration or the configuration file.
 * @param configuration
 */
public static Settings getSettings(ConnectorClusterConfig configuration){
  Map<String,String> setting=new HashMap<String,String>();
  setting.put(NODE_DATA.getOptionName(),recoverdOptionValue(configuration.getOptions(),NODE_DATA));
  setting.put(NODE_MASTER.getOptionName(),recoverdOptionValue(configuration.getOptions(),NODE_MASTER));
  setting.put(TRANSPORT_SNIFF.getOptionName(),recoverdOptionValue(configuration.getOptions(),TRANSPORT_SNIFF));
  setting.put(COERCE.getOptionName(),recoverdOptionValue(configuration.getOptions(),COERCE));
  setting.put(DYNAMIC.getOptionName(),recoverdOptionValue(configuration.getOptions(),DYNAMIC));
  setting.put(CLUSTER_NAME.getOptionName(),configuration.getName().getName());
  return ImmutableSettings.settingsBuilder().put(setting).build();
}

Fixed version (ground truth):
/** 
 * Retrieves the Settings using either the Elasticsearch client configuration or the configuration file.
 * @param configuration the configuration
 * @return the settings
 */
public static Settings getSettings(ConnectorClusterConfig configuration){
  Map<String,String> setting=new HashMap<String,String>();
  setting.put(NODE_DATA.getOptionName(),recoverdOptionValue(configuration.getOptions(),NODE_DATA));
  setting.put(NODE_MASTER.getOptionName(),recoverdOptionValue(configuration.getOptions(),NODE_MASTER));
  setting.put(TRANSPORT_SNIFF.getOptionName(),recoverdOptionValue(configuration.getOptions(),TRANSPORT_SNIFF));
  setting.put(COERCE.getOptionName(),recoverdOptionValue(configuration.getOptions(),COERCE));
  setting.put(DYNAMIC.getOptionName(),recoverdOptionValue(configuration.getOptions(),DYNAMIC));
  setting.put(CLUSTER_NAME.getOptionName(),configuration.getName().getName());
  return ImmutableSettings.settingsBuilder().put(setting).build();
}
Program: 169096
Project: 169096
Buggy source:
/** 
 * this recovered the option value if it is set. It not return the default value..
 * @param configuration the configuration.
 * @param nodeData      the configuration options.
 * @return the actual value of the option.
 */
private static String recoverdOptionValue(Map<String,String> configuration,ConfigurationOptions nodeData){
  String option;
  if (configuration.containsKey(nodeData.getOptionName())) {
    option=configuration.get(nodeData.getOptionName());
  }
 else {
    option=nodeData.getDefaultValue()[0];
  }
  return option;
}

Fixed version (ground truth):
/** 
 * this recovered the option value if it is set. It not return the default value..
 * @param configuration the configuration.
 * @param nodeData the configuration options.
 * @return the actual value of the option.
 */
private static String recoverdOptionValue(Map<String,String> configuration,ConfigurationOptions nodeData){
  String option;
  if (configuration.containsKey(nodeData.getOptionName())) {
    option=configuration.get(nodeData.getOptionName());
  }
 else {
    option=nodeData.getDefaultValue()[0];
  }
  return option;
}
Program: 169097
Project: 169097
Buggy source:
/** 
 * This method stop a  asynchronous  query in elasticsearch.
 * @param queryId the crossdata query id..
 * @throws UnsupportedException if any query operation is not supported.
 * @throws ExecutionException   if a error happens.
 */
@Override public void stop(String queryId) throws UnsupportedException, ExecutionException {
  throw new UnsupportedException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This method stop a asynchronous query in elasticsearch.
 * @param queryId the crossdata query id. .
 * @throws UnsupportedException if any query operation is not supported.
 * @throws ExecutionException if a error happens.
 */
@Override public void stop(String queryId) throws UnsupportedException, ExecutionException {
  throw new UnsupportedException("String_Node_Str");
}
Program: 169098
Project: 169098
Buggy source:
/** 
 * This method execute a  asynchronous  query in elasticsearch.
 * @param queryId       the crossdata query id.
 * @param workflow      the logical workflow.
 * @param resultHandler the result handler..
 * @throws UnsupportedException if any query operation is not supported.
 * @throws ExecutionException   if a error happens.
 */
@Override public void asyncExecute(String queryId,LogicalWorkflow workflow,IResultHandler resultHandler) throws UnsupportedException, ExecutionException {
  throw new UnsupportedException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This method execute a asynchronous query in elasticsearch.
 * @param queryId the crossdata query id.
 * @param workflow the logical workflow.
 * @param resultHandler the result handler. .
 * @throws UnsupportedException if any query operation is not supported.
 * @throws ExecutionException if a error happens.
 */
@Override public void asyncExecute(String queryId,LogicalWorkflow workflow,IResultHandler resultHandler) throws UnsupportedException, ExecutionException {
  throw new UnsupportedException("String_Node_Str");
}
Program: 169099
Project: 169099
Buggy source:
public ElasticsearchQueryEngine(ConnectionHandler connectionHandle){
  super(connectionHandle);
}

Fixed version (ground truth):
/** 
 * Instantiates a new elasticsearch query engine.
 * @param connectionHandler the connection handler
 */
public ElasticsearchQueryEngine(ConnectionHandler connectionHandle){
  super(connectionHandle);
}
Program: 169100
Project: 169100
Buggy source:
/** 
 * This method execute a query in elasticsearch.
 * @param project    the query project.
 * @param connection the logical connection.
 * @return the result.
 * @throws UnsupportedException if any query operation is not supported.
 * @throws ExecutionException   if a error happens.
 */
@Override protected QueryResult execute(Project project,Connection<Client> connection) throws UnsupportedException, ExecutionException {
  Client elasticClient=connection.getNativeConnection();
  ConnectorQueryData queryData=queryParser.transformLogicalWorkFlow(project);
  SearchRequestBuilder requestBuilder=queryBuilder.buildQuery(elasticClient,queryData);
  return queryExecutor.executeQuery(elasticClient,requestBuilder,queryData);
}

Fixed version (ground truth):
/** 
 * This method execute a query in elasticsearch.
 * @param project the query project.
 * @param connection the logical connection.
 * @return the result.
 * @throws UnsupportedException if any query operation is not supported.
 * @throws ExecutionException if a error happens.
 */
@Override protected QueryResult execute(Project project,Connection<Client> connection) throws UnsupportedException, ExecutionException {
  Client elasticClient=connection.getNativeConnection();
  ConnectorQueryData queryData=queryParser.transformLogicalWorkFlow(project);
  SearchRequestBuilder requestBuilder=queryBuilder.buildQuery(elasticClient,queryData);
  return queryExecutor.executeQuery(elasticClient,requestBuilder,queryData);
}
Program: 169101
Project: 169101
Buggy source:
/** 
 * This method creates a row.
 * @param hit       the Elasticsearch SearchHit.
 * @param queryData
 * @return the row.
 */
private Row createRow(SearchHit hit,ConnectorQueryData queryData) throws ExecutionException {
  Map<ColumnName,String> alias=returnAlias(queryData);
  Map<String,Object> fields=getFields(hit);
  Row row=setRowValues(queryData,alias,fields);
  return row;
}

Fixed version (ground truth):
/** 
 * This method creates a row.
 * @param hit the Elasticsearch SearchHit.
 * @param queryData
 * @return the row.
 */
private Row createRow(SearchHit hit,ConnectorQueryData queryData) throws ExecutionException {
  Map<ColumnName,String> alias=returnAlias(queryData);
  Map<String,Object> fields=getFields(hit);
  Row row=setRowValues(queryData,alias,fields);
  return row;
}
Program: 169102
Project: 169102
Buggy source:
/** 
 * This method creates a row.
 * @param queryData the query data.
 * @param alias     the alias.
 * @param fields    the fields.
 * @return a row.
 */
private Row setRowValues(ConnectorQueryData queryData,Map<ColumnName,String> alias,Map<String,Object> fields) throws ExecutionException {
  Row row=new Row();
  Set<String> fieldNames;
  Select select=queryData.getSelect();
  if (select == null) {
    fieldNames=fields.keySet();
  }
 else {
    fieldNames=createFieldNames(select.getColumnMap().keySet());
  }
  for (  String field : fieldNames) {
    Object value=fields.get(field);
    ColumnName columnName=new ColumnName(queryData.getProjection().getCatalogName(),queryData.getProjection().getTableName().getName(),field);
    if (alias.containsKey(columnName)) {
      field=alias.get(columnName);
    }
    row.addCell(field,new Cell(ColumnTypeHelper.getCastingValue(select.getTypeMapFromColumnName().get(columnName),value)));
  }
  return row;
}

Fixed version (ground truth):
/** 
 * This method creates a row.
 * @param queryData the query data.
 * @param alias the alias.
 * @param fields the fields.
 * @return a row.
 */
private Row setRowValues(ConnectorQueryData queryData,Map<ColumnName,String> alias,Map<String,Object> fields) throws ExecutionException {
  Row row=new Row();
  Set<String> fieldNames;
  Select select=queryData.getSelect();
  if (select == null) {
    fieldNames=fields.keySet();
  }
 else {
    fieldNames=createFieldNames(select.getColumnMap().keySet());
  }
  for (  String field : fieldNames) {
    Object value=fields.get(field);
    ColumnName columnName=new ColumnName(queryData.getProjection().getCatalogName(),queryData.getProjection().getTableName().getName(),field);
    if (alias.containsKey(columnName)) {
      field=alias.get(columnName);
    }
    row.addCell(field,new Cell(ColumnTypeHelper.getCastingValue(select.getTypeMapFromColumnName().get(columnName),value)));
  }
  return row;
}
Program: 169104
Project: 169104
Buggy source:
/** 
 * This method creates the XContentBuilder for a type.
 * @param typeMetadata the type metadata.
 * @return the XContentBuilder that represent the type.
 * @throws UnsupportedException if the type metadata is not supported.
 * @thros ExecutionException if a error occurs.
 */
public XContentBuilder createTypeSource(TableMetadata typeMetadata) throws UnsupportedException, ExecutionException {
  XContentBuilder xContentBuilder=null;
  try {
    xContentBuilder=XContentFactory.jsonBuilder().startObject();
    createId(xContentBuilder);
    createIndexOptions(typeMetadata,xContentBuilder);
    createFieldOptions(typeMetadata,xContentBuilder);
    xContentBuilder.endObject();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + typeMetadata.getName().getName() + "String_Node_Str"+ typeMetadata.getName().getCatalogName()+ "String_Node_Str");
      logger.debug("String_Node_Str" + xContentBuilder.string());
    }
  }
 catch (  IOException e) {
    String msg="String_Node_Str" + e.getMessage();
    logger.error(msg);
    throw new ExecutionException(msg,e);
  }
  try {
    System.out.println("String_Node_Str" + xContentBuilder.string() + "String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return xContentBuilder;
}

Fixed version (ground truth):
/** 
 * This method creates the XContentBuilder for a type.
 * @param typeMetadata the type metadata.
 * @return the XContentBuilder that represent the type.
 * @throws UnsupportedException if the type metadata is not supported.
 * @thros ExecutionException if a error occurs.
 */
public XContentBuilder createTypeSource(TableMetadata typeMetadata) throws UnsupportedException, ExecutionException {
  XContentBuilder xContentBuilder=null;
  try {
    xContentBuilder=XContentFactory.jsonBuilder().startObject();
    createIndexOptions(typeMetadata,xContentBuilder);
    createFieldOptions(typeMetadata,xContentBuilder);
    xContentBuilder.endObject();
    if (logger.isDebugEnabled()) {
      logger.debug("String_Node_Str" + typeMetadata.getName().getName() + "String_Node_Str"+ typeMetadata.getName().getCatalogName()+ "String_Node_Str");
      logger.debug("String_Node_Str" + xContentBuilder.string());
    }
  }
 catch (  IOException e) {
    String msg="String_Node_Str" + e.getMessage();
    logger.error(msg);
    throw new ExecutionException(msg,e);
  }
  try {
    System.out.println("String_Node_Str" + xContentBuilder.string() + "String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  return xContentBuilder;
}
Program: 169105
Project: 169105
Buggy source:
private void createFieldOptions(TableMetadata typeMetadata,XContentBuilder xContentBuilder) throws IOException, UnsupportedException {
  Map<ColumnName,ColumnMetadata> columns=typeMetadata.getColumns();
  if (!columns.isEmpty()) {
    xContentBuilder.startObject("String_Node_Str");
    for (    ColumnName column : columns.keySet()) {
      String columnType=convertType(columns.get(column).getColumnType());
      String name=column.getName();
      xContentBuilder=xContentBuilder.startObject(name).field("String_Node_Str",columnType).endObject();
    }
    xContentBuilder.endObject();
  }
}

Fixed version (ground truth):
private void createFieldOptions(TableMetadata typeMetadata,XContentBuilder xContentBuilder) throws IOException, UnsupportedException {
  xContentBuilder.startObject("String_Node_Str").startObject(typeMetadata.getName().getName());
  createId(xContentBuilder);
  Map<ColumnName,ColumnMetadata> columns=typeMetadata.getColumns();
  if (!columns.isEmpty()) {
    xContentBuilder.startObject("String_Node_Str");
    for (    ColumnName column : columns.keySet()) {
      String columnType=convertType(columns.get(column).getColumnType());
      String name=column.getName();
      xContentBuilder=xContentBuilder.startObject(name).field("String_Node_Str",columnType).endObject();
    }
    xContentBuilder.endObject();
  }
  xContentBuilder.endObject().endObject();
}
Program: 169106
Project: 169106
Buggy source:
private void createIndexOptions(TableMetadata typeMetadata,XContentBuilder xContentBuilder) throws IOException, ExecutionException {
  xContentBuilder.startObject("String_Node_Str").startObject("String_Node_Str");
  Map<Selector,Selector> options=typeMetadata.getOptions();
  for (  Selector leftSelector : options.keySet()) {
    xContentBuilder.field(leftSelector.getStringValue(),SelectorHelper.getValue(options.get(leftSelector)));
  }
  xContentBuilder.endObject().endObject();
}

Fixed version (ground truth):
private void createIndexOptions(TableMetadata typeMetadata,XContentBuilder xContentBuilder) throws IOException, ExecutionException {
  Map<Selector,Selector> options=typeMetadata.getOptions();
  if (!options.isEmpty()) {
    xContentBuilder.startObject("String_Node_Str").startObject("String_Node_Str");
    for (    Selector leftSelector : options.keySet()) {
      xContentBuilder.field(leftSelector.getStringValue(),SelectorHelper.getValue(options.get(leftSelector)));
    }
    xContentBuilder.endObject().endObject();
  }
}
Program: 169107
Project: 169107
Buggy source:
private void createFieldOptions(TableMetadata typeMetadata,XContentBuilder xContentBuilder) throws IOException, UnsupportedException {
  xContentBuilder.startObject("String_Node_Str");
  Map<ColumnName,ColumnMetadata> columns=typeMetadata.getColumns();
  for (  ColumnName column : columns.keySet()) {
    String columnType=convertType(columns.get(column).getColumnType());
    String name=column.getName();
    xContentBuilder=xContentBuilder.startObject(name).field("String_Node_Str",columnType).endObject();
  }
  xContentBuilder.endObject();
}

Fixed version (ground truth):
private void createFieldOptions(TableMetadata typeMetadata,XContentBuilder xContentBuilder) throws IOException, UnsupportedException {
  Map<ColumnName,ColumnMetadata> columns=typeMetadata.getColumns();
  if (!columns.isEmpty()) {
    xContentBuilder.startObject("String_Node_Str");
    for (    ColumnName column : columns.keySet()) {
      String columnType=convertType(columns.get(column).getColumnType());
      String name=column.getName();
      xContentBuilder=xContentBuilder.startObject(name).field("String_Node_Str",columnType).endObject();
    }
    xContentBuilder.endObject();
  }
}
Program: 169108
Project: 169108
Buggy source:
private List<ColumnMetadata> createMetadata(ConnectorQueryData queryData){
  List<ColumnMetadata> retunColumnMetadata=new ArrayList<>();
  for (  ColumnName field : queryData.getSelect().getColumnMap().keySet()) {
    String columnName=field.getName();
    ColumnMetadata columnMetadata=new ColumnMetadata(queryData.getProjection().getTableName().getName(),columnName,queryData.getSelect().getTypeMap().get(columnName));
    columnMetadata.setColumnAlias(queryData.getSelect().getColumnMap().get(field));
    retunColumnMetadata.add(columnMetadata);
  }
  return retunColumnMetadata;
}

Fixed version (ground truth):
private List<ColumnMetadata> createMetadata(ConnectorQueryData queryData){
  List<ColumnMetadata> retunColumnMetadata=new ArrayList<>();
  for (  ColumnName field : queryData.getSelect().getColumnMap().keySet()) {
    String columnName=field.getName();
    ColumnMetadata columnMetadata=new ColumnMetadata(queryData.getProjection().getTableName().getName(),columnName,queryData.getSelect().getTypeMap().get(field.getQualifiedName()));
    columnMetadata.setColumnAlias(queryData.getSelect().getColumnMap().get(field));
    retunColumnMetadata.add(columnMetadata);
  }
  return retunColumnMetadata;
}
Program: 169109
Project: 169109
Buggy source:
public VNTFontListPreference(final Context context,final AttributeSet attrs){
  super(context,attrs);
  final TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.VNTFontListPreference);
  final String fontDirectory=a.getString(R.styleable.VNTFontListPreference_vnt_fontDirectory);
  mFontPreviewString=a.getString(R.styleable.VNTFontListPreference_vnt_fontPreviewString);
  a.recycle();
  try {
    final String[] fonts;
    try {
      fonts=context.getAssets().list(fontDirectory);
    }
 catch (    final NullPointerException e) {
      throw new IllegalStateException("String_Node_Str" + fontDirectory + "String_Node_Str");
    }
    for (    final String font : fonts) {
      final String fontType=font.substring(font.length() - 3);
      if ("String_Node_Str".equals(fontType) || "String_Node_Str".equals(fontType)) {
        mFonts.add(new Font(StringFormatUtils.addAtEndIfNotPresent(fontDirectory,"String_Node_Str") + font));
      }
    }
  }
 catch (  final IOException e) {
    e.printStackTrace();
  }
  if (mFonts.size() == 0) {
    throw new IllegalStateException("String_Node_Str" + fontDirectory + "String_Node_Str");
  }
}

Fixed version (ground truth):
public VNTFontListPreference(final Context context,final AttributeSet attrs){
  super(context,attrs);
  final TypedArray a=context.obtainStyledAttributes(attrs,R.styleable.VNTFontListPreference);
  final String fontDirectory=a.getString(R.styleable.VNTFontListPreference_vnt_fontDirectory);
  mFontPreviewString=a.getString(R.styleable.VNTFontListPreference_vnt_fontPreviewString);
  a.recycle();
  try {
    final String[] fonts;
    try {
      fonts=context.getAssets().list(fontDirectory);
    }
 catch (    final NullPointerException e) {
      throw new IllegalStateException("String_Node_Str" + fontDirectory + "String_Node_Str");
    }
    for (    final String font : fonts) {
      if (font != null && font.length() > 5) {
        final String fontType=font.substring(font.length() - 3);
        if ("String_Node_Str".equals(fontType) || "String_Node_Str".equals(fontType)) {
          mFonts.add(new Font(StringFormatUtils.addAtEndIfNotPresent(fontDirectory,"String_Node_Str") + font));
        }
      }
    }
  }
 catch (  final IOException e) {
    e.printStackTrace();
  }
  if (mFonts.size() == 0) {
    throw new IllegalStateException("String_Node_Str" + fontDirectory + "String_Node_Str");
  }
}
Program: 169110
Project: 169110
Buggy source:
@Before public void setUp(){
  mContext=spy(RuntimeEnvironment.application.getApplicationContext());
  mAssets=spy(RuntimeEnvironment.application.getAssets());
  when(mContext.getAssets()).thenReturn(mAssets);
}

Fixed version (ground truth):
@Before public void setUp(){
  mContext=spy(RuntimeEnvironment.application.getApplicationContext());
  mAssets=spy(RuntimeEnvironment.application.getAssets());
  mAttributeSet=mock(AttributeSet.class);
  doReturn(mAssets).when(mContext).getAssets();
}
Program: 169111
Project: 169111
Buggy source:
@Test(expected=IllegalStateException.class) public void testVNTFontListPreferenceShouldThrowIllegalArgumentExceptionWhenDirectoryCanNotBeFound(){
  new VNTFontListPreference(mContext,mAttributeSet);
}

Fixed version (ground truth):
@Test public void testVNTFontListPreferenceShouldThrowIllegalArgumentExceptionWhenDirectoryCanNotBeFound(){
  expectedException.expect(IllegalStateException.class);
  expectedException.expectMessage("String_Node_Str");
  new VNTFontListPreference(mContext,mAttributeSet);
}
Program: 169112
Project: 169112
Buggy source:
@Test public void testVNTFontListPreferenceShouldFindOTFAndTTFFilesWhenPresentInDirectoryWithSlashAtTheEnd() throws IOException {
  final TypedArray typedArray=mock(TypedArray.class);
  when(typedArray.getString(R.styleable.VNTFontListPreference_vnt_fontDirectory)).thenReturn("String_Node_Str");
  mAttributeSet=any(AttributeSet.class);
  when(mContext.obtainStyledAttributes(mAttributeSet,any(int[].class))).thenReturn(typedArray);
  this.testFindFontsInDirectory("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testVNTFontListPreferenceShouldFindOTFAndTTFFilesWhenPresentInDirectoryWithSlashAtTheEnd() throws IOException {
  final TypedArray typedArray=mock(TypedArray.class);
  doReturn("String_Node_Str").when(typedArray).getString(R.styleable.VNTFontListPreference_vnt_fontDirectory);
  doReturn(typedArray).when(mContext).obtainStyledAttributes(mAttributeSet,R.styleable.VNTFontListPreference);
  this.testFindFontsInDirectory("String_Node_Str");
}
Program: 169113
Project: 169113
Buggy source:
@Test(expected=IllegalStateException.class) public void testVNTFontListPreferenceShouldThrowIllegalArgumentExceptionWhenNoFontsWereFound() throws IOException {
  doReturn(new String[]{}).when(mAssets).list("String_Node_Str");
  new VNTFontListPreference(mContext,mAttributeSet);
}

Fixed version (ground truth):
@Test public void testVNTFontListPreferenceShouldThrowIllegalArgumentExceptionWhenNoFontsWereFound() throws IOException {
  doReturn(new String[]{}).when(mAssets).list("String_Node_Str");
  doReturn(mAssets).when(mContext).getAssets();
  final TypedArray typedArray=mock(TypedArray.class);
  doReturn("String_Node_Str").when(typedArray).getString(R.styleable.VNTFontListPreference_vnt_fontDirectory);
  doReturn(typedArray).when(mContext).obtainStyledAttributes(mAttributeSet,R.styleable.VNTFontListPreference);
  expectedException.expect(IllegalStateException.class);
  expectedException.expectMessage("String_Node_Str");
  new VNTFontListPreference(mContext,mAttributeSet);
}
Program: 169114
Project: 169114
Buggy source:
@Test public void testVNTFontListPreferenceShouldFindOTFAndTTFFilesWhenPresentInDirectoryWithoutSlashAtTheEnd() throws IOException {
  final TypedArray typedArray=mock(TypedArray.class);
  when(typedArray.getString(R.styleable.VNTFontListPreference_vnt_fontDirectory)).thenReturn("String_Node_Str");
  mAttributeSet=any(AttributeSet.class);
  when(mContext.obtainStyledAttributes(mAttributeSet,any(int[].class))).thenReturn(typedArray);
  this.testFindFontsInDirectory("String_Node_Str");
}

Fixed version (ground truth):
@Test public void testVNTFontListPreferenceShouldFindOTFAndTTFFilesWhenPresentInDirectoryWithoutSlashAtTheEnd() throws IOException {
  final TypedArray typedArray=mock(TypedArray.class);
  doReturn("String_Node_Str").when(typedArray).getString(R.styleable.VNTFontListPreference_vnt_fontDirectory);
  doReturn(typedArray).when(mContext).obtainStyledAttributes(mAttributeSet,R.styleable.VNTFontListPreference);
  this.testFindFontsInDirectory("String_Node_Str");
}
Program: 169115
Project: 169115
Buggy source:
private DateTime getDateTime(String strTime){
  DateTime dateTime=null;
  if ((dateTime=tryFormat(strTime,dateTimeWithSubSecAndTZFormat)) == null) {
    if ((dateTime=tryFormat(strTime,dateTimeAndTZFormat)) == null) {
      if ((dateTime=tryFormat(strTime,dateTimeWithSubSecFormat)) == null) {
        if ((dateTime=tryFormat(strTime,dateTimeFormat)) == null) {
          if ((dateTime=tryFormat(strTime,dateOnlyFormat)) == null) {
            return dateTime;
          }
        }
      }
    }
  }
  return dateTime;
}

Fixed version (ground truth):
private DateTime getDateTime(String strTime){
  DateTime dateTime=null;
  if ((dateTime=tryFormat(strTime,dateTimeWithSubSecAndTZFormat)) == null) {
    if ((dateTime=tryFormat(strTime,dateTimeAndTZFormat)) == null) {
      if ((dateTime=tryFormat(strTime,dateTimeWithSubSecFormat)) == null) {
        if ((dateTime=tryFormat(strTime,dateTimeFormat)) == null) {
          if ((dateTime=tryFormat(strTime,dateHourMinOnlyFormat)) == null) {
            if ((dateTime=tryFormat(strTime,dateHourOnlyFormat)) == null) {
              if ((dateTime=tryFormat(strTime,dateOnlyFormat)) == null) {
                return dateTime;
              }
            }
          }
        }
      }
    }
  }
  return dateTime;
}
Program: 169116
Project: 169116
Buggy source:
public final void whereClause(QueryMeta qMeta) throws RecognitionException {
  Filter f=null;
  try {
{
      pushFollow(FOLLOW_intervalClause_in_whereClause867);
      intervalClause(qMeta);
      state._fsp--;
      int alt44=2;
      int LA44_0=input.LA(1);
      if ((LA44_0 == WS)) {
        int LA44_1=input.LA(2);
        if ((LA44_1 == AND)) {
          alt44=1;
        }
      }
switch (alt44) {
case 1:
{
          match(input,WS,FOLLOW_WS_in_whereClause871);
          match(input,AND,FOLLOW_AND_in_whereClause873);
          match(input,WS,FOLLOW_WS_in_whereClause875);
          pushFollow(FOLLOW_grandFilter_in_whereClause879);
          f=grandFilter();
          state._fsp--;
          qMeta.filter=f;
        }
      break;
  }
}
}
 catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
 finally {
}
}

Fixed version (ground truth):
public final void whereClause(QueryMeta qMeta) throws RecognitionException {
  Filter f=null;
  try {
{
      pushFollow(FOLLOW_intervalClause_in_whereClause898);
      intervalClause(qMeta);
      state._fsp--;
      int alt45=2;
      int LA45_0=input.LA(1);
      if ((LA45_0 == WS)) {
        int LA45_1=input.LA(2);
        if ((LA45_1 == AND)) {
          alt45=1;
        }
      }
switch (alt45) {
case 1:
{
          match(input,WS,FOLLOW_WS_in_whereClause902);
          match(input,AND,FOLLOW_AND_in_whereClause904);
          match(input,WS,FOLLOW_WS_in_whereClause906);
          pushFollow(FOLLOW_grandFilter_in_whereClause910);
          f=grandFilter();
          state._fsp--;
          qMeta.filter=f;
        }
      break;
  }
}
}
 catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
 finally {
}
}
Program: 169117
Project: 169117
Buggy source:
public final void selectItems(QueryMeta qMeta) throws RecognitionException {
  AggItem sI1=null;
  try {
    int alt42=2;
    int LA42_0=input.LA(1);
    if ((LA42_0 == COUNT || LA42_0 == DOUBLE_SUM || LA42_0 == JAVASCRIPT || LA42_0 == LONG_SUM || (LA42_0 >= MAX && LA42_0 <= MIN) || LA42_0 == UNIQUE)) {
      alt42=1;
    }
 else     if ((LA42_0 == ID)) {
      alt42=2;
    }
 else {
      NoViableAltException nvae=new NoViableAltException("String_Node_Str",42,0,input);
      throw nvae;
    }
switch (alt42) {
case 1:
{
        pushFollow(FOLLOW_aggItemInSelect_in_selectItems811);
        sI1=aggItemInSelect();
        state._fsp--;
        ((BaseAggQueryMeta)qMeta).aggregations.add(sI1);
      }
    break;
case 2:
{
    pushFollow(FOLLOW_simpleDim_in_selectItems819);
    simpleDim(qMeta);
    state._fsp--;
  }
break;
}
}
 catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
 finally {
}
}

Fixed version (ground truth):
public final void selectItems(QueryMeta qMeta) throws RecognitionException {
  AggItem sI1=null;
  try {
    int alt43=2;
    int LA43_0=input.LA(1);
    if ((LA43_0 == COUNT || LA43_0 == DOUBLE_SUM || LA43_0 == JAVASCRIPT || LA43_0 == LONG_SUM || (LA43_0 >= MAX && LA43_0 <= MIN) || LA43_0 == UNIQUE)) {
      alt43=1;
    }
 else     if ((LA43_0 == ID)) {
      alt43=2;
    }
 else {
      NoViableAltException nvae=new NoViableAltException("String_Node_Str",43,0,input);
      throw nvae;
    }
switch (alt43) {
case 1:
{
        pushFollow(FOLLOW_aggItemInSelect_in_selectItems842);
        sI1=aggItemInSelect();
        state._fsp--;
        ((BaseAggQueryMeta)qMeta).aggregations.add(sI1);
      }
    break;
case 2:
{
    pushFollow(FOLLOW_simpleDim_in_selectItems850);
    simpleDim(qMeta);
    state._fsp--;
  }
break;
}
}
 catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
 finally {
}
}
Program: 169119
Project: 169119
Buggy source:
public final PostAggItem fieldAccess() throws RecognitionException {
  PostAggItem postAggItem=null;
  Token a=null;
  postAggItem=new PostAggItem("String_Node_Str");
  try {
{
{
        a=(Token)match(input,ID,FOLLOW_ID_in_fieldAccess2278);
        int alt129=2;
        int LA129_0=input.LA(1);
        if ((LA129_0 == WS)) {
          int LA129_1=input.LA(2);
          if ((LA129_1 == AS)) {
            alt129=1;
          }
        }
switch (alt129) {
case 1:
{
            match(input,WS,FOLLOW_WS_in_fieldAccess2281);
            pushFollow(FOLLOW_postAggLabel_in_fieldAccess2283);
            postAggLabel(postAggItem);
            state._fsp--;
          }
        break;
    }
  }
  postAggItem.fieldName=(a != null ? a.getText() : null);
}
}
 catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
 finally {
}
return postAggItem;
}

Fixed version (ground truth):
public final PostAggItem fieldAccess() throws RecognitionException {
  PostAggItem postAggItem=null;
  Token a=null;
  postAggItem=new PostAggItem("String_Node_Str");
  try {
{
{
        a=(Token)match(input,ID,FOLLOW_ID_in_fieldAccess2309);
        int alt130=2;
        int LA130_0=input.LA(1);
        if ((LA130_0 == WS)) {
          int LA130_1=input.LA(2);
          if ((LA130_1 == AS)) {
            alt130=1;
          }
        }
switch (alt130) {
case 1:
{
            match(input,WS,FOLLOW_WS_in_fieldAccess2312);
            pushFollow(FOLLOW_postAggLabel_in_fieldAccess2314);
            postAggLabel(postAggItem);
            state._fsp--;
          }
        break;
    }
  }
  postAggItem.fieldName=(a != null ? a.getText() : null);
}
}
 catch (RecognitionException re) {
reportError(re);
recover(input,re);
}
 finally {
}
return postAggItem;
}
Program: 169120
Project: 169120
Buggy source:
public final Filter selectorFilter() throws RecognitionException {
  Filter filter=null;
  EqualsToHolder e=null;
  filter=new Filter("String_Node_Str");
  try {
{
      pushFollow(FOLLOW_getEquals_in_selectorFilter1597);
      e=getEquals();
      state._fsp--;
      filter.dimension=e.name;
      filter.value=e.value;
      if (filter.value.startsWith("String_Node_Str") && filter.value.endsWith("String_Node_Str")) {
        filter.value=filter.value.substring(1,filter.value.length() - 1);
      }
    }
  }
 catch (  RecognitionException re) {
    reportError(re);
    recover(input,re);
  }
 finally {
  }
  return filter;
}

Fixed version (ground truth):
public final Filter selectorFilter() throws RecognitionException {
  Filter filter=null;
  EqualsToHolder e=null;
  filter=new Filter("String_Node_Str");
  try {
{
      pushFollow(FOLLOW_getEquals_in_selectorFilter1628);
      e=getEquals();
      state._fsp--;
      filter.dimension=e.name;
      filter.value=e.value;
      if (filter.value.startsWith("String_Node_Str") && filter.value.endsWith("String_Node_Str")) {
        filter.value=filter.value.substring(1,filter.value.length() - 1);
      }
    }
  }
 catch (  RecognitionException re) {
    reportError(re);
    recover(input,re);
  }
 finally {
  }
  return filter;
}