nus-yam/ex-repair huggingface dataset:
Program: 189559
Project: 189559
Buggy source:
private InferredPath copyAStarResults(GraphPath gpath,boolean isReverse){
  final double direction=isReverse ? -1d : 1d;
  double pathDist=0d;
  final List<PathEdge> path=Lists.newArrayList();
  for (  final Edge pathEdge : isReverse ? Lists.reverse(gpath.edges) : gpath.edges) {
    if (OtpGraph.isStreetEdge(pathEdge) && pathEdge.getGeometry() != null && pathEdge.getDistance() > 0d && graph.getIdForEdge(pathEdge) != null && !pathEdge.equals(Iterables.getLast(path,null))) {
      path.add(PathEdge.getEdge(this.getInferredEdge(pathEdge),pathDist));
      pathDist+=direction * pathEdge.getDistance();
    }
 else     if (pathEdge.getFromVertex() != null && !pathEdge.getFromVertex().getOutgoingStreetEdges().isEmpty()) {
      for (      final Edge streetEdge : pathEdge.getFromVertex().getOutgoingStreetEdges()) {
        if (streetEdge.getGeometry() != null && !streetEdge.equals(Iterables.getLast(path,null)) && streetEdge.getDistance() > 0d && graph.getIdForEdge(streetEdge) != null) {
          path.add(PathEdge.getEdge(this.getInferredEdge(streetEdge.getFromVertex().getOutgoingStreetEdges().get(0)),pathDist));
          pathDist+=direction * streetEdge.getDistance();
          break;
        }
      }
    }
  }
  if (!path.isEmpty())   return InferredPath.getInferredPath(path);
 else   return null;
}

Fixed version (ground truth):
private InferredPath copyAStarResults(GraphPath gpath,Edge startEdge,boolean isReverse){
  final double direction=isReverse ? -1d : 1d;
  double pathDist=0d;
  final List<PathEdge> path=Lists.newArrayList();
  final PathEdge startPathEdge=PathEdge.getEdge(this.getInferredEdge(startEdge));
  if (gpath.edges.isEmpty()) {
    path.add(startPathEdge);
  }
 else {
    for (    final Edge edge : isReverse ? Lists.reverse(gpath.edges) : gpath.edges) {
      PathEdge pathEdge=getValidPathEdge(edge,pathDist,direction,path);
      pathDist+=direction * pathEdge.getInferredEdge().getLength();
      path.add(pathEdge);
    }
  }
  if (!path.isEmpty())   return InferredPath.getInferredPath(path);
 else   return null;
}
Program: 189561
Project: 189561
Buggy source:
public InferredPathEntry(InferredPath path,Map<PathEdge,DefaultWeightedValue<MultivariateGaussian>> edgeToPredictiveBeliefAndLogLikelihood,StandardRoadTrackingFilter filter,double totalLogLikelihood){
  this.totalLogLikelihood=totalLogLikelihood;
  this.path=path;
  this.filter=filter;
  this.edgeToPredictiveBelief=edgeToPredictiveBeliefAndLogLikelihood;
}

Fixed version (ground truth):
public InferredPathEntry(InferredPath path,MultivariateGaussian beliefPrediction,Map<PathEdge,DefaultWeightedValue<MultivariateGaussian>> edgeToPredictiveBeliefAndLogLikelihood,StandardRoadTrackingFilter filter,double totalLogLikelihood){
  this.beliefPrediction=beliefPrediction;
  this.totalLogLikelihood=totalLogLikelihood;
  this.path=path;
  this.filter=filter;
  this.edgeToPredictiveBelief=edgeToPredictiveBeliefAndLogLikelihood;
}
Program: 189562
Project: 189562
Buggy source:
ShortestPathTree getSPT(boolean arriveBy){
  final GenericAStar astar=new GenericAStar();
  astar.setSearchTerminationStrategy(this);
  astar.setSkipTraverseResultStrategy(this);
  final RoutingRequest req=new RoutingRequest();
  final Vertex bogus=new IntersectionVertex(graph,"String_Node_Str",start.getFromVertex().getCoordinate(),"String_Node_Str");
  req.setRoutingContext(graph,start.getFromVertex(),bogus);
  req.rctx.remainingWeightHeuristic=this;
  req.setArriveBy(arriveBy);
  return astar.getShortestPathTree(req);
}

Fixed version (ground truth):
ShortestPathTree getSPT(boolean arriveBy){
  final GenericAStar astar=new GenericAStar();
  astar.setSearchTerminationStrategy(this);
  astar.setSkipTraverseResultStrategy(this);
  final RoutingRequest req=new RoutingRequest();
  final Vertex startVertex=arriveBy ? start.getToVertex() : start.getFromVertex();
  final String bogusName="String_Node_Str" + System.nanoTime();
  final Vertex bogus=new IntersectionVertex(graph,bogusName,startVertex.getCoordinate(),bogusName);
  req.setRoutingContext(graph,startVertex,bogus);
  req.rctx.remainingWeightHeuristic=this;
  req.setArriveBy(arriveBy);
  final ShortestPathTree result=astar.getShortestPathTree(req);
  req.cleanup();
  return result;
}
Program: 189563
Project: 189563
Buggy source:
@Override public boolean shouldSearchContinue(Vertex origin,Vertex target,State current,ShortestPathTree spt,RoutingRequest traverseOptions){
  if (end.remove(current.getBackEdge())) {
    return end.size() == 0;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean shouldSearchContinue(Vertex origin,Vertex target,State current,ShortestPathTree spt,RoutingRequest traverseOptions){
  end.remove(current.getBackEdge());
  return end.size() != 0;
}
Program: 189565
Project: 189565
Buggy source:
@Override public DataDistribution<VehicleState> createInitialLearnedObject(){
  final DataDistribution<VehicleState> dist=super.createInitialLearnedObject();
  if (isDebug) {
    final Set<InferredPathEntry> evaledPaths=Sets.newHashSet();
    for (    final VehicleState state : dist.getDomain()) {
      evaledPaths.add(new InferredPathEntry(state.getPath(),Collections.<PathEdge,DefaultWeightedValue<MultivariateGaussian>>emptyMap(),state.getMovementFilter(),Double.NaN));
    }
    this.filterInfo.put(initialObservation,new FilterInformation(evaledPaths,dist));
  }
  return dist;
}

Fixed version (ground truth):
@Override public DataDistribution<VehicleState> createInitialLearnedObject(){
  final DataDistribution<VehicleState> dist=super.createInitialLearnedObject();
  if (isDebug) {
    final Set<InferredPath> evaledPaths=Sets.newHashSet();
    for (    final VehicleState state : dist.getDomain()) {
      evaledPaths.add(state.getPath());
    }
    this.filterInfo.put(initialObservation,new FilterInformation(evaledPaths,dist));
  }
  return dist;
}
Program: 189567
Project: 189567
Buggy source:
public static boolean isStreetEdge(Edge pathEdge){
  if (!(pathEdge instanceof TurnEdge || pathEdge instanceof OutEdge || pathEdge instanceof PlainStreetEdge))   return true;
 else   return false;
}

Fixed version (ground truth):
public static boolean isStreetEdge(Edge pathEdge){
  if (!(pathEdge instanceof TurnEdge || pathEdge instanceof OutEdge || pathEdge instanceof PlainStreetEdge))   return false;
 else   return true;
}
Program: 189568
Project: 189568
Buggy source:
private Set<InferredPath> computePaths(PathKey key){
  Coordinate fromCoord=GeoUtils.getLonLat(key.getStartCoord());
  Coordinate toCoord=GeoUtils.getLonLat(key.getEndCoord());
  Set<InferredPath> paths=Sets.newHashSet(InferredPath.getEmptyPath());
  Builder<PathEdge> path=ImmutableList.builder();
  final CoordinateSequence movementSeq=JTSFactoryFinder.getGeometryFactory().getCoordinateSequenceFactory().create(new Coordinate[]{fromCoord,toCoord});
  final Geometry movementGeometry=JTSFactoryFinder.getGeometryFactory().createLineString(movementSeq);
  final List<Edge> minimumConnectingEdges=Objects.firstNonNull(narratedGraph.getStreetMatcher().match(movementGeometry),ImmutableList.<Edge>of());
  if (!minimumConnectingEdges.isEmpty()) {
    double pathDist=0d;
    for (    Edge pathEdge : minimumConnectingEdges) {
      path.add(PathEdge.getEdge(this.getInferredEdge(pathEdge),pathDist));
      pathDist+=pathEdge.getDistance();
    }
    paths.add(new InferredPath(path.build(),pathDist));
  }
  return paths;
}

Fixed version (ground truth):
private Set<InferredPath> computePaths(PathKey key){
  Coordinate fromCoord=GeoUtils.reverseCoordinates(key.getStartCoord());
  Coordinate toCoord=GeoUtils.reverseCoordinates(key.getEndCoord());
  Set<InferredPath> paths=Sets.newHashSet(InferredPath.getEmptyPath());
  Builder<PathEdge> path=ImmutableList.builder();
  final CoordinateSequence movementSeq=JTSFactoryFinder.getGeometryFactory().getCoordinateSequenceFactory().create(new Coordinate[]{fromCoord,toCoord});
  final Geometry movementGeometry=JTSFactoryFinder.getGeometryFactory().createLineString(movementSeq);
  final List<Edge> minimumConnectingEdges=Objects.firstNonNull(narratedGraph.getStreetMatcher().match(movementGeometry),ImmutableList.<Edge>of());
  if (!minimumConnectingEdges.isEmpty()) {
    double pathDist=0d;
    for (    Edge pathEdge : minimumConnectingEdges) {
      path.add(PathEdge.getEdge(this.getInferredEdge(pathEdge),pathDist));
      pathDist+=pathEdge.getDistance();
    }
    paths.add(new InferredPath(path.build(),pathDist));
  }
  return paths;
}
Program: 189569
Project: 189569
Buggy source:
/** 
 * Get the snapped location in projected/euclidean coordinates for the  given obsPoint (in lat/lon).
 * @param obsPoint
 * @return
 */
public Vector getPointOnEdge(Coordinate obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final Coordinate revObsPoint=new Coordinate(obsPoint.y,obsPoint.x);
  final LinearLocation here=line.project(revObsPoint);
  final Coordinate pointOnLine=line.extractPoint(here);
  final Coordinate revOnLine=new Coordinate(pointOnLine.y,pointOnLine.x);
  final Coordinate projPointOnLine=GeoUtils.convertToEuclidean(revOnLine);
  return VectorFactory.getDefault().createVector2D(projPointOnLine.x,projPointOnLine.y);
}

Fixed version (ground truth):
/** 
 * Get the snapped location in projected/euclidean coordinates for the  given obsPoint (in lat/lon).
 * @param obsPoint
 * @return
 */
public Vector getPointOnEdge(Coordinate obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final Coordinate revObsPoint=new Coordinate(obsPoint.y,obsPoint.x);
  final LinearLocation here=locationIndexedLine.project(revObsPoint);
  final Coordinate pointOnLine=locationIndexedLine.extractPoint(here);
  final Coordinate revOnLine=new Coordinate(pointOnLine.y,pointOnLine.x);
  final Coordinate projPointOnLine=GeoUtils.convertToEuclidean(revOnLine);
  return VectorFactory.getDefault().createVector2D(projPointOnLine.x,projPointOnLine.y);
}
Program: 189570
Project: 189570
Buggy source:
public Graph getGraph(){
  return graph;
}

Fixed version (ground truth):
public InferredGraph getGraph(){
  return graph;
}
Program: 189571
Project: 189571
Buggy source:
private InferredEdge(Edge edge,Integer edgeId,InferredGraph graph){
  this.graph=graph;
  this.edgeId=edgeId;
  this.line=new LocationIndexedLine(edge.getGeometry());
  this.geometry=edge.getGeometry();
  this.startVertex=edge.getFromVertex();
  this.endVertex=edge.getToVertex();
  final Coordinate startPoint=this.line.extractPoint(this.line.getStartIndex());
  final Coordinate startPointCoord=GeoUtils.convertToEuclidean(new Coordinate(startPoint.y,startPoint.x));
  this.startPoint=VectorFactory.getDefault().createVector2D(startPointCoord.x,startPointCoord.y);
  final Coordinate endPoint=this.line.extractPoint(this.line.getEndIndex());
  final Coordinate endPointCoord=GeoUtils.convertToEuclidean(new Coordinate(endPoint.y,endPoint.x));
  this.endPoint=VectorFactory.getDefault().createVector2D(endPointCoord.x,endPointCoord.y);
  this.length=this.startPoint.euclideanDistance(this.endPoint);
  this.angle=Angle.angle(startPoint,endPoint);
  this.velocityPrecisionDist=new NormalInverseGammaDistribution(266d,1 / Math.sqrt(1800d),1 / Math.sqrt(1800) + 1,Math.sqrt(1800));
  this.velocityEstimator=new UnivariateGaussianMeanVarianceBayesianEstimator(velocityPrecisionDist);
}

Fixed version (ground truth):
private InferredEdge(Edge edge,Integer edgeId,InferredGraph graph){
  this.graph=graph;
  this.edgeId=edgeId;
  this.geometry=edge.getGeometry();
  this.locationIndexedLine=new LocationIndexedLine(edge.getGeometry());
  this.lengthIndexedLine=new LengthIndexedLine(edge.getGeometry());
  this.lengthLocationMap=new LengthLocationMap(geometry);
  this.startVertex=edge.getFromVertex();
  this.endVertex=edge.getToVertex();
  final Coordinate startPoint=this.locationIndexedLine.extractPoint(this.locationIndexedLine.getStartIndex());
  final Coordinate startPointCoord=GeoUtils.convertToEuclidean(new Coordinate(startPoint.y,startPoint.x));
  this.startPoint=VectorFactory.getDefault().createVector2D(startPointCoord.x,startPointCoord.y);
  final Coordinate endPoint=this.locationIndexedLine.extractPoint(this.locationIndexedLine.getEndIndex());
  final Coordinate endPointCoord=GeoUtils.convertToEuclidean(new Coordinate(endPoint.y,endPoint.x));
  this.endPoint=VectorFactory.getDefault().createVector2D(endPointCoord.x,endPointCoord.y);
  this.length=GeoUtils.getAngleDegreesInMeters(geometry.getLength());
  this.velocityPrecisionDist=new NormalInverseGammaDistribution(266d,1 / Math.sqrt(1800d),1 / Math.sqrt(1800) + 1,Math.sqrt(1800));
  this.velocityEstimator=new UnivariateGaussianMeanVarianceBayesianEstimator(velocityPrecisionDist);
}
Program: 189572
Project: 189572
Buggy source:
public static void convertToRoadBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 2)   return;
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  final Vector m=belief.getMean().clone();
  final Matrix C=belief.getCovariance().clone();
  Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(edge,false);
  final Vector projMean=projPair.getKey().transpose().times(m.minus(projPair.getValue()));
  final Matrix projCov=projPair.getKey().transpose().times(C).times(projPair.getKey());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}

Fixed version (ground truth):
public static void convertToRoadBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 2)   return;
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  final Vector m=belief.getMean().clone();
  final Matrix C=belief.getCovariance().clone();
  final Coordinate latlonCurrentPos=GeoUtils.convertToLatLon(Og.times(m));
  LinearLocation lineLocation=edge.getInferredEdge().getLocationIndexedLine().project(GeoUtils.reverseCoordinates(latlonCurrentPos));
  LineSegment lineSegment=lineLocation.getSegment(edge.getInferredEdge().getGeometry());
  final double distanceToStartOfSegment=GeoUtils.getAngleDegreesInMeters(edge.getInferredEdge().getLengthIndexedLine().indexOf(lineSegment.p0));
  Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(lineSegment,distanceToStartOfSegment);
  final Vector projMean=projPair.getKey().transpose().times(m.minus(projPair.getValue()));
  final Matrix projCov=projPair.getKey().transpose().times(C).times(projPair.getKey());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}
Program: 189573
Project: 189573
Buggy source:
/** 
 * Returns the matrix and offset vector for projection onto the given edge. distEnd is the distance from the start of the path to the end of the given edge. NOTE: These results are only in the positive direction.  Convert on your end.
 * @param edge
 * @param isNegative 
 * @param distEnd
 * @return
 */
static private Entry<Matrix,Vector> posVelProjectionPair(PathEdge edge,boolean isNegative){
  final Vector start=isNegative ? edge.getInferredEdge().getEndPoint() : edge.getInferredEdge().getStartPoint();
  final Vector end=isNegative ? edge.getInferredEdge().getStartPoint() : edge.getInferredEdge().getEndPoint();
  final double length=edge.getInferredEdge().getLength();
  final double distToStart=Math.abs(edge.getDistToStartOfEdge());
  final Vector P1=end.minus(start).scale(1 / length);
  final Vector s1=start.minus(P1.scale(distToStart));
  final Matrix P=MatrixFactory.getDefault().createMatrix(4,2);
  P.setColumn(0,P1.stack(zeros2D));
  P.setColumn(1,zeros2D.stack(P1));
  final Vector a=s1.stack(zeros2D);
  return Maps.immutableEntry(U.times(P),U.times(a));
}

Fixed version (ground truth):
/** 
 * Returns the matrix and offset vector for projection onto the given edge. distEnd is the distance from the start of the path to the end of the given edge. NOTE: These results are only in the positive direction.  Convert on your end.
 */
static private Entry<Matrix,Vector> posVelProjectionPair(LineSegment lineSegment,double distToStartOfLine){
  final Vector start=GeoUtils.getEuclideanVector(GeoUtils.reverseCoordinates(lineSegment.p0));
  final Vector end=GeoUtils.getEuclideanVector(GeoUtils.reverseCoordinates(lineSegment.p1));
  final double length=GeoUtils.getAngleDegreesInMeters(lineSegment.getLength());
  final double distToStart=Math.abs(distToStartOfLine);
  final Vector P1=end.minus(start).scale(1 / length);
  final Vector s1=start.minus(P1.scale(distToStart));
  final Matrix P=MatrixFactory.getDefault().createMatrix(4,2);
  P.setColumn(0,P1.stack(zeros2D));
  P.setColumn(1,zeros2D.stack(P1));
  final Vector a=s1.stack(zeros2D);
  return Maps.immutableEntry(U.times(P),U.times(a));
}
Program: 189574
Project: 189574
Buggy source:
public static void convertToGroundBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 4)   return;
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  final boolean isNegative=belief.getMean().getElement(0) < 0d;
  Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(edge,isNegative);
  Vector truncatedMean=getTruncatedEdgeLocation(belief.getMean(),edge);
  if (isNegative) {
    truncatedMean.setElement(0,Math.abs(truncatedMean.getElement(0)));
  }
  final Matrix C=belief.getCovariance();
  final Vector projMean=projPair.getKey().times(truncatedMean).plus(projPair.getValue());
  final Matrix projCov=projPair.getKey().times(C).times(projPair.getKey().transpose());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}

Fixed version (ground truth):
public static void convertToGroundBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 4)   return;
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  final double distanceAlong=belief.getMean().getElement(0);
  final boolean isNegative=distanceAlong < 0d;
  LinearLocation lineLocation=edge.getInferredEdge().getLengthLocationMap().getLocation(GeoUtils.getMetersInAngleDegrees(distanceAlong));
  LineSegment lineSegment=lineLocation.getSegment(edge.getInferredEdge().getGeometry());
  final double distanceToStartOfSegment=GeoUtils.getAngleDegreesInMeters(edge.getInferredEdge().getLengthIndexedLine().indexOf(lineSegment.p0));
  if (isNegative)   lineSegment.reverse();
  Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(lineSegment,distanceToStartOfSegment);
  Vector truncatedMean=getTruncatedEdgeLocation(belief.getMean(),edge);
  if (isNegative) {
    truncatedMean.setElement(0,Math.abs(truncatedMean.getElement(0)));
  }
  final Matrix C=belief.getCovariance();
  final Vector projMean=projPair.getKey().times(truncatedMean).plus(projPair.getValue());
  final Matrix projCov=projPair.getKey().times(C).times(projPair.getKey().transpose());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}
Program: 189575
Project: 189575
Buggy source:
@Override public MathTransform get(){
  return super.get();
}

Fixed version (ground truth):
@Override public GeoSetup get(){
  return super.get();
}
Program: 189576
Project: 189576
Buggy source:
public static MathTransform getCRSTransform(){
  return transform.get();
}

Fixed version (ground truth):
public static MathTransform getCRSTransform(){
  return geoData.get().getTransform();
}
Program: 189577
Project: 189577
Buggy source:
@Override protected MathTransform initialValue(){
  System.setProperty("String_Node_Str","String_Node_Str");
  try {
    final String googleWebMercatorCode="String_Node_Str";
    final String cartesianCode="String_Node_Str";
    final CRSAuthorityFactory crsAuthorityFactory=CRS.getAuthorityFactory(true);
    final CoordinateReferenceSystem mapCRS=crsAuthorityFactory.createCoordinateReferenceSystem(googleWebMercatorCode);
    final CoordinateReferenceSystem dataCRS=crsAuthorityFactory.createCoordinateReferenceSystem(cartesianCode);
    final boolean lenient=true;
    return CRS.findMathTransform(mapCRS,dataCRS,lenient);
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@Override protected GeoSetup initialValue(){
  System.setProperty("String_Node_Str","String_Node_Str");
  try {
    final String googleWebMercatorCode="String_Node_Str";
    final String cartesianCode="String_Node_Str";
    final CRSAuthorityFactory crsAuthorityFactory=CRS.getAuthorityFactory(true);
    final CoordinateReferenceSystem mapCRS=crsAuthorityFactory.createCoordinateReferenceSystem(googleWebMercatorCode);
    final CoordinateReferenceSystem dataCRS=crsAuthorityFactory.createCoordinateReferenceSystem(cartesianCode);
    final boolean lenient=true;
    final MathTransform transform=CRS.findMathTransform(mapCRS,dataCRS,lenient);
    return new GeoSetup(mapCRS,dataCRS,transform);
  }
 catch (  final Exception e) {
    e.printStackTrace();
  }
  return null;
}
Program: 189578
Project: 189578
Buggy source:
public static synchronized Observation createObservation(String vehicleId,String timestamp,String latStr,String lonStr,String velocity,String heading,String accuracy) throws NumberFormatException, ParseException, TransformException, TimeOrderException {
  final double lat=Double.parseDouble(latStr);
  final double lon=Double.parseDouble(lonStr);
  final Coordinate obsCoords=new Coordinate(lon,lat);
  final Double velocityd=velocity != null ? Double.parseDouble(velocity) : null;
  final Double headingd=heading != null ? Double.parseDouble(heading) : null;
  final Double accuracyd=accuracy != null ? Double.parseDouble(accuracy) : null;
  final Date time=sdf.parse(timestamp);
  return createObservation(vehicleId,time,obsCoords,velocityd,headingd,accuracyd);
}

Fixed version (ground truth):
public static synchronized Observation createObservation(String vehicleId,String timestamp,String latStr,String lonStr,String velocity,String heading,String accuracy) throws NumberFormatException, ParseException, TransformException, TimeOrderException {
  final double lat=Double.parseDouble(latStr);
  final double lon=Double.parseDouble(lonStr);
  final Coordinate obsCoords=new Coordinate(lat,lon);
  Preconditions.checkArgument(GeoUtils.isInLatLonCoords(obsCoords));
  final Double velocityd=velocity != null ? Double.parseDouble(velocity) : null;
  final Double headingd=heading != null ? Double.parseDouble(heading) : null;
  final Double accuracyd=accuracy != null ? Double.parseDouble(accuracy) : null;
  final Date time=sdf.parse(timestamp);
  return createObservation(vehicleId,time,obsCoords,velocityd,headingd,accuracyd);
}
Program: 189579
Project: 189579
Buggy source:
public static boolean isInProjCoords(Coordinate rawCoords){
  try {
    JTS.checkCoordinatesRange(JTS.toGeometry(JTS.toDirectPosition(rawCoords,getDataCRS()).getDirectPosition()),getDataCRS());
    return true;
  }
 catch (  PointOutsideEnvelopeException e) {
    return false;
  }
}

Fixed version (ground truth):
public static boolean isInProjCoords(Coordinate rawCoords){
  try {
    JTS.checkCoordinatesRange(JTS.toGeometry(JTS.toDirectPosition(rawCoords,getProjCRS()).getDirectPosition()),getProjCRS());
    return true;
  }
 catch (  PointOutsideEnvelopeException e) {
    return false;
  }
}
Program: 189580
Project: 189580
Buggy source:
public static boolean isInLatLonCoords(Coordinate rawCoords){
  try {
    JTS.checkCoordinatesRange(JTS.toGeometry(JTS.toDirectPosition(rawCoords,getMapCRS()).getDirectPosition()),getMapCRS());
    return true;
  }
 catch (  PointOutsideEnvelopeException e) {
    return false;
  }
}

Fixed version (ground truth):
public static boolean isInLatLonCoords(Coordinate rawCoords){
  try {
    JTS.checkCoordinatesRange(JTS.toGeometry(JTS.toDirectPosition(rawCoords,getLatLonCRS()).getDirectPosition()),getLatLonCRS());
    return true;
  }
 catch (  PointOutsideEnvelopeException e) {
    return false;
  }
}
Program: 189581
Project: 189581
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + freeMotionTransProbPrior.getParameters() + "String_Node_Str"+ freeMotionTransPrior.getParameters()+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + freeMotionTransPrior.getParameters() + "String_Node_Str"+ edgeMotionTransPrior.getParameters()+ "String_Node_Str";
}
Program: 189582
Project: 189582
Buggy source:
public Set<InferredEdge> getNearbyEdges(Vector mean){
  Set<InferredEdge> results=Sets.newHashSet();
  SnappedEdges snappedEdges=this.narratedGraph.snapToGraph(null,new Coordinate(mean.getElement(0),mean.getElement(1)));
  for (  Edge edge : snappedEdges.getSnappedEdges()) {
    results.add(getInferredEdge(edge));
  }
  return results;
}

Fixed version (ground truth):
/** 
 * Get nearby street edges from a projected point.
 * @param mean
 * @return
 */
public Set<InferredEdge> getNearbyEdges(Vector mean){
  Set<InferredEdge> results=Sets.newHashSet();
  Coordinate latlon=GeoUtils.convertToLatLon(mean);
  SnappedEdges snappedEdges=this.narratedGraph.snapToGraph(null,latlon);
  for (  Edge edge : snappedEdges.getSnappedEdges()) {
    results.add(getInferredEdge(edge));
  }
  return results;
}
Program: 189583
Project: 189583
Buggy source:
/** 
 * This returns a list of edges that are outgoing, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way against the direction of this edge).
 * @return
 */
public List<InferredEdge> getOutgoingTransferableEdges(){
  List<InferredEdge> result=Lists.newArrayList();
  for (  Edge edge : this.startVertex.getOutgoing()) {
    Set<Edge> tmpResults=Sets.newHashSet();
    if (edge.getGeometry() == null) {
      tmpResults.addAll(edge.getFromVertex().getOutgoingStreetEdges());
      tmpResults.addAll(edge.getToVertex().getOutgoingStreetEdges());
    }
 else {
      tmpResults.add(edge);
    }
    for (    Edge edge2 : tmpResults) {
      if (!edge2.getGeometry().equals(geometry))       result.add(graph.getInferredEdge(edge2));
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * This returns a list of edges that are outgoing, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way against the direction of this edge).
 * @return
 */
public List<InferredEdge> getOutgoingTransferableEdges(){
  List<InferredEdge> result=Lists.newArrayList();
  for (  Edge edge : this.endVertex.getOutgoing()) {
    Set<Edge> tmpResults=Sets.newHashSet();
    if (edge.getGeometry() == null) {
      tmpResults.addAll(edge.getFromVertex().getOutgoingStreetEdges());
      tmpResults.addAll(edge.getToVertex().getOutgoingStreetEdges());
    }
 else {
      tmpResults.add(edge);
    }
    for (    Edge edge2 : tmpResults) {
      if (!edge2.getGeometry().equals(geometry))       result.add(graph.getInferredEdge(edge2));
    }
  }
  return result;
}
Program: 189584
Project: 189584
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + endPoint + "String_Node_Str"+ startPoint+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + edgeId + "String_Node_Str"+ endPoint+ "String_Node_Str"+ startPoint+ "String_Node_Str"+ length+ "String_Node_Str";
}
Program: 189585
Project: 189585
Buggy source:
public OsmSegment(Integer i,Geometry g){
  id=i;
  geom=g;
}

Fixed version (ground truth):
public OsmSegment(Integer i,Geometry g,String name){
  angle=Angle.angle(g.getCoordinates()[0],g.getCoordinates()[1]);
  id=i;
  geom=g;
  this.name=name;
}
Program: 189586
Project: 189586
Buggy source:
public static void segment(Integer segmentId) throws JsonGenerationException, JsonMappingException, IOException {
  final Edge e=graph.getGraph().getEdgeById(segmentId);
  if (e != null) {
    final OsmSegment osmSegment=new OsmSegment(segmentId,e.getGeometry());
    renderJSON(jsonMapper.writeValueAsString(osmSegment));
  }
 else   badRequest();
}

Fixed version (ground truth):
public static void segment(Integer segmentId) throws JsonGenerationException, JsonMappingException, IOException {
  final Edge e=graph.getGraph().getEdgeById(segmentId);
  if (e != null) {
    final OsmSegment osmSegment=new OsmSegment(segmentId,e.getGeometry(),e.toString());
    renderJSON(jsonMapper.writeValueAsString(osmSegment));
  }
 else   badRequest();
}
Program: 189589
Project: 189589
Buggy source:
public EdgeTransitionDistributions(InferredGraph graph){
  this.graph=graph;
}

Fixed version (ground truth):
public EdgeTransitionDistributions(InferredGraph graph){
  this.graph=graph;
  freeMotionTransPrior.setParameters(freeMotionTransProbPrior.getMean());
  edgeMotionTransPrior.setParameters(edgeMotionTransProbPrior.getMean());
}
Program: 189590
Project: 189590
Buggy source:
public InferredEdge sample(Random rng,List<InferredEdge> transferEdges,InferredEdge currentEdge,MultivariateGaussian groundBelief){
  Preconditions.checkArgument(groundBelief.getInputDimensionality() == 4);
  Preconditions.checkArgument(!transferEdges.contains(InferredGraph.getEmptyEdge()));
  Preconditions.checkNotNull(currentEdge);
  Preconditions.checkNotNull(transferEdges);
  if (currentEdge == InferredGraph.getEmptyEdge()) {
    if (transferEdges.isEmpty()) {
      return InferredGraph.getEmptyEdge();
    }
 else {
      final Vector sample=this.freeMotionTransPrior.sample(rng);
      if (sample.equals(stateOffToOn)) {
        return transferEdges.get(rng.nextInt(transferEdges.size()));
      }
 else {
        return InferredGraph.getEmptyEdge();
      }
    }
  }
 else {
    final Vector sample=this.edgeMotionTransPrior.sample(rng);
    if (sample.equals(stateOnToOff)) {
      return InferredGraph.getEmptyEdge();
    }
 else {
      List<InferredEdge> support=Lists.newArrayList(transferEdges);
      support.add(currentEdge);
      return support.get(rng.nextInt(transferEdges.size()));
    }
  }
}

Fixed version (ground truth):
public InferredEdge sample(Random rng,List<InferredEdge> transferEdges,InferredEdge currentEdge){
  Preconditions.checkArgument(!transferEdges.contains(InferredGraph.getEmptyEdge()));
  Preconditions.checkNotNull(currentEdge);
  Preconditions.checkNotNull(transferEdges);
  if (currentEdge == InferredGraph.getEmptyEdge()) {
    if (transferEdges.isEmpty()) {
      return InferredGraph.getEmptyEdge();
    }
 else {
      final Vector sample=this.freeMotionTransPrior.sample(rng);
      if (sample.equals(stateOffToOn)) {
        return transferEdges.get(rng.nextInt(transferEdges.size()));
      }
 else {
        return InferredGraph.getEmptyEdge();
      }
    }
  }
 else {
    final Vector sample=this.edgeMotionTransPrior.sample(rng);
    if (sample.equals(stateOnToOff) || transferEdges.isEmpty()) {
      return InferredGraph.getEmptyEdge();
    }
 else {
      List<InferredEdge> support=Lists.newArrayList(transferEdges);
      return support.get(rng.nextInt(transferEdges.size()));
    }
  }
}
Program: 189591
Project: 189591
Buggy source:
/** 
 * This returns a list of edges that are incoming, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way in the direction of this edge).
 * @return
 */
public List<InferredEdge> getIncomingTransferableEdges(){
  List<InferredEdge> result=Lists.newArrayList();
  for (  Edge incomingEdge : this.startVertex.getIncoming()) {
    if (!incomingEdge.getGeometry().equals(geometry))     result.add(graph.getInferredEdge(incomingEdge));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * This returns a list of edges that are incoming, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way in the direction of this edge).
 * @return
 */
public List<InferredEdge> getIncomingTransferableEdges(){
  List<InferredEdge> result=Lists.newArrayList();
  for (  Edge edge : this.startVertex.getIncoming()) {
    Set<Edge> tmpResults=Sets.newHashSet();
    if (edge.getGeometry() == null) {
      tmpResults.addAll(edge.getFromVertex().getOutgoingStreetEdges());
      tmpResults.addAll(edge.getToVertex().getOutgoingStreetEdges());
    }
 else {
      tmpResults.add(edge);
    }
    for (    Edge edge2 : tmpResults) {
      if (!edge2.getGeometry().equals(geometry))       result.add(graph.getInferredEdge(edge2));
    }
  }
  return result;
}
Program: 189592
Project: 189592
Buggy source:
public Set<InferredPath> load(PathKey key){
  return Sets.newHashSet(InferredPath.getEmptyPath());
}

Fixed version (ground truth):
public Set<InferredPath> load(PathKey key){
  return computePaths(key);
}
Program: 189593
Project: 189593
Buggy source:
/** 
 * This returns a list of edges that are outgoing, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way against the direction of this edge).
 * @return
 */
public List<InferredEdge> getOutgoingTransferableEdges(){
  List<InferredEdge> result=Lists.newArrayList();
  for (  Edge outgoingEdge : this.startVertex.getOutgoing()) {
    if (!outgoingEdge.getGeometry().equals(geometry))     result.add(graph.getInferredEdge(outgoingEdge));
  }
  return result;
}

Fixed version (ground truth):
/** 
 * This returns a list of edges that are outgoing, wrt the direction of this edge, and that are reachable from this edge (e.g. not one way against the direction of this edge).
 * @return
 */
public List<InferredEdge> getOutgoingTransferableEdges(){
  List<InferredEdge> result=Lists.newArrayList();
  for (  Edge edge : this.startVertex.getOutgoing()) {
    Set<Edge> tmpResults=Sets.newHashSet();
    if (edge.getGeometry() == null) {
      tmpResults.addAll(edge.getFromVertex().getOutgoingStreetEdges());
      tmpResults.addAll(edge.getToVertex().getOutgoingStreetEdges());
    }
 else {
      tmpResults.add(edge);
    }
    for (    Edge edge2 : tmpResults) {
      if (!edge2.getGeometry().equals(geometry))       result.add(graph.getInferredEdge(edge2));
    }
  }
  return result;
}
Program: 189594
Project: 189594
Buggy source:
/** 
 * Get the snapped location in projected/euclidean coordinates for the  given obsPoint (in lat/lon).
 * @param obsPoint
 * @return
 */
public Vector getPointOnEdge(Coordinate obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final LinearLocation here=line.project(obsPoint);
  final Coordinate pointOnLine=line.extractPoint(here);
  final Coordinate projPointOnLine=GeoUtils.convertToEuclidean(pointOnLine);
  return VectorFactory.getDefault().createVector2D(projPointOnLine.x,projPointOnLine.y);
}

Fixed version (ground truth):
/** 
 * Get the snapped location in projected/euclidean coordinates for the  given obsPoint (in lat/lon).
 * @param obsPoint
 * @return
 */
public Vector getPointOnEdge(Coordinate obsPoint){
  if (this == InferredEdge.emptyEdge)   return null;
  final Coordinate revObsPoint=new Coordinate(obsPoint.y,obsPoint.x);
  final LinearLocation here=line.project(revObsPoint);
  final Coordinate pointOnLine=line.extractPoint(here);
  final Coordinate revOnLine=new Coordinate(pointOnLine.y,pointOnLine.x);
  final Coordinate projPointOnLine=GeoUtils.convertToEuclidean(revOnLine);
  return VectorFactory.getDefault().createVector2D(projPointOnLine.x,projPointOnLine.y);
}
Program: 189595
Project: 189595
Buggy source:
private InferredEdge(Edge edge,Integer edgeId,InferredGraph graph){
  this.graph=graph;
  this.edgeId=edgeId;
  this.line=new LocationIndexedLine(edge.getGeometry());
  this.geometry=edge.getGeometry();
  this.startVertex=edge.getFromVertex();
  this.endVertex=edge.getToVertex();
  final Coordinate startPoint=this.line.extractPoint(this.line.getStartIndex());
  final Coordinate startPointCoord=GeoUtils.convertToEuclidean(startPoint);
  this.startPoint=VectorFactory.getDefault().createVector2D(startPointCoord.x,startPointCoord.y);
  final Coordinate endPoint=this.line.extractPoint(this.line.getEndIndex());
  final Coordinate endPointCoord=GeoUtils.convertToEuclidean(endPoint);
  this.endPoint=VectorFactory.getDefault().createVector2D(endPointCoord.x,endPointCoord.y);
  this.length=this.startPoint.euclideanDistance(this.endPoint);
  this.angle=Angle.angle(startPoint,endPoint);
  this.velocityPrecisionDist=new NormalInverseGammaDistribution(266d,1 / Math.sqrt(1800d),1 / Math.sqrt(1800) + 1,Math.sqrt(1800));
  this.velocityEstimator=new UnivariateGaussianMeanVarianceBayesianEstimator(velocityPrecisionDist);
}

Fixed version (ground truth):
private InferredEdge(Edge edge,Integer edgeId,InferredGraph graph){
  this.graph=graph;
  this.edgeId=edgeId;
  this.line=new LocationIndexedLine(edge.getGeometry());
  this.geometry=edge.getGeometry();
  this.startVertex=edge.getFromVertex();
  this.endVertex=edge.getToVertex();
  final Coordinate startPoint=this.line.extractPoint(this.line.getStartIndex());
  final Coordinate startPointCoord=GeoUtils.convertToEuclidean(new Coordinate(startPoint.y,startPoint.x));
  this.startPoint=VectorFactory.getDefault().createVector2D(startPointCoord.x,startPointCoord.y);
  final Coordinate endPoint=this.line.extractPoint(this.line.getEndIndex());
  final Coordinate endPointCoord=GeoUtils.convertToEuclidean(new Coordinate(endPoint.y,endPoint.x));
  this.endPoint=VectorFactory.getDefault().createVector2D(endPointCoord.x,endPointCoord.y);
  this.length=this.startPoint.euclideanDistance(this.endPoint);
  this.angle=Angle.angle(startPoint,endPoint);
  this.velocityPrecisionDist=new NormalInverseGammaDistribution(266d,1 / Math.sqrt(1800d),1 / Math.sqrt(1800) + 1,Math.sqrt(1800));
  this.velocityEstimator=new UnivariateGaussianMeanVarianceBayesianEstimator(velocityPrecisionDist);
}
Program: 189596
Project: 189596
Buggy source:
public InferredPath(InferredEdge inferredEdge){
  Preconditions.checkArgument(inferredEdge == InferredGraph.getEmptyEdge());
  this.edges=ImmutableList.of(PathEdge.getEdge(inferredEdge,0d));
  this.totalPathDistance=inferredEdge.getLength();
}

Fixed version (ground truth):
public InferredPath(InferredEdge inferredEdge){
  Preconditions.checkArgument(inferredEdge != InferredGraph.getEmptyEdge());
  this.edges=ImmutableList.of(PathEdge.getEdge(inferredEdge,0d));
  this.totalPathDistance=inferredEdge.getLength();
}
Program: 189598
Project: 189598
Buggy source:
public static void convertToGroundBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 4)   return;
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(edge);
  Vector truncatedMean;
  if (belief.getMean().getElement(0) > edge.getDistToStartOfEdge() + edge.getInferredEdge().getLength()) {
    truncatedMean=belief.getMean().clone();
    truncatedMean.setElement(0,edge.getDistToStartOfEdge() + edge.getInferredEdge().getLength());
  }
 else   if (belief.getMean().getElement(0) < edge.getDistToStartOfEdge()) {
    truncatedMean=belief.getMean().clone();
    truncatedMean.setElement(0,edge.getDistToStartOfEdge());
  }
 else {
    truncatedMean=belief.getMean();
  }
  Matrix C=belief.getCovariance();
  belief.setMean(projPair.getKey().times(truncatedMean).minus(projPair.getValue()));
  belief.setCovariance(projPair.getKey().times(C).times(projPair.getKey().transpose()));
}

Fixed version (ground truth):
public static void convertToGroundBelief(MultivariateGaussian belief,PathEdge edge){
  Preconditions.checkArgument(belief.getInputDimensionality() == 2 || belief.getInputDimensionality() == 4);
  if (belief.getInputDimensionality() == 4)   return;
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  Entry<Matrix,Vector> projPair=StandardRoadTrackingFilter.posVelProjectionPair(edge);
  Vector truncatedMean;
  final double totalPathDistance=edge.getDistToStartOfEdge() + edge.getInferredEdge().getLength();
  final double distance;
  truncatedMean=belief.getMean().clone();
  if (belief.getMean().getElement(0) < 0d) {
    distance=totalPathDistance + belief.getMean().getElement(0);
    truncatedMean.setElement(0,distance);
  }
 else {
    distance=belief.getMean().getElement(0);
  }
  if (distance > totalPathDistance) {
    truncatedMean.setElement(0,totalPathDistance);
  }
 else   if (distance < edge.getDistToStartOfEdge()) {
    truncatedMean.setElement(0,edge.getDistToStartOfEdge());
  }
  final Matrix C=belief.getCovariance();
  final Vector projMean=projPair.getKey().times(truncatedMean).plus(projPair.getValue());
  final Matrix projCov=projPair.getKey().times(C).times(projPair.getKey().transpose());
  belief.setMean(projMean);
  belief.setCovariance(projCov);
}
Program: 189599
Project: 189599
Buggy source:
public static void invertProjection(MultivariateGaussian dist,PathEdge edge){
  Preconditions.checkNotNull(edge);
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  Preconditions.checkArgument(dist.getInputDimensionality() == 2 || dist.getInputDimensionality() == 4);
  Entry<Matrix,Vector> projPair=posVelProjectionPair(edge);
  if (dist.getInputDimensionality() == 2) {
    Vector a=projPair.getKey().times(dist.getMean()).plus(projPair.getValue());
    Matrix R=projPair.getKey().times(dist.getCovariance()).times(projPair.getKey().transpose());
    dist.setCovariance(R);
    dist.setMean(a);
  }
 else {
    Vector m=projPair.getKey().transpose().times(dist.getMean().minus(projPair.getValue()));
    final double totalDist=edge.getDistToStartOfEdge() + edge.getInferredEdge().getLength();
    double dist2=m.getElement(0);
    if (dist2 < edge.getDistToStartOfEdge()) {
      dist2=0d;
    }
 else     if (dist2 > totalDist) {
      dist2=totalDist;
    }
    m.setElement(0,dist2);
    Matrix C=projPair.getKey().transpose().times(dist.getCovariance()).times(projPair.getKey());
    dist.setCovariance(C);
    dist.setMean(m);
  }
}

Fixed version (ground truth):
public static void invertProjection(MultivariateGaussian dist,PathEdge edge){
  Preconditions.checkNotNull(edge);
  Preconditions.checkArgument(edge != PathEdge.getEmptyPathEdge());
  Preconditions.checkArgument(dist.getInputDimensionality() == 2 || dist.getInputDimensionality() == 4);
  Entry<Matrix,Vector> projPair=posVelProjectionPair(edge);
  if (dist.getInputDimensionality() == 2) {
    convertToGroundBelief(dist,edge);
  }
 else {
    Vector m=projPair.getKey().transpose().times(dist.getMean().minus(projPair.getValue()));
    final double totalDist=edge.getDistToStartOfEdge() + edge.getInferredEdge().getLength();
    double dist2=m.getElement(0);
    if (dist2 < edge.getDistToStartOfEdge()) {
      dist2=0d;
    }
 else     if (dist2 > totalDist) {
      dist2=totalDist;
    }
    m.setElement(0,dist2);
    Matrix C=projPair.getKey().transpose().times(dist.getCovariance()).times(projPair.getKey());
    dist.setCovariance(C);
    dist.setMean(m);
  }
}
Program: 189600
Project: 189600
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + movementFilter + "String_Node_Str"+ belief+ "String_Node_Str"+ edgeTransitionDist+ "String_Node_Str"+ observation+ "String_Node_Str"+ edge+ "String_Node_Str"+ parentState+ "String_Node_Str"+ distanceFromPreviousState+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return Objects.toStringHelper(this).add("String_Node_Str",belief).add("String_Node_Str",edge).addValue(observation.getTimestamp()).add("String_Node_Str",parentState).add("String_Node_Str",movementFilter).toString();
}
Program: 189602
Project: 189602
Buggy source:
public static void simulation(){
  Simulation sim=new Simulation();
  Logger.info("String_Node_Str" + sim.getSimulationName());
  InferenceService.addSimulationRecords(sim.getSimulationName(),sim.runSimulation());
  instances();
}

Fixed version (ground truth):
public static void simulation(){
  Simulation sim=new Simulation();
  Logger.info("String_Node_Str" + sim.getSimulationName());
  if (InferenceService.getInferenceInstance(sim.getSimulationName()) != null) {
    Logger.warn("String_Node_Str" + sim.getSimulationName());
    InferenceService.remove(sim.getSimulationName());
  }
  Application.simActor.tell(sim);
  instances();
}
Program: 189603
Project: 189603
Buggy source:
public VehicleState(InferredGraph graph,Observation observation,StandardRoadTrackingFilter filter,MultivariateGaussian belief,EdgeTransitionDistributions edgeTransitionDist,PathEdge edge,InferredPath path,VehicleState state){
  this.observation=observation;
  this.movementFilter=filter;
  this.belief=belief;
  this.graph=graph;
  this.distanceFromPreviousState=edge.getDistToStartOfEdge();
  if (belief.getInputDimensionality() == 2)   belief.getMean().setElement(0,belief.getMean().getElement(0) - edge.getDistToStartOfEdge());
  this.edgeTransitionDist=edgeTransitionDist;
  this.edge=edge.getInferredEdge();
  this.parentState=state;
  this.path=path;
  final double timeDiff;
  if (observation.getPreviousObservation() != null) {
    timeDiff=observation.getTimestamp().getTime() - observation.getPreviousObservation().getTimestamp().getTime();
  }
 else {
    timeDiff=30d;
  }
  this.movementFilter.setCurrentTimeDiff(timeDiff);
}

Fixed version (ground truth):
public VehicleState(InferredGraph graph,Observation observation,StandardRoadTrackingFilter filter,MultivariateGaussian belief,EdgeTransitionDistributions edgeTransitionDist,PathEdge edge,InferredPath path,VehicleState state){
  this.observation=observation;
  this.movementFilter=filter;
  this.belief=belief;
  this.graph=graph;
  this.distanceFromPreviousState=edge.getDistToStartOfEdge();
  if (belief.getInputDimensionality() == 2)   belief.getMean().setElement(0,belief.getMean().getElement(0) - edge.getDistToStartOfEdge());
  this.edgeTransitionDist=edgeTransitionDist;
  this.edge=edge.getInferredEdge();
  this.parentState=state;
  this.path=path;
  final double timeDiff;
  if (observation.getPreviousObservation() != null) {
    timeDiff=(observation.getTimestamp().getTime() - observation.getPreviousObservation().getTimestamp().getTime()) / 1000d;
  }
 else {
    timeDiff=30d;
  }
  this.movementFilter.setCurrentTimeDiff(timeDiff);
}
Program: 189605
Project: 189605
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.host_edit);
  Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  viewPager=(ViewPager)findViewById(R.id.pager);
  viewPager.setAdapter(new EditHostFragmentPagerAdapter(getSupportFragmentManager(),this,hostId));
  databaseManager=new DatabaseManager(this);
  Bundle extras=getIntent().getExtras();
  hostId=(BundleUtils.contains(extras,KEY_HOST_ID)) ? extras.getLong(KEY_HOST_ID) : null;
  Host host=(hostId == null) ? null : databaseManager.getHost(hostId);
  if (host != null)   getSupportActionBar().setSubtitle(host.getLabel());
  getSupportActionBar().setHomeButtonEnabled(true);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState != null) {
    if (savedInstanceState.getBoolean(KEY_SHOW_CANCEL_DIALOG))     showCancelDialog();
  }
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.host_edit);
  Toolbar toolbar=(Toolbar)findViewById(R.id.toolbar);
  setSupportActionBar(toolbar);
  databaseManager=new DatabaseManager(this);
  Bundle extras=getIntent().getExtras();
  hostId=(BundleUtils.contains(extras,KEY_HOST_ID)) ? extras.getLong(KEY_HOST_ID) : null;
  Host host=(hostId == null) ? null : databaseManager.getHost(hostId);
  viewPager=(ViewPager)findViewById(R.id.pager);
  viewPager.setAdapter(new EditHostFragmentPagerAdapter(getSupportFragmentManager(),this,hostId));
  if (host != null)   getSupportActionBar().setSubtitle(host.getLabel());
  getSupportActionBar().setHomeButtonEnabled(true);
  getSupportActionBar().setDisplayHomeAsUpEnabled(true);
  if (savedInstanceState != null) {
    if (savedInstanceState.getBoolean(KEY_SHOW_CANCEL_DIALOG))     showCancelDialog();
  }
}
Program: 189606
Project: 189606
Buggy source:
public synchronized void initializeApplicationAdapter(List<Application> applications){
  applicationAdapter=new ApplicationArrayAdapter(getActivity(),applications);
  initializeLaunchIntentSpinner();
}

Fixed version (ground truth):
public void initializeApplicationAdapter(List<Application> applications){
  applicationAdapter=new ApplicationArrayAdapter(getActivity(),applications);
  initializeLaunchIntentSpinner();
}