nus-yam/ex-repair huggingface dataset:
Program: 82054
Project: 82054
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Node createNode(GraphDatabaseService database){
  Node node=database.createNode(getPersonLabel());
  Pair<Label,String> genderAndName=getGenderAndName();
  node.addLabel(genderAndName.first());
  node.setProperty(NAME,genderAndName.second());
  return node;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public long createNode(BatchInserter batchInserter){
  Pair<Label,String> genderAndName=getGenderAndName();
  return batchInserter.createNode(Collections.<String,Object>singletonMap(NAME,genderAndName.second()),genderAndName.first());
}
Program: 82055
Project: 82055
Buggy source:
/** 
 * Create a relationship between two nodes with properties.
 * @param first  first node.
 * @param second second node.
 * @return created relationship.
 */
Relationship createRelationship(Node first,Node second);

Fixed version (ground truth):
/** 
 * Create a relationship between two nodes with properties.
 * @param first         first node ID.
 * @param second        second node ID.
 * @param batchInserter to use when creating relationship.
 * @return created relationship ID.
 */
long createRelationship(long first,long second,BatchInserter batchInserter);
Program: 82056
Project: 82056
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public Relationship createRelationship(Node first,Node second){
  return first.createRelationshipTo(second,FRIEND_OF);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public long createRelationship(long first,long second,BatchInserter batchInserter){
  return batchInserter.createRelationship(first,second,FRIEND_OF,Collections.EMPTY_MAP);
}
Program: 82057
Project: 82057
Buggy source:
public BarabasiAlbertRelationshipGenerator(BarabasiAlbertConfig configuration){
  super(configuration);
}

Fixed version (ground truth):
/** 
 * Create a new generator.
 * @param configuration of the generator.
 */
public BarabasiAlbertRelationshipGenerator(BarabasiAlbertConfig configuration){
  super(configuration);
}
Program: 82058
Project: 82058
Buggy source:
/** 
 * {@inheritDoc}<p/> Generates a network according to Barabasi-Albert preferential attachment model. Each newly added node has a probability weighted by the node degree to be attached. <p/> Since BA references (Newmann, Barabasi-Albert) do not define strict conditions on initial state of the model, completelly connected network is used to start up the algorithm
 */
@Override protected List<SameTypePair<Integer>> doGenerateEdges(){
  int edgesPerNewNode=getConfiguration().getEdgesPerNewNode();
  CompleteGraphRelationshipGenerator coreGenerator=new CompleteGraphRelationshipGenerator(new NumberOfNodesBasedConfig(edgesPerNewNode + 1));
  List<SameTypePair<Integer>> edges=coreGenerator.doGenerateEdges();
  System.out.println(edges);
  ArrayList<Integer> degrees=new ArrayList<>();
  for (int k=0; k < edgesPerNewNode + 1; ++k) {
    for (int l=0; l < edgesPerNewNode; ++l) {
      degrees.add(k);
    }
  }
  RandomIndexChoice randomIndexChoice=new RandomIndexChoice();
  for (int node=edgesPerNewNode + 1; node < getConfiguration().getNumberOfNodes(); ++node) {
    Set<Integer> omit=new HashSet<>();
    for (int edge=0; edge < edgesPerNewNode; ++edge) {
      while (true) {
        int target=randomIndexChoice.randomIndexChoice(degrees.size());
        if (omit.contains(degrees.get(target)))         continue;
        omit.add(degrees.get(target));
        edges.add(new UnorderedPair<>(degrees.get(target),node));
        degrees.add(node);
        break;
      }
    }
  }
  return edges;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}<p/>
 */
@Override protected List<SameTypePair<Integer>> doGenerateEdges(){
  int edgesPerNewNode=getConfiguration().getEdgesPerNewNode();
  int numberOfNodes=getConfiguration().getNumberOfNodes();
  List<SameTypePair<Integer>> edges=new CompleteGraphRelationshipGenerator(new NumberOfNodesBasedConfig(edgesPerNewNode + 1)).doGenerateEdges();
  List<Integer> degrees=new ArrayList<>(2 * (numberOfNodes * edgesPerNewNode - (edgesPerNewNode * (edgesPerNewNode - 1)) / 2));
  for (int k=0; k < edgesPerNewNode + 1; k++) {
    for (int l=0; l < edgesPerNewNode; l++) {
      degrees.add(k);
    }
  }
  Set<Integer> omit=new HashSet<>(edgesPerNewNode);
  for (int source=edgesPerNewNode + 1; source < numberOfNodes; source++) {
    omit.clear();
    for (int edge=0; edge < edgesPerNewNode; edge++) {
      while (true) {
        int target=degrees.get(random.nextInt(degrees.size()));
        if (omit.contains(target)) {
          continue;
        }
        omit.add(target);
        edges.add(new UnorderedPair<>(target,source));
        degrees.add(source);
        degrees.add(target);
        break;
      }
    }
  }
  return edges;
}
Program: 82059
Project: 82059
Buggy source:
@Test(timeout=10 * 1000) public void shouldGenerateRelationshipsForLargeGraphInAReasonableAmountOfTime(){
}

Fixed version (ground truth):
@Test(timeout=20 * 1000) public void shouldGenerateRelationshipsForLargeGraphInAReasonableAmountOfTime(){
}
Program: 82060
Project: 82060
Buggy source:
/** 
 * TODO: Accept set on the output? (since the graph is simple) <p/> This algorithm is implemented as recommended in <p/> Efficient generation of large random networks by Vladimir Batagelj and Ulrik Brandes <p/> PHYSICAL REVIEW E 71, 036113, 2005 <p/> and relies on excellent hashing performance of Java implementation of HashSet.
 * @return edge list
 */
protected List<SameTypePair<Integer>> doGenerateEdgesSimpler(){
  int numberOfNodes=getConfiguration().getNumberOfNodes();
  int numberOfEdges=getConfiguration().getNumberOfEdges();
  int origin;
  int target;
  RandomIndexChoice indexChoice=new RandomIndexChoice();
  HashSet<SameTypePair<Integer>> edges=new HashSet<>();
  for (int e=0; e < numberOfEdges; ++e) {
    while (true) {
      origin=indexChoice.randomIndexChoice(numberOfNodes);
      target=indexChoice.randomIndexChoice(numberOfNodes,origin);
      UnorderedPair<Integer> candidate=new UnorderedPair<>(origin,target);
      if (!edges.contains(candidate)) {
        edges.add(candidate);
        break;
      }
    }
  }
  return new ArrayList<>(edges);
}

Fixed version (ground truth):
/** 
 * This algorithm is implemented as recommended in <p/> Efficient generation of large random networks by Vladimir Batagelj and Ulrik Brandes <p/> PHYSICAL REVIEW E 71, 036113, 2005 <p/> and relies on excellent hashing performance of Java implementation of HashSet.
 * @return edge list
 */
private List<SameTypePair<Integer>> doGenerateEdgesSimpler(){
  int numberOfNodes=getConfiguration().getNumberOfNodes();
  int numberOfEdges=getConfiguration().getNumberOfEdges();
  HashSet<SameTypePair<Integer>> edges=new HashSet<>();
  while (edges.size() < numberOfEdges) {
    int origin=random.nextInt(numberOfNodes);
    int target=random.nextInt(numberOfNodes);
    if (target == origin) {
      continue;
    }
    edges.add(new UnorderedPair<>(origin,target));
  }
  return new ArrayList<>(edges);
}
Program: 82061
Project: 82061
Buggy source:
/** 
 * Improved implementation of Erdos-Renyi generator based on bijection from edge labels to edge realisations. Works very well for large number of nodes, but is slow with increasing number of edges. Best for denser networks, with a clear giant component. <p/> TODO: Remove the bijection iteration and optimise duplicity test? (effectivelly hashing)
 * @return edge list
 */
protected List<SameTypePair<Integer>> doGenerateEdgesFaster(){
  int numberOfNodes=getConfiguration().getNumberOfNodes();
  int numberOfEdges=getConfiguration().getNumberOfEdges();
  long maxEdges=numberOfNodes * (numberOfNodes - 1) / 2;
  LinkedList<SameTypePair<Integer>> edges=new LinkedList<>();
  PriorityQueue<Long> omitList=new PriorityQueue<>();
  RandomIndexChoice indexChoice=new RandomIndexChoice();
  for (int e=0; e < numberOfEdges; ++e) {
    long choice=indexChoice.randomIndexChoice(maxEdges,omitList);
    omitList.add(choice);
    UnorderedPair<Integer> edge=indexToEdgeBijection(choice,numberOfNodes);
    edges.add(edge);
  }
  return edges;
}

Fixed version (ground truth):
/** 
 * Improved implementation of Erdos-Renyi generator based on bijection from edge labels to edge realisations. Works very well for large number of nodes, but is slow with increasing number of edges. Best for denser networks, with a clear giant component. <p/> TODO: Remove the bijection iteration and optimise duplicity test? (effectivelly hashing)
 * @return edge list
 */
protected List<SameTypePair<Integer>> doGenerateEdgesFaster(){
  int numberOfNodes=getConfiguration().getNumberOfNodes();
  int numberOfEdges=getConfiguration().getNumberOfEdges();
  long maxEdges=numberOfNodes * (numberOfNodes - 1) / 2;
  List<SameTypePair<Integer>> edges=new LinkedList<>();
  PriorityQueue<Long> omitList=new PriorityQueue<>();
  RandomIndexChoice indexChoice=new RandomIndexChoice();
  for (int e=0; e < numberOfEdges; ++e) {
    long choice=indexChoice.randomIndexChoice(maxEdges,omitList);
    omitList.add(choice);
    UnorderedPair<Integer> edge=indexToEdgeBijection(choice,numberOfNodes);
    edges.add(edge);
  }
  return edges;
}
Program: 82062
Project: 82062
Buggy source:
/** 
 * The final algorithm has a switch from sparse ER graph to dense ER graph generator. The sparse algorithm is based on trial-correction method as suggested in the paper cited below. This is extremelly inefficient for nearly-complete graphs. The dense algorithm (written by myself) is based on careful avoiding edge indices in the selection. There might be some tweaks possible for this approach as well, as at the present stage a PriorityQueue is used and iterated over for the edge label avoidance. <p/> The switch allows to generate even complete graphs (eg. (V, E) = (20, 190) in a reasonable time. The switch is turned on to dense graph generator for the case when number of edges requested is a half of total possible edges to be generated.
 * @return list of edges in the network.
 */
protected List<SameTypePair<Integer>> doGenerateEdges(){
  if (4 * getConfiguration().getNumberOfEdges() > getConfiguration().getNumberOfNodes() * (getConfiguration().getNumberOfNodes() - 1)) {
    return doGenerateEdgesFaster();
  }
 else {
    return doGenerateEdgesSimpler();
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override protected List<SameTypePair<Integer>> doGenerateEdges(){
  long threshold=getConfiguration().getNumberOfEdges() * 4;
  long potentialEdges=getConfiguration().getNumberOfNodes() * (getConfiguration().getNumberOfNodes() - 1);
  return doGenerateEdgesSimpler();
}
Program: 82063
Project: 82063
Buggy source:
public ErdosRenyiRelationshipGenerator(ErdosRenyiConfig configuration){
  super(configuration);
}

Fixed version (ground truth):
/** 
 * Construct a new generator.
 * @param configuration of the generator.
 */
public ErdosRenyiRelationshipGenerator(ErdosRenyiConfig configuration){
  super(configuration);
}
Program: 82064
Project: 82064
Buggy source:
@Test(timeout=60 * 1000) @Ignore public void shouldGenerateRelationshipsForLargeGraphInAReasonableAmountOfTime(){
}

Fixed version (ground truth):
@Test(timeout=60 * 1000) public void shouldGenerateRelationshipsForLargeGraphInAReasonableAmountOfTime(){
}
Program: 82065
Project: 82065
Buggy source:
/** 
 * Take string as input, and either return an instance or return null.
 * @param bics string in "bigintcs:HHHHHH-HHHHHH-CCCCCC" format
 * @return big integer string checksum objectOR  null if incorrect format, error parsing, etc.
 */
public static BigIntStringChecksum fromStringOrNull(String bics){
  BigIntStringChecksum ret;
  if (bics == null) {
    ret=null;
  }
 else   if (!startsWithPrefix(bics)) {
    ret=null;
  }
 else {
    try {
      ret=fromString(bics);
      if (ret.asBigInteger() == null) {
        throw new SecretShareException("String_Node_Str" + bics + "String_Node_Str");
      }
    }
 catch (    SecretShareException e) {
      ret=null;
    }
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Take string as input, and either return an instance or return null.
 * @param bics string in "bigintcs:hhhhhh-hhhhhh-CCCCCC" format
 * @return big integer string checksum objectOR  null if incorrect format, error parsing, etc.
 */
public static BigIntStringChecksum fromStringOrNull(String bics){
  BigIntStringChecksum ret;
  if (bics == null) {
    ret=null;
  }
 else   if (!startsWithPrefix(bics)) {
    ret=null;
  }
 else {
    try {
      ret=fromString(bics);
      if (ret.asBigInteger() == null) {
        throw new SecretShareException("String_Node_Str" + bics + "String_Node_Str");
      }
    }
 catch (    SecretShareException e) {
      ret=null;
    }
  }
  return ret;
}
Program: 82066
Project: 82066
Buggy source:
/** 
 * Utility to test if the input string can even -possibly- be a BigIntStringChecksum encoded. This is check is "necessary, but not sufficient" for the input string to parse correctly.
 * @param input the string to check
 * @return true if the string starts withBigIntStringChecksum.PREFIX_BIGINT_DASH_CHECKSUM false all other cases
 */
public static boolean startsWithPrefix(final String input){
  boolean ret=false;
  if (input != null) {
    ret=input.startsWith(PREFIX_BIGINT_DASH_CHECKSUM);
  }
 else {
    ret=false;
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Utility to test if the input string can even -possibly- be a BigIntStringChecksum encoded. This is check is "necessary, but not sufficient" for the input string to parse correctly.
 * @param input the string to check
 * @return true if the string starts with (case-insensitive)BigIntStringChecksum.PREFIX_BIGINT_DASH_CHECKSUM false all other cases
 */
public static boolean startsWithPrefix(final String input){
  boolean ret=false;
  if (input != null) {
    ret=input.toLowerCase().startsWith(PREFIX_BIGINT_DASH_CHECKSUM);
  }
 else {
    ret=false;
  }
  return ret;
}
Program: 82068
Project: 82068
Buggy source:
/** 
 * Test from the documentation on the leading "-".
 */
@Test public void testLeadingDash(){
  final String sameValue="String_Node_Str";
  final String sameChecksum="String_Node_Str";
  BigInteger okNeg100=BigIntStringChecksum.fromString("String_Node_Str" + "String_Node_Str" + sameValue + sameChecksum).asBigInteger();
  Assert.assertEquals("String_Node_Str",new BigInteger("String_Node_Str"),okNeg100);
  try {
    BigInteger failNeg100=BigIntStringChecksum.fromString("String_Node_Str" + "String_Node_Str" + sameValue + sameChecksum).asBigInteger();
    Assert.fail("String_Node_Str" + failNeg100);
  }
 catch (  SecretShareException e) {
  }
}

Fixed version (ground truth):
/** 
 * Test from the documentation on the leading "-". i.e. make sure the leading "-" is part of the checksum computation.
 */
@Test public void testLeadingDash(){
  final String sameValue="String_Node_Str";
  final String sameChecksum="String_Node_Str";
  BigInteger okNeg100=BigIntStringChecksum.fromString("String_Node_Str" + "String_Node_Str" + sameValue + sameChecksum).asBigInteger();
  Assert.assertEquals("String_Node_Str",new BigInteger("String_Node_Str"),okNeg100);
  try {
    BigInteger failNeg100=BigIntStringChecksum.fromString("String_Node_Str" + "String_Node_Str" + sameValue + sameChecksum).asBigInteger();
    Assert.fail("String_Node_Str" + failNeg100);
  }
 catch (  SecretShareException e) {
  }
}
Program: 82070
Project: 82070
Buggy source:
private BlurIndex openShard(String table,String shard) throws IOException {
  LOG.info("String_Node_Str",shard,table);
  TableContext tableContext=getTableContext(table);
  Path tablePath=tableContext.getTablePath();
  Path hdfsDirPath=new Path(tablePath,shard);
  BlurLockFactory lockFactory=new BlurLockFactory(_configuration,hdfsDirPath,_nodeName,BlurUtil.getPid());
  HdfsDirectory longTermStorage=new HdfsDirectory(_configuration,hdfsDirPath,_sequentialReadControl);
  longTermStorage.setLockFactory(lockFactory);
  boolean disableFast=tableContext.getBlurConfiguration().getBoolean(BLUR_TABLE_DISABLE_FAST_DIR,false);
  Directory directory=DirectoryUtil.getDirectory(_configuration,longTermStorage,disableFast,_hdfsKeyValueTimer,table,shard,false);
  ShardContext shardContext=ShardContext.create(tableContext,shard);
  TableDescriptor descriptor=tableContext.getDescriptor();
  boolean blockCacheEnabled=descriptor.isBlockCaching();
  if (blockCacheEnabled) {
    Set<String> blockCacheFileTypes=descriptor.getBlockCachingFileTypes();
    directory=_blockCacheDirectoryFactory.newDirectory(table,shard,directory,blockCacheFileTypes);
  }
  BlurIndex index=tableContext.newInstanceBlurIndex(shardContext,directory,_mergeScheduler,_searchExecutor,_indexCloser,_indexImporterTimer,_indexBulkTimer,_thriftCache);
  if (_clusterStatus.isReadOnly(true,_cluster,table)) {
    index=new BlurIndexReadOnly(index);
  }
  _filterCache.opening(table,shard,index);
  return index;
}

Fixed version (ground truth):
private BlurIndex openShard(String table,String shard) throws IOException {
  LOG.info("String_Node_Str",shard,table);
  TableContext tableContext=getTableContext(table);
  Path tablePath=tableContext.getTablePath();
  Path hdfsDirPath=new Path(tablePath,shard);
  BlurLockFactory lockFactory=new BlurLockFactory(_configuration,hdfsDirPath,_nodeName,BlurUtil.getPid());
  HdfsDirectory longTermStorage=new HdfsDirectory(_configuration,hdfsDirPath,_sequentialReadControl);
  longTermStorage.setLockFactory(lockFactory);
  boolean disableFast=tableContext.getBlurConfiguration().getBoolean(BLUR_TABLE_DISABLE_FAST_DIR,false);
  Directory directory=DirectoryUtil.getDirectory(_configuration,longTermStorage,disableFast,_hdfsKeyValueTimer,table,shard,false);
  ShardContext shardContext=ShardContext.create(tableContext,shard);
  TableDescriptor descriptor=tableContext.getDescriptor();
  boolean blockCacheEnabled=descriptor.isBlockCaching();
  if (blockCacheEnabled) {
    Set<String> blockCacheFileTypes=descriptor.getBlockCachingFileTypes();
    directory=_blockCacheDirectoryFactory.newDirectory(table,shard,directory,blockCacheFileTypes);
  }
  BlurIndex index=tableContext.newInstanceBlurIndex(shardContext,directory,_mergeScheduler,_searchExecutor,_indexCloser,_indexImporterTimer,_indexBulkTimer,_thriftCache,_indexIdleWriterTimer,_maxWriterIdle);
  if (_clusterStatus.isReadOnly(true,_cluster,table)) {
    index=new BlurIndexReadOnly(index);
  }
  _filterCache.opening(table,shard,index);
  return index;
}
Program: 82072
Project: 82072
Buggy source:
private Map<String,BlurIndex> openFromDisk() throws IOException {
  String table=_tableContext.getDescriptor().getName();
  Path tablePath=_tableContext.getTablePath();
  File tableFile=new File(tablePath.toUri());
  if (tableFile.isDirectory()) {
    Map<String,BlurIndex> shards=new ConcurrentHashMap<String,BlurIndex>();
    int shardCount=_tableContext.getDescriptor().getShardCount();
    for (int i=0; i < shardCount; i++) {
      Directory directory;
      String shardName=ShardUtil.getShardName(BlurConstants.SHARD_PREFIX,i);
      if (_ramDir) {
        directory=new RAMDirectory();
      }
 else {
        File file=new File(tableFile,shardName);
        file.mkdirs();
        directory=new MMapDirectory(file);
      }
      if (!DirectoryReader.indexExists(directory)) {
        new IndexWriter(directory,new IndexWriterConfig(LUCENE_VERSION,new KeywordAnalyzer())).close();
      }
      shards.put(shardName,openIndex(table,shardName,directory));
    }
    return shards;
  }
  throw new IOException("String_Node_Str" + table + "String_Node_Str");
}

Fixed version (ground truth):
private Map<String,BlurIndex> openFromDisk() throws IOException {
  String table=_tableContext.getDescriptor().getName();
  Path tablePath=_tableContext.getTablePath();
  Configuration configuration=_tableContext.getConfiguration();
  FileSystem fileSystem=tablePath.getFileSystem(configuration);
  if (fileSystem.isDirectory(tablePath)) {
    Map<String,BlurIndex> shards=new ConcurrentHashMap<String,BlurIndex>();
    int shardCount=_tableContext.getDescriptor().getShardCount();
    for (int i=0; i < shardCount; i++) {
      String shardName=ShardUtil.getShardName(BlurConstants.SHARD_PREFIX,i);
      Path hdfsPath=new Path(tablePath,shardName);
      Directory directory=new HdfsDirectory(configuration,hdfsPath);
      BlurLockFactory lockFactory=new BlurLockFactory(configuration,hdfsPath,getNodeName(),BlurUtil.getPid());
      directory.setLockFactory(lockFactory);
      shards.put(shardName,openIndex(table,shardName,directory));
    }
    return shards;
  }
  throw new IOException("String_Node_Str" + table + "String_Node_Str");
}
Program: 82073
Project: 82073
Buggy source:
private BlurIndex openIndex(String table,String shard,Directory dir) throws CorruptIndexException, IOException {
  ShardContext shardContext=ShardContext.create(_tableContext,shard);
  BlurIndexSimpleWriter index=new BlurIndexSimpleWriter(shardContext,dir,_mergeScheduler,_searchExecutor,_indexCloser,_timer,_bulkTimer,null);
  return index;
}

Fixed version (ground truth):
private BlurIndex openIndex(String table,String shard,Directory dir) throws CorruptIndexException, IOException {
  ShardContext shardContext=ShardContext.create(_tableContext,shard);
  BlurIndexSimpleWriter index=new BlurIndexSimpleWriter(shardContext,dir,_mergeScheduler,_searchExecutor,_indexCloser,_timer,_bulkTimer,null,_closerTimer,_maxWriterIdle);
  return index;
}
Program: 82074
Project: 82074
Buggy source:
public LocalIndexServer(TableDescriptor tableDescriptor,boolean ramDir) throws IOException {
  _timer=new Timer("String_Node_Str",true);
  _bulkTimer=new Timer("String_Node_Str",true);
  _closer=Closer.create();
  _tableContext=TableContext.create(tableDescriptor);
  _mergeScheduler=_closer.register(new SharedMergeScheduler(3,128 * 1000 * 1000));
  _searchExecutor=Executors.newCachedThreadPool();
  _closer.register(new CloseableExecutorService(_searchExecutor));
  _ramDir=ramDir;
  _indexCloser=_closer.register(new BlurIndexCloser());
  _closer.register(new Closeable(){
    @Override public void close() throws IOException {
      _timer.cancel();
      _timer.purge();
    }
  }
);
  getIndexes(_tableContext.getTable());
}

Fixed version (ground truth):
public LocalIndexServer(TableDescriptor tableDescriptor) throws IOException {
  _timer=new Timer("String_Node_Str",true);
  _bulkTimer=new Timer("String_Node_Str",true);
  _closerTimer=new Timer("String_Node_Str",true);
  _maxWriterIdle=TimeUnit.SECONDS.toMillis(30);
  _closer=Closer.create();
  _tableContext=TableContext.create(tableDescriptor);
  _mergeScheduler=_closer.register(new SharedMergeScheduler(3,128 * 1000 * 1000));
  _searchExecutor=Executors.newCachedThreadPool();
  _closer.register(new CloseableExecutorService(_searchExecutor));
  _indexCloser=_closer.register(new BlurIndexCloser());
  _closer.register(new Closeable(){
    @Override public void close() throws IOException {
      _timer.cancel();
      _timer.purge();
    }
  }
);
  getIndexes(_tableContext.getTable());
}
Program: 82075
Project: 82075
Buggy source:
public BlurIndex(ShardContext shardContext,Directory directory,SharedMergeScheduler mergeScheduler,ExecutorService searchExecutor,BlurIndexCloser indexCloser,Timer indexImporterTimer,Timer bulkIndexingTimer,ThriftCache thriftCache) throws IOException {
  _shardContext=shardContext;
}

Fixed version (ground truth):
public BlurIndex(ShardContext shardContext,Directory directory,SharedMergeScheduler mergeScheduler,ExecutorService searchExecutor,BlurIndexCloser indexCloser,Timer indexImporterTimer,Timer bulkIndexingTimer,ThriftCache thriftCache,Timer indexWriterTimer,long maxWriterIdle) throws IOException {
  _shardContext=shardContext;
}
Program: 82076
Project: 82076
Buggy source:
public BlurIndexReadOnly(BlurIndex blurIndex) throws IOException {
  super(null,null,null,null,null,null,null,null);
  _blurIndex=blurIndex;
}

Fixed version (ground truth):
public BlurIndexReadOnly(BlurIndex blurIndex) throws IOException {
  super(null,null,null,null,null,null,null,null,null,0);
  _blurIndex=blurIndex;
}
Program: 82078
Project: 82078
Buggy source:
private boolean isEscaped(String text,int pos){
  if (pos == 0) {
    return false;
  }
  return text.charAt(pos) == '\\';
}

Fixed version (ground truth):
private boolean isEscaped(String text,int pos){
  if (pos <= 0) {
    return false;
  }
  return text.charAt(pos) == '\\';
}
Program: 82079
Project: 82079
Buggy source:
private HdfsDirectory getHdfsDirectory(Directory dir) throws IOException {
  if (dir instanceof HdfsDirectory) {
    return (HdfsDirectory)dir;
  }
 else   if (dir instanceof DirectoryDecorator) {
    DirectoryDecorator decorator=(DirectoryDecorator)dir;
    return getHdfsDirectory(decorator.getOriginalDirectory());
  }
 else {
    throw new IOException("String_Node_Str" + dir + "String_Node_Str");
  }
}

Fixed version (ground truth):
private HdfsDirectory getHdfsDirectory(Directory dir) throws IOException {
  if (dir instanceof HdfsDirectory) {
    return (HdfsDirectory)dir;
  }
 else   if (dir instanceof DirectoryDecorator) {
    DirectoryDecorator decorator=(DirectoryDecorator)dir;
    return getHdfsDirectory(decorator.getOriginalDirectory());
  }
 else   if (dir instanceof JoinDirectory) {
    JoinDirectory directory=(JoinDirectory)dir;
    return directory.getSymlinkDirectory();
  }
 else {
    throw new IOException("String_Node_Str" + dir + "String_Node_Str");
  }
}
Program: 82080
Project: 82080
Buggy source:
/** 
 * Adds document discover visibility rule to document.
 */
public abstract Iterable<IndexableField> addDiscoverVisiblity(String discover,Iterable<IndexableField> fields);

Fixed version (ground truth):
/** 
 * Adds document discover visibility rule to document.
 */
public abstract Iterable<? extends IndexableField> addDiscoverVisiblity(String discover,Iterable<? extends IndexableField> fields);
Program: 82081
Project: 82081
Buggy source:
/** 
 * Adds a read mask to document. If a field has been masked the value can not be viewed, but if a search utilizes the tokens from the field the document can be found.
 */
public abstract Iterable<IndexableField> addReadMask(String fieldToMask,Iterable<IndexableField> fields);

Fixed version (ground truth):
/** 
 * Adds a read mask to document. If a field has been masked the value can not be viewed, but if a search utilizes the tokens from the field the document can be found.
 */
public abstract Iterable<? extends IndexableField> addReadMask(String fieldToMask,Iterable<? extends IndexableField> fields);
Program: 82082
Project: 82082
Buggy source:
protected Iterable<IndexableField> addField(Iterable<IndexableField> fields,IndexableField... fieldsToAdd){
  if (fields instanceof Document) {
    Document document=(Document)fields;
    if (fieldsToAdd != null) {
      for (      IndexableField field : fieldsToAdd) {
        document.add(field);
      }
    }
    return document;
  }
  List<IndexableField> list=new ArrayList<IndexableField>();
  for (  IndexableField indexableField : fields) {
    list.add(indexableField);
  }
  if (fieldsToAdd != null) {
    for (    IndexableField field : fieldsToAdd) {
      list.add(field);
    }
  }
  return list;
}

Fixed version (ground truth):
protected Iterable<? extends IndexableField> addField(Iterable<? extends IndexableField> fields,IndexableField... fieldsToAdd){
  if (fields instanceof Document) {
    Document document=(Document)fields;
    if (fieldsToAdd != null) {
      for (      IndexableField field : fieldsToAdd) {
        document.add(field);
      }
    }
    return document;
  }
  List<IndexableField> list=new ArrayList<IndexableField>();
  for (  IndexableField indexableField : fields) {
    list.add(indexableField);
  }
  if (fieldsToAdd != null) {
    for (    IndexableField field : fieldsToAdd) {
      list.add(field);
    }
  }
  return list;
}
Program: 82083
Project: 82083
Buggy source:
/** 
 * Adds document read visibility rule to document.
 */
public abstract Iterable<IndexableField> addReadVisiblity(String read,Iterable<IndexableField> fields);

Fixed version (ground truth):
/** 
 * Adds document read visibility rule to document.
 */
public abstract Iterable<? extends IndexableField> addReadVisiblity(String read,Iterable<? extends IndexableField> fields);
Program: 82084
Project: 82084
Buggy source:
/** 
 * This method should be called as the document is being added to the index writer.
 * @param fields
 * @return
 */
public abstract Iterable<IndexableField> lastStepBeforeIndexing(Iterable<IndexableField> fields);

Fixed version (ground truth):
/** 
 * This method should be called as the document is being added to the index writer.
 * @param fields
 * @return
 */
public abstract Iterable<? extends IndexableField> lastStepBeforeIndexing(Iterable<? extends IndexableField> fields);
Program: 82085
Project: 82085
Buggy source:
private static Set<String> getFieldsToMask(Iterable<IndexableField> fields){
  Set<String> result=new HashSet<String>();
  for (  IndexableField field : fields) {
    if (field.name().equals(READ_MASK_FIELD)) {
      result.add(getFieldNameOnly(field.stringValue()));
    }
  }
  return result;
}

Fixed version (ground truth):
private static Set<String> getFieldsToMask(Iterable<? extends IndexableField> fields){
  Set<String> result=new HashSet<String>();
  for (  IndexableField field : fields) {
    if (field.name().equals(READ_MASK_FIELD)) {
      result.add(getFieldNameOnly(field.stringValue()));
    }
  }
  return result;
}
Program: 82086
Project: 82086
Buggy source:
@Override public Iterable<IndexableField> addReadMask(String fieldToMask,Iterable<IndexableField> fields){
  return addField(fields,new StoredField(READ_MASK_FIELD,fieldToMask));
}

Fixed version (ground truth):
@Override public Iterable<? extends IndexableField> addReadMask(String fieldToMask,Iterable<? extends IndexableField> fields){
  return addField(fields,new StoredField(READ_MASK_FIELD,fieldToMask));
}
Program: 82087
Project: 82087
Buggy source:
@Override public Iterable<IndexableField> addDiscoverVisiblity(String discover,Iterable<IndexableField> fields){
  return addField(fields,new DocumentVisiblityField(DISCOVER_FIELD,discover,Store.YES));
}

Fixed version (ground truth):
@Override public Iterable<? extends IndexableField> addDiscoverVisiblity(String discover,Iterable<? extends IndexableField> fields){
  return addField(fields,new DocumentVisiblityField(DISCOVER_FIELD,discover,Store.YES));
}
Program: 82088
Project: 82088
Buggy source:
@Override public Iterable<IndexableField> addReadVisiblity(String read,Iterable<IndexableField> fields){
  return addField(fields,new DocumentVisiblityField(READ_FIELD,read,Store.YES));
}

Fixed version (ground truth):
@Override public Iterable<? extends IndexableField> addReadVisiblity(String read,Iterable<? extends IndexableField> fields){
  return addField(fields,new DocumentVisiblityField(READ_FIELD,read,Store.YES));
}
Program: 82089
Project: 82089
Buggy source:
public static Iterable<IndexableField> processFieldMasks(Iterable<IndexableField> fields){
  Set<String> fieldsToMask=getFieldsToMask(fields);
  if (fieldsToMask.isEmpty()) {
    return fields;
  }
  List<IndexableField> result=new ArrayList<IndexableField>();
  for (  IndexableField field : fields) {
    IndexableFieldType fieldType=field.fieldType();
    if (fieldsToMask.contains(field.name()) && fieldType.indexed()) {
      if (!isDocValue(field)) {
        if (isStoredField(field)) {
          result.add(field);
        }
 else {
          IndexableField mask=createMaskField(field);
          result.add(field);
          result.add(mask);
        }
      }
    }
 else {
      result.add(field);
    }
  }
  return result;
}

Fixed version (ground truth):
public static Iterable<? extends IndexableField> processFieldMasks(Iterable<? extends IndexableField> fields){
  Set<String> fieldsToMask=getFieldsToMask(fields);
  if (fieldsToMask.isEmpty()) {
    return fields;
  }
  List<IndexableField> result=new ArrayList<IndexableField>();
  for (  IndexableField field : fields) {
    IndexableFieldType fieldType=field.fieldType();
    if (fieldsToMask.contains(field.name()) && fieldType.indexed()) {
      if (!isDocValue(field)) {
        if (isStoredField(field)) {
          result.add(field);
        }
 else {
          IndexableField mask=createMaskField(field);
          result.add(field);
          result.add(mask);
        }
      }
    }
 else {
      result.add(field);
    }
  }
  return result;
}
Program: 82090
Project: 82090
Buggy source:
@Override public Iterable<IndexableField> lastStepBeforeIndexing(Iterable<IndexableField> fields){
  return processFieldMasks(fields);
}

Fixed version (ground truth):
@Override public Iterable<? extends IndexableField> lastStepBeforeIndexing(Iterable<? extends IndexableField> fields){
  return processFieldMasks(fields);
}
Program: 82091
Project: 82091
Buggy source:
private Iterable<? extends IndexableField> getDoc(int docId,String read,String discover,String field1,String field2){
  Document doc=new Document();
  doc.add(new StringField("String_Node_Str",Integer.toString(docId),Store.YES));
  AccessControlWriter writer=_accessControlFactory.getWriter();
  doc.add(new StringField("String_Node_Str",field1,Store.YES));
  doc.add(new StringField("String_Node_Str",field2,Store.YES));
  doc.add(new TextField("String_Node_Str","String_Node_Str",Store.YES));
  Iterable<IndexableField> fields=doc;
  if (read != null) {
    fields=writer.addReadVisiblity(read,doc);
  }
  if (discover != null) {
    fields=writer.addDiscoverVisiblity(discover,fields);
  }
  return fields;
}

Fixed version (ground truth):
private Iterable<? extends IndexableField> getDoc(int docId,String read,String discover,String field1,String field2){
  Document doc=new Document();
  doc.add(new StringField("String_Node_Str",Integer.toString(docId),Store.YES));
  AccessControlWriter writer=_accessControlFactory.getWriter();
  doc.add(new StringField("String_Node_Str",field1,Store.YES));
  doc.add(new StringField("String_Node_Str",field2,Store.YES));
  doc.add(new TextField("String_Node_Str","String_Node_Str",Store.YES));
  Iterable<? extends IndexableField> fields=doc;
  if (read != null) {
    fields=writer.addReadVisiblity(read,doc);
  }
  if (discover != null) {
    fields=writer.addDiscoverVisiblity(discover,fields);
  }
  return fields;
}
Program: 82092
Project: 82092
Buggy source:
private void addDoc(IndexWriter writer,AccessControlWriter accessControlWriter,String read,String discover,int doc,String... readMaskFields) throws IOException {
  Iterable<IndexableField> fields=getDoc(doc);
  fields=accessControlWriter.addReadVisiblity(read,fields);
  fields=accessControlWriter.addDiscoverVisiblity(discover,fields);
  if (readMaskFields != null) {
    for (    String readMaskField : readMaskFields) {
      fields=accessControlWriter.addReadMask(readMaskField,fields);
    }
  }
  writer.addDocument(accessControlWriter.lastStepBeforeIndexing(fields));
}

Fixed version (ground truth):
private void addDoc(IndexWriter writer,AccessControlWriter accessControlWriter,String read,String discover,int doc,String... readMaskFields) throws IOException {
  Iterable<? extends IndexableField> fields=getDoc(doc);
  fields=accessControlWriter.addReadVisiblity(read,fields);
  fields=accessControlWriter.addDiscoverVisiblity(discover,fields);
  if (readMaskFields != null) {
    for (    String readMaskField : readMaskFields) {
      fields=accessControlWriter.addReadMask(readMaskField,fields);
    }
  }
  writer.addDocument(accessControlWriter.lastStepBeforeIndexing(fields));
}
Program: 82093
Project: 82093
Buggy source:
private List<Field> toList(Iterable<? extends Field> iterable){
  List<Field> fields=new ArrayList<Field>();
  for (  Field field : iterable) {
    fields.add(field);
  }
  return fields;
}

Fixed version (ground truth):
private List<Field> toList(Iterable<? extends IndexableField> iterable){
  List<Field> fields=new ArrayList<Field>();
  for (  IndexableField field : iterable) {
    fields.add((Field)field);
  }
  return fields;
}
Program: 82095
Project: 82095
Buggy source:
public Iterable<? extends Field> executePostProcessing(Iterable<? extends Field> fields){
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public Iterable<? extends IndexableField> executePostProcessing(Iterable<? extends IndexableField> fields){
  throw new RuntimeException("String_Node_Str");
}
Program: 82096
Project: 82096
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Iterable<? extends Field> executePostProcessing(Iterable<? extends Field> fields){
  Iterable<IndexableField> doc=FilterAccessControlWriter.processFieldMasks((Iterable<IndexableField>)fields);
  return (Iterable<? extends Field>)doc;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public Iterable<? extends IndexableField> executePostProcessing(Iterable<? extends IndexableField> fields){
  return FilterAccessControlWriter.processFieldMasks(fields);
}
Program: 82097
Project: 82097
Buggy source:
@Test public void testTermWalk() throws IOException, ParseException {
  SecureAtomicReader secureReader=getSecureReader();
  Fields fields=secureReader.fields();
  assertEquals(0,getTermCount(fields,"String_Node_Str"));
  assertEquals(0,getTermCount(fields,"String_Node_Str"));
  assertEquals(1,getTermCount(fields,"String_Node_Str"));
  secureReader.close();
}

Fixed version (ground truth):
@Test public void testTermWalk() throws IOException, ParseException {
  SecureAtomicReader secureReader=getSecureReader();
  Fields fields=secureReader.fields();
  assertEquals(0,getTermCount(fields,"String_Node_Str"));
  assertEquals(0,getTermWithSeekCount(fields,"String_Node_Str"));
  assertEquals(0,getTermCount(fields,"String_Node_Str"));
  assertEquals(0,getTermWithSeekCount(fields,"String_Node_Str"));
  assertEquals(1,getTermCount(fields,"String_Node_Str"));
  assertEquals(1,getTermWithSeekCount(fields,"String_Node_Str"));
  secureReader.close();
}
Program: 82098
Project: 82098
Buggy source:
@Override protected Analyzer getWrappedAnalyzer(String fieldName){
  FieldTypeDefinition fieldTypeDefinition;
  try {
    fieldTypeDefinition=getFieldTypeDefinition(fieldName);
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  if (fieldTypeDefinition == null) {
    throw new RuntimeException("String_Node_Str" + fieldName + "String_Node_Str");
  }
  return fieldTypeDefinition.getAnalyzerForIndex(fieldName);
}

Fixed version (ground truth):
@Override protected Analyzer getWrappedAnalyzer(String fieldName){
  FieldTypeDefinition fieldTypeDefinition;
  try {
    fieldTypeDefinition=getFieldTypeDefinition(getFieldNameRealNameIfReadMask(fieldName));
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  if (fieldTypeDefinition == null) {
    throw new RuntimeException("String_Node_Str" + fieldName + "String_Node_Str");
  }
  return fieldTypeDefinition.getAnalyzerForIndex(fieldName);
}
Program: 82100
Project: 82100
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public Iterable<? extends IndexableField> executePostProcessing(Iterable<? extends IndexableField> fields){
  return FilterAccessControlWriter.processFieldMasks(fields);
}

Fixed version (ground truth):
@Override public Iterable<? extends IndexableField> executePostProcessing(Iterable<? extends IndexableField> fields){
  return FilterAccessControlWriter.processFieldMasks(fields);
}
Program: 82101
Project: 82101
Buggy source:
@Override public Iterable<? extends Field> getFieldsForSubColumn(String family,Column column,String subName){
  return makeIterable(new StringField(INTERNAL_FIELDNAME,column.getValue(),Store.YES));
}

Fixed version (ground truth):
@Override public Iterable<? extends Field> getFieldsForSubColumn(String family,Column column,String subName){
  return makeIterable(new StringField(INTERNAL_FIELDNAME,family + "String_Node_Str" + column.getValue(),Store.YES));
}
Program: 82102
Project: 82102
Buggy source:
@Override public Iterable<? extends Field> getFieldsForColumn(String family,Column column){
  String name=getName(family,column.getName());
  List<Field> fields=new ArrayList<Field>();
  fields.add(new StoredField(name,column.getValue()));
  fields.add(new StringField(INTERNAL_FIELDNAME,column.getValue(),Store.YES));
  return fields;
}

Fixed version (ground truth):
@Override public Iterable<? extends Field> getFieldsForColumn(String family,Column column){
  String name=getName(family,column.getName());
  List<Field> fields=new ArrayList<Field>();
  fields.add(new StoredField(name,column.getValue()));
  fields.add(new StringField(INTERNAL_FIELDNAME,family + "String_Node_Str" + column.getValue(),Store.YES));
  return fields;
}
Program: 82103
Project: 82103
Buggy source:
private static boolean isValid(HdfsDirectory localDir,Directory remoteDir,String name) throws IOException {
  LastModified lastModified=(LastModified)remoteDir;
  long fileModified=lastModified.getFileModified(name);
  long fileLength=remoteDir.fileLength(name);
  if (localDir.fileExists(name)) {
    LOG.info("String_Node_Str",name);
    if (localDir.fileLength(name) == fileLength) {
      LOG.info("String_Node_Str",name);
      String lastModFile=name + LASTMOD;
      if (localDir.fileExists(lastModFile) && localDir.fileLength(lastModFile) != 8) {
        LOG.info("String_Node_Str",name);
        IndexInput input=localDir.openInput(lastModFile,IOContext.DEFAULT);
        long lastMod=input.readLong();
        if (lastMod == fileModified) {
          LOG.info("String_Node_Str",name);
          return true;
        }
 else {
          LOG.info("String_Node_Str",name);
        }
      }
 else {
        LOG.info("String_Node_Str",name);
      }
    }
 else {
      LOG.info("String_Node_Str",name);
    }
  }
 else {
    LOG.info("String_Node_Str",name);
  }
  return false;
}

Fixed version (ground truth):
private static boolean isValid(HdfsDirectory localDir,Directory remoteDir,String name) throws IOException {
  LastModified lastModified=(LastModified)remoteDir;
  long fileModified=lastModified.getFileModified(name);
  long fileLength=remoteDir.fileLength(name);
  if (localDir.fileExists(name)) {
    LOG.info("String_Node_Str",name);
    if (localDir.fileLength(name) == fileLength) {
      LOG.info("String_Node_Str",name);
      String lastModFile=name + LASTMOD;
      if (localDir.fileExists(lastModFile) && localDir.fileLength(lastModFile) == 8) {
        LOG.info("String_Node_Str",name);
        IndexInput input=localDir.openInput(lastModFile,IOContext.DEFAULT);
        long lastMod=input.readLong();
        if (lastMod == fileModified) {
          LOG.info("String_Node_Str",name);
          return true;
        }
 else {
          LOG.info("String_Node_Str",name);
        }
      }
 else {
        LOG.info("String_Node_Str",name);
      }
    }
 else {
      LOG.info("String_Node_Str",name);
    }
  }
 else {
    LOG.info("String_Node_Str",name);
  }
  return false;
}
Program: 82104
Project: 82104
Buggy source:
private void customQueryCheck(String field){
  try {
    Boolean b=_fieldManager.checkSupportForCustomQuery(field);
    if (b != null && b) {
      throw new RuntimeException("String_Node_Str" + field + "String_Node_Str"+ _fieldManager.getFieldTypeDefinition(field)+ "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
protected void customQueryCheck(String field){
  try {
    Boolean b=_fieldManager.checkSupportForCustomQuery(field);
    if (b != null && b) {
      throw new RuntimeException("String_Node_Str" + field + "String_Node_Str"+ _fieldManager.getFieldTypeDefinition(field)+ "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
}
Program: 82105
Project: 82105
Buggy source:
private Query addField(Query q,String field){
  _fieldNames.put(q,field);
  return q;
}

Fixed version (ground truth):
protected Query addField(Query q,String field){
  _fieldNames.put(q,field);
  return q;
}
Program: 82106
Project: 82106
Buggy source:
public BlurQueryParser(Version matchVersion,String f,Map<Query,String> fieldNames,FieldManager fieldManager){
  super(matchVersion,f,fieldManager.getAnalyzerForQuery());
  _fieldNames=fieldNames == null ? new HashMap<Query,String>() : fieldNames;
  _fieldManager=fieldManager;
  setAllowLeadingWildcard(true);
  setAutoGeneratePhraseQueries(true);
}

Fixed version (ground truth):
public BlurQueryParser(Version matchVersion,String f,Map<Query,String> fieldNames,FieldManager fieldManager){
  super(matchVersion,f,fieldManager.getAnalyzerForQuery());
  _fieldNames=fieldNames == null ? new HashMap<Query,String>() : fieldNames;
  _fieldManager=fieldManager;
  _allowLeadingWildcard=true;
  setAllowLeadingWildcard(_allowLeadingWildcard);
  setAutoGeneratePhraseQueries(true);
}
Program: 82107
Project: 82107
Buggy source:
private String findFirstGroupName(Query query){
  if (query instanceof BooleanQuery) {
    BooleanQuery booleanQuery=(BooleanQuery)query;
    for (    BooleanClause clause : booleanQuery.clauses()) {
      return findFirstGroupName(clause.getQuery());
    }
    return null;
  }
 else   if (query instanceof SuperQuery) {
    SuperQuery sq=(SuperQuery)query;
    return findFirstGroupName(sq.getQuery());
  }
 else {
    String fieldName=_fieldNames.get(query);
    return getGroupName(fieldName);
  }
}

Fixed version (ground truth):
private String findFirstGroupName(Query query){
  if (query instanceof BooleanQuery) {
    BooleanQuery booleanQuery=(BooleanQuery)query;
    for (    BooleanClause clause : booleanQuery.clauses()) {
      String groupName=findFirstGroupName(clause.getQuery());
      if (groupName != null) {
        return groupName;
      }
    }
    return null;
  }
 else   if (query instanceof SuperQuery) {
    SuperQuery sq=(SuperQuery)query;
    return findFirstGroupName(sq.getQuery());
  }
 else {
    String fieldName=_fieldNames.get(query);
    return getGroupName(fieldName);
  }
}
Program: 82108
Project: 82108
Buggy source:
@Override protected Query newTermQuery(Term term){
  String resolvedField=_fieldManager.resolveField(term.field());
  try {
    Boolean b=_fieldManager.checkSupportForCustomQuery(resolvedField);
    if (b != null && b) {
      return _fieldManager.getCustomQuery(resolvedField,term.text());
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  Query q;
  try {
    q=_fieldManager.getTermQueryIfNumeric(resolvedField,term.text());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  if (q != null) {
    return addField(q,resolvedField);
  }
  return addField(super.newTermQuery(new Term(resolvedField,term.text())),resolvedField);
}

Fixed version (ground truth):
@Override protected Query newTermQuery(Term term){
  String resolvedField=_fieldManager.resolveField(term.field());
  try {
    Boolean b=_fieldManager.checkSupportForCustomQuery(resolvedField);
    if (b != null && b) {
      return addField(_fieldManager.getCustomQuery(resolvedField,term.text()),resolvedField);
    }
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  Query q;
  try {
    q=_fieldManager.getTermQueryIfNumeric(resolvedField,term.text());
  }
 catch (  IOException e) {
    throw new RuntimeException(e);
  }
  if (q != null) {
    return addField(q,resolvedField);
  }
  return addField(super.newTermQuery(new Term(resolvedField,term.text())),resolvedField);
}