Program: 31457
Project: 31457
Buggy source:
@SuppressWarnings("String_Node_Str") @SuppressFBWarnings({"String_Node_Str","String_Node_Str"}) private RecordSource<? extends Record> compileSingleJournal(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  if (model.getLimitLo() != null || model.getLimitHi() != null) {
    analyseLimit(model);
  }
  RecordMetadata metadata=model.getMetadata();
  JournalMetadata journalMetadata;
  if (metadata == null) {
    journalMetadata=collectJournalMetadata(model,factory);
  }
 else   if (metadata instanceof JournalMetadata) {
    journalMetadata=(JournalMetadata)metadata;
  }
 else {
    throw new ParserException(0,"String_Node_Str");
  }
  if (model.getAlias() != null) {
    journalMetadata.setAlias(model.getAlias().token);
  }
 else {
    journalMetadata.setAlias(model.getJournalName().token);
  }
  PartitionSource ps=new JournalPartitionSource(journalMetadata,true);
  RowSource rs=null;
  String latestByCol=null;
  RecordColumnMetadata latestByMetadata=null;
  ExprNode latestByNode=null;
  if (model.getLatestBy() != null) {
    latestByNode=model.getLatestBy();
    if (latestByNode.type != ExprNode.NodeType.LITERAL) {
      throw new ParserException(latestByNode.position,"String_Node_Str");
    }
    int colIndex=journalMetadata.getColumnIndexQuiet(latestByNode.token);
    if (colIndex == -1) {
      throw new InvalidColumnException(latestByNode.position);
    }
    latestByMetadata=journalMetadata.getColumnQuick(colIndex);
    ColumnType type=latestByMetadata.getType();
    if (type != ColumnType.SYMBOL && type != ColumnType.STRING && type != ColumnType.INT) {
      throw new ParserException(latestByNode.position,"String_Node_Str" + type);
    }
    if (!latestByMetadata.isIndexed()) {
      throw new ParserException(latestByNode.position,"String_Node_Str");
    }
    latestByCol=latestByNode.token;
  }
  ExprNode where=model.getWhereClause();
  if (where != null) {
    IntrinsicModel im=queryFilterAnalyser.extract(where,journalMetadata,latestByCol);
    VirtualColumn filter=im.filter != null ? createVirtualColumn(im.filter,journalMetadata,model.getColumnNameHistogram()) : null;
    if (filter != null) {
      if (filter.getType() != ColumnType.BOOLEAN) {
        throw new ParserException(im.filter.position,"String_Node_Str");
      }
      if (filter.isConstant()) {
        if (filter.getBool(null)) {
          filter=null;
        }
 else {
          im.intrinsicValue=IntrinsicValue.FALSE;
        }
      }
    }
    if (im.intrinsicValue == IntrinsicValue.FALSE) {
      ps=new NoOpJournalPartitionSource(journalMetadata);
    }
 else {
      if (im.intervalHi < Long.MAX_VALUE || im.intervalLo > Long.MIN_VALUE) {
        ps=new MultiIntervalPartitionSource(ps,new SingleIntervalSource(new Interval(im.intervalLo,im.intervalHi)));
      }
      if (im.intervalSource != null) {
        ps=new MultiIntervalPartitionSource(ps,im.intervalSource);
      }
      if (latestByCol == null) {
        if (im.keyColumn != null) {
switch (journalMetadata.getColumn(im.keyColumn).getType()) {
case SYMBOL:
            rs=buildRowSourceForSym(im);
          break;
case STRING:
        rs=buildRowSourceForStr(im);
      break;
case INT:
    rs=buildRowSourceForInt(im);
}
}
if (filter != null) {
rs=new FilteredRowSource(rs == null ? new AllRowSource() : rs,filter);
}
}
 else {
if (im.keyColumn != null && im.keyValuesIsLambda) {
int lambdaColIndex;
RecordSource<? extends Record> lambda=compileSourceInternal(im.keyValues.get(0));
RecordMetadata m=lambda.getMetadata();
switch (m.getColumnCount()) {
case 0:
  throw new ParserException(im.keyValuePositions.getQuick(0),"String_Node_Str");
case 1:
lambdaColIndex=0;
break;
default :
lambdaColIndex=m.getColumnIndexQuiet(latestByCol);
if (lambdaColIndex == -1) {
throw new ParserException(im.keyValuePositions.getQuick(0),"String_Node_Str");
}
break;
}
ColumnType lambdaColType=m.getColumn(lambdaColIndex).getType();
mutableSig.setParamCount(2).setName("String_Node_Str").paramType(0,latestByMetadata.getType(),true).paramType(1,lambdaColType,false);
LatestByLambdaRowSourceFactory fact=LAMBDA_ROW_SOURCE_FACTORIES.get(mutableSig);
if (fact != null) {
rs=fact.newInstance(latestByCol,lambda,lambdaColIndex,filter);
}
 else {
throw new ParserException(im.keyValuePositions.getQuick(0),"String_Node_Str");
}
}
 else {
switch (latestByMetadata.getType()) {
case SYMBOL:
if (im.keyColumn != null) {
rs=new KvIndexSymListHeadRowSource(latestByCol,new CharSequenceHashSet(im.keyValues),filter);
}
 else {
rs=new KvIndexSymAllHeadRowSource(latestByCol,filter);
}
break;
case STRING:
if (im.keyColumn != null) {
rs=new KvIndexStrListHeadRowSource(latestByCol,new CharSequenceHashSet(im.keyValues),filter);
}
 else {
throw new ParserException(latestByNode.position,"String_Node_Str");
}
break;
case INT:
if (im.keyColumn != null) {
rs=new KvIndexIntListHeadRowSource(latestByCol,toIntHashSet(im),filter);
}
 else {
throw new ParserException(latestByNode.position,"String_Node_Str");
}
}
}
}
}
}
 else if (latestByCol != null) {
switch (latestByMetadata.getType()) {
case SYMBOL:
rs=new KvIndexSymAllHeadRowSource(latestByCol,null);
break;
default :
throw new ParserException(latestByNode.position,"String_Node_Str");
}
}
return new JournalSource(ps,rs == null ? new AllRowSource() : rs);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @SuppressFBWarnings({"String_Node_Str","String_Node_Str"}) private RecordSource<? extends Record> compileSingleJournal(QueryModel model,JournalReaderFactory factory) throws JournalException, ParserException {
  RecordMetadata metadata=model.getMetadata();
  JournalMetadata journalMetadata;
  if (metadata == null) {
    journalMetadata=collectJournalMetadata(model,factory);
  }
 else   if (metadata instanceof JournalMetadata) {
    journalMetadata=(JournalMetadata)metadata;
  }
 else {
    throw new ParserException(0,"String_Node_Str");
  }
  if (model.getAlias() != null) {
    journalMetadata.setAlias(model.getAlias().token);
  }
 else {
    journalMetadata.setAlias(model.getJournalName().token);
  }
  PartitionSource ps=new JournalPartitionSource(journalMetadata,true);
  RowSource rs=null;
  String latestByCol=null;
  RecordColumnMetadata latestByMetadata=null;
  ExprNode latestByNode=null;
  if (model.getLatestBy() != null) {
    latestByNode=model.getLatestBy();
    if (latestByNode.type != ExprNode.NodeType.LITERAL) {
      throw new ParserException(latestByNode.position,"String_Node_Str");
    }
    int colIndex=journalMetadata.getColumnIndexQuiet(latestByNode.token);
    if (colIndex == -1) {
      throw new InvalidColumnException(latestByNode.position);
    }
    latestByMetadata=journalMetadata.getColumnQuick(colIndex);
    ColumnType type=latestByMetadata.getType();
    if (type != ColumnType.SYMBOL && type != ColumnType.STRING && type != ColumnType.INT) {
      throw new ParserException(latestByNode.position,"String_Node_Str" + type);
    }
    if (!latestByMetadata.isIndexed()) {
      throw new ParserException(latestByNode.position,"String_Node_Str");
    }
    latestByCol=latestByNode.token;
  }
  ExprNode where=model.getWhereClause();
  if (where != null) {
    IntrinsicModel im=queryFilterAnalyser.extract(where,journalMetadata,latestByCol);
    VirtualColumn filter=im.filter != null ? createVirtualColumn(im.filter,journalMetadata,model.getColumnNameHistogram()) : null;
    if (filter != null) {
      if (filter.getType() != ColumnType.BOOLEAN) {
        throw new ParserException(im.filter.position,"String_Node_Str");
      }
      if (filter.isConstant()) {
        if (filter.getBool(null)) {
          filter=null;
        }
 else {
          im.intrinsicValue=IntrinsicValue.FALSE;
        }
      }
    }
    if (im.intrinsicValue == IntrinsicValue.FALSE) {
      ps=new NoOpJournalPartitionSource(journalMetadata);
    }
 else {
      if (im.intervalHi < Long.MAX_VALUE || im.intervalLo > Long.MIN_VALUE) {
        ps=new MultiIntervalPartitionSource(ps,new SingleIntervalSource(new Interval(im.intervalLo,im.intervalHi)));
      }
      if (im.intervalSource != null) {
        ps=new MultiIntervalPartitionSource(ps,im.intervalSource);
      }
      if (latestByCol == null) {
        if (im.keyColumn != null) {
switch (journalMetadata.getColumn(im.keyColumn).getType()) {
case SYMBOL:
            rs=buildRowSourceForSym(im);
          break;
case STRING:
        rs=buildRowSourceForStr(im);
      break;
case INT:
    rs=buildRowSourceForInt(im);
}
}
if (filter != null) {
rs=new FilteredRowSource(rs == null ? new AllRowSource() : rs,filter);
}
}
 else {
if (im.keyColumn != null && im.keyValuesIsLambda) {
int lambdaColIndex;
RecordSource<? extends Record> lambda=compileSourceInternal(im.keyValues.get(0));
RecordMetadata m=lambda.getMetadata();
switch (m.getColumnCount()) {
case 0:
  throw new ParserException(im.keyValuePositions.getQuick(0),"String_Node_Str");
case 1:
lambdaColIndex=0;
break;
default :
lambdaColIndex=m.getColumnIndexQuiet(latestByCol);
if (lambdaColIndex == -1) {
throw new ParserException(im.keyValuePositions.getQuick(0),"String_Node_Str");
}
break;
}
ColumnType lambdaColType=m.getColumn(lambdaColIndex).getType();
mutableSig.setParamCount(2).setName("String_Node_Str").paramType(0,latestByMetadata.getType(),true).paramType(1,lambdaColType,false);
LatestByLambdaRowSourceFactory fact=LAMBDA_ROW_SOURCE_FACTORIES.get(mutableSig);
if (fact != null) {
rs=fact.newInstance(latestByCol,lambda,lambdaColIndex,filter);
}
 else {
throw new ParserException(im.keyValuePositions.getQuick(0),"String_Node_Str");
}
}
 else {
switch (latestByMetadata.getType()) {
case SYMBOL:
if (im.keyColumn != null) {
rs=new KvIndexSymListHeadRowSource(latestByCol,new CharSequenceHashSet(im.keyValues),filter);
}
 else {
rs=new KvIndexSymAllHeadRowSource(latestByCol,filter);
}
break;
case STRING:
if (im.keyColumn != null) {
rs=new KvIndexStrListHeadRowSource(latestByCol,new CharSequenceHashSet(im.keyValues),filter);
}
 else {
throw new ParserException(latestByNode.position,"String_Node_Str");
}
break;
case INT:
if (im.keyColumn != null) {
rs=new KvIndexIntListHeadRowSource(latestByCol,toIntHashSet(im),filter);
}
 else {
throw new ParserException(latestByNode.position,"String_Node_Str");
}
}
}
}
}
}
 else if (latestByCol != null) {
switch (latestByMetadata.getType()) {
case SYMBOL:
rs=new KvIndexSymAllHeadRowSource(latestByCol,null);
break;
default :
throw new ParserException(latestByNode.position,"String_Node_Str");
}
}
return new JournalSource(ps,rs == null ? new AllRowSource() : rs);
}