Program: 189601
Project: 189601
Buggy source:
/** 
 * Snaps the observed location to a graph edge, computes edges traveled between observations (when applicable), and returns both sets of edges.
 * @param loc
 * @return
 */
public SnappedEdges snapToGraph(Coordinate fromCoords,Coordinate toCoords){
  Preconditions.checkNotNull(toCoords);
  final RoutingRequest options=OtpGraph.defaultOptions;
  final Vertex snappedVertex=indexService.getClosestVertex(new Coordinate(toCoords.y,toCoords.x),null,options);
  final Builder<Edge> pathTraversed=ImmutableList.builder();
  final com.google.common.collect.ImmutableSet.Builder<Edge> snappedEdges=ImmutableSet.<Edge>builder();
  if (snappedVertex != null && (snappedVertex instanceof StreetLocation)) {
    final StreetLocation snappedStreetLocation=(StreetLocation)snappedVertex;
    final Set<Edge> edges=Sets.newHashSet();
    edges.addAll(Objects.firstNonNull(snappedStreetLocation.getOutgoingStreetEdges(),ImmutableList.<Edge>of()));
    snappedEdges.addAll(edges);
    if (fromCoords != null && !fromCoords.equals2D(toCoords)) {
      final CoordinateSequence movementSeq=JTSFactoryFinder.getGeometryFactory().getCoordinateSequenceFactory().create(new Coordinate[]{new Coordinate(fromCoords.y,fromCoords.x),new Coordinate(toCoords.y,toCoords.x)});
      final Geometry movementGeometry=JTSFactoryFinder.getGeometryFactory().createLineString(movementSeq);
      final List<Edge> minimumConnectingEdges=Objects.firstNonNull(streetMatcher.match(movementGeometry),ImmutableList.<Edge>of());
      for (      final Edge edge : minimumConnectingEdges) {
        pathTraversed.add(edge);
      }
    }
 else {
    }
  }
  return new SnappedEdges(snappedEdges.build(),pathTraversed.build());
}

Fixed version (ground truth):
/** 
 * Snaps the observed location to a graph edge, computes edges traveled between observations (when applicable), and returns both sets of edges.
 * @param loc
 * @return
 */
public SnappedEdges snapToGraph(Coordinate fromCoords,Coordinate toCoords){
  Preconditions.checkNotNull(toCoords);
  final RoutingRequest options=OtpGraph.defaultOptions;
  final Vertex snappedVertex=indexService.getClosestVertex(new Coordinate(toCoords.y,toCoords.x),null,options);
  final Builder<Edge> pathTraversed=ImmutableList.builder();
  final com.google.common.collect.ImmutableSet.Builder<Edge> snappedEdges=ImmutableSet.<Edge>builder();
  if (snappedVertex != null && (snappedVertex instanceof StreetLocation)) {
    final StreetLocation snappedStreetLocation=(StreetLocation)snappedVertex;
    final Set<Edge> edges=Sets.newHashSet();
    edges.addAll(Objects.firstNonNull(snappedStreetLocation.getOutgoing(),ImmutableList.<Edge>of()));
    edges.addAll(Objects.firstNonNull(snappedStreetLocation.getIncoming(),ImmutableList.<Edge>of()));
    for (    Edge edge : edges) {
      if (edge.getGeometry() == null) {
        snappedEdges.addAll(edge.getFromVertex().getOutgoingStreetEdges());
        snappedEdges.addAll(edge.getToVertex().getOutgoingStreetEdges());
      }
 else {
        snappedEdges.add(edge);
      }
    }
    if (fromCoords != null && !fromCoords.equals2D(toCoords)) {
      final CoordinateSequence movementSeq=JTSFactoryFinder.getGeometryFactory().getCoordinateSequenceFactory().create(new Coordinate[]{new Coordinate(fromCoords.y,fromCoords.x),new Coordinate(toCoords.y,toCoords.x)});
      final Geometry movementGeometry=JTSFactoryFinder.getGeometryFactory().createLineString(movementSeq);
      final List<Edge> minimumConnectingEdges=Objects.firstNonNull(streetMatcher.match(movementGeometry),ImmutableList.<Edge>of());
      for (      final Edge edge : minimumConnectingEdges) {
        pathTraversed.add(edge);
      }
    }
 else {
    }
  }
  return new SnappedEdges(snappedEdges.build(),pathTraversed.build());
}