nus-yam/ex-repair huggingface dataset:
Program: 17331
Project: 17331
Buggy source:
/** 
 * <p> Callback that is fired whenever the   {@link ConnectionState} of the{@link Connection} changes. The state typically changes during connectionto Pusher and during disconnection and reconnection. </p> <p> This callback is only fired if the  {@linkplain ConnectionEventListener}has been bound to the new state by calling  {@link Connection#bind(ConnectionState,ConnectionEventListener)} witheither the new state or  {@link ConnectionState#ALL}. </p>
 * @param change An object that contains the previous state of the connection and the new state. The new state can be retrieved by calling {@link ConnectionStateChange#getCurrentState()}.
 */
void onConnectionStateChange(ConnectionStateChange change);

Fixed version (ground truth):
/** 
 * Callback that is fired whenever the   {@link ConnectionState} of the{@link Connection} changes. The state typically changes during connectionto Pusher and during disconnection and reconnection. <p> This callback is only fired if the  {@linkplain ConnectionEventListener}has been bound to the new state by calling  {@link Connection#bind(ConnectionState,ConnectionEventListener)} witheither the new state or  {@link ConnectionState#ALL}. </p>
 * @param change An object that contains the previous state of the connectionand the new state. The new state can be retrieved by calling {@link ConnectionStateChange#getCurrentState()}.
 */
void onConnectionStateChange(ConnectionStateChange change);
Program: 17332
Project: 17332
Buggy source:
/** 
 * The previous connections state. The state the connection has transitioned from.
 * @return
 */
public ConnectionState getPreviousState(){
  return previousState;
}

Fixed version (ground truth):
/** 
 * The previous connections state. The state the connection has transitioned from.
 * @return The previous connection state
 */
public ConnectionState getPreviousState(){
  return previousState;
}
Program: 17333
Project: 17333
Buggy source:
/** 
 * Used within the library to create a connection state change. Not be used used as part of the API.
 * @param previousState
 * @param currentState
 */
public ConnectionStateChange(final ConnectionState previousState,final ConnectionState currentState){
  if (previousState == currentState) {
    throw new IllegalArgumentException("String_Node_Str" + currentState);
  }
  this.previousState=previousState;
  this.currentState=currentState;
}

Fixed version (ground truth):
/** 
 * Used within the library to create a connection state change. Not be used used as part of the API.
 * @param previousState The previous connection state
 * @param currentState The current connection state
 */
public ConnectionStateChange(final ConnectionState previousState,final ConnectionState currentState){
  if (previousState == currentState) {
    throw new IllegalArgumentException("String_Node_Str" + currentState);
  }
  this.previousState=previousState;
  this.currentState=currentState;
}
Program: 17334
Project: 17334
Buggy source:
/** 
 * The current connection state. The state the connection has transitioned to.
 * @return
 */
public ConnectionState getCurrentState(){
  return currentState;
}

Fixed version (ground truth):
/** 
 * The current connection state. The state the connection has transitioned to.
 * @return The current connection state
 */
public ConnectionState getCurrentState(){
  return currentState;
}
Program: 17335
Project: 17335
Buggy source:
/** 
 * Set additional headers to be sent as part of the request.
 * @param headers
 */
public void setHeaders(final HashMap<String,String> headers){
  mHeaders=headers;
}

Fixed version (ground truth):
/** 
 * Set additional headers to be sent as part of the request.
 * @param headers A map of headers
 */
public void setHeaders(final HashMap<String,String> headers){
  mHeaders=headers;
}
Program: 17336
Project: 17336
Buggy source:
public void clear(){
  channelNameToChannelMap.clear();
}

Fixed version (ground truth):
public void clear(){
  channelNameToChannelMap.clear();
  queuedChannels.clear();
}
Program: 17337
Project: 17337
Buggy source:
@Override public void onConnectionStateChange(ConnectionStateChange change){
  if (change.getCurrentState() == ConnectionState.CONNECTED) {
    for (    String message : queuedSubscribeMessages) {
      connection.sendMessage(message);
      queuedSubscribeMessages.remove(message);
    }
  }
}

Fixed version (ground truth):
@Override public void onConnectionStateChange(ConnectionStateChange change){
  if (change.getCurrentState() == ConnectionState.CONNECTED) {
    for (    InternalChannel channel : queuedChannels.keySet()) {
      String subscribeMessage=queuedChannels.get(channel);
      connection.sendMessage(subscribeMessage);
      queuedChannels.remove(channel);
      channel.updateState(ChannelState.SUBSCRIBE_SENT);
    }
  }
}
Program: 17338
Project: 17338
Buggy source:
public void run(){
  if (connection.getState() == ConnectionState.CONNECTED) {
    connection.sendMessage(message);
    channel.updateState(ChannelState.SUBSCRIBE_SENT);
  }
 else {
    queuedSubscribeMessages.add(message);
  }
}

Fixed version (ground truth):
public void run(){
  if (connection.getState() == ConnectionState.CONNECTED) {
    connection.sendMessage(message);
    channel.updateState(ChannelState.SUBSCRIBE_SENT);
  }
 else {
    queuedChannels.put(channel,message);
  }
}
Program: 17339
Project: 17339
Buggy source:
private void sendSubscribe(final InternalChannel channel,final String message){
  channelNameToChannelMap.put(channel.getName(),channel);
  Factory.getEventQueue().execute(new Runnable(){
    public void run(){
      if (connection.getState() == ConnectionState.CONNECTED) {
        connection.sendMessage(message);
        channel.updateState(ChannelState.SUBSCRIBE_SENT);
      }
 else {
        queuedSubscribeMessages.add(message);
      }
    }
  }
);
}

Fixed version (ground truth):
private void sendSubscribe(final InternalChannel channel,final String message){
  channelNameToChannelMap.put(channel.getName(),channel);
  Factory.getEventQueue().execute(new Runnable(){
    public void run(){
      if (connection.getState() == ConnectionState.CONNECTED) {
        connection.sendMessage(message);
        channel.updateState(ChannelState.SUBSCRIBE_SENT);
      }
 else {
        queuedChannels.put(channel,message);
      }
    }
  }
);
}
Program: 17340
Project: 17340
Buggy source:
void updateState(ChannelState subscribeSent);

Fixed version (ground truth):
void updateState(ChannelState state);
Program: 17341
Project: 17341
Buggy source:
public ExampleApp(String[] args){
  String apiKey=(args.length > 0) ? args[0] : "String_Node_Str";
  channelName=(args.length > 1) ? args[1] : "String_Node_Str";
  eventName=(args.length > 2) ? args[1] : "String_Node_Str";
  pusher=new Pusher(apiKey);
  pusher.connect(this);
}

Fixed version (ground truth):
public ExampleApp(String[] args){
  String apiKey=(args.length > 0) ? args[0] : "String_Node_Str";
  channelName=(args.length > 1) ? args[1] : "String_Node_Str";
  eventName=(args.length > 2) ? args[2] : "String_Node_Str";
  pusher=new Pusher(apiKey);
  pusher.connect(this);
}
Program: 17342
Project: 17342
Buggy source:
/** 
 * Parse JSON received from reddit into a list of new additional comment tree elements. This parser expects the JSON to be of a listing of comments and more's.<br> <br> <i>Note: this parsing can only be performed on listings of comments and more's, not on a comment tree of a submission.</i>
 * @param jsonText JSON Text
 * @return Parsed list of comments
 * @throws ParseException
 * @throws RedditRequestException
 */
public List<CommentTreeElement> parse(String jsonText) throws RedditParseException {
  try {
    JSONObject main=((JSONObject)((JSONObject)JSON_PARSER.parse(jsonText)).get("String_Node_Str"));
    List<CommentTreeElement> elements=new LinkedList<CommentTreeElement>();
    if (main.get("String_Node_Str") != null) {
      List<Thing> things=this.parseGeneric(main.toJSONString(),"String_Node_Str");
      for (      Thing t : things) {
        if (t instanceof Comment) {
          elements.add((Comment)t);
        }
 else         if (t instanceof More) {
          elements.add((More)t);
        }
 else {
          LOGGER.warn("String_Node_Str" + t.getKind().value() + "String_Node_Str");
        }
      }
    }
    return elements;
  }
 catch (  ParseException pe) {
    throw new RedditParseException(pe);
  }
}

Fixed version (ground truth):
/** 
 * Parse JSON received from reddit into a list of new additional comment tree elements. This parser expects the JSON to be of a listing of comments and more's.<br> <br> <i>Note: this parsing can only be performed on listings of comments and more's, not on a comment tree of a submission.</i>
 * @param jsonText JSON Text
 * @return Parsed list of comments
 * @throws ParseException
 * @throws RedditRequestException
 */
public List<CommentTreeElement> parse(String jsonText) throws RedditParseException {
  try {
    Object response=JSON_PARSER.parse(jsonText);
    this.validate(response);
    JSONObject main=(JSONObject)((JSONObject)response).get("String_Node_Str");
    List<CommentTreeElement> elements=new LinkedList<CommentTreeElement>();
    if (main.get("String_Node_Str") != null) {
      List<Thing> things=this.parseGeneric(main.toJSONString(),"String_Node_Str");
      for (      Thing t : things) {
        if (t instanceof Comment) {
          elements.add((Comment)t);
        }
 else         if (t instanceof More) {
          elements.add((More)t);
        }
 else {
          LOGGER.warn("String_Node_Str" + t.getKind().value() + "String_Node_Str");
        }
      }
    }
    return elements;
  }
 catch (  ParseException pe) {
    throw new RedditParseException(pe);
  }
}
Program: 17343
Project: 17343
Buggy source:
/** 
 * Validate that it is indeed the starting of a listing of reddit things.
 * @param response Object returned by JSON parser
 * @throws RedditRequestException If the response is not valid listing of reddit things
 */
public void validate(Object response) throws RedditParseException {
  if (response == null) {
    throw new RedditParseException();
  }
  if (!(response instanceof JSONObject)) {
    throw new RedditParseException("String_Node_Str");
  }
  JSONObject jsonResponse=((JSONObject)response);
  if (jsonResponse.get("String_Node_Str") != null) {
    throw new RedditParseException(JsonUtils.safeJsonToInteger(jsonResponse.get("String_Node_Str")));
  }
  if (jsonResponse.get("String_Node_Str") == null) {
    System.out.println(jsonResponse.toJSONString());
    throw new RedditParseException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Validate that it is indeed the starting of a listing of reddit things.
 * @param response Object returned by JSON parser
 * @throws RedditRequestException If the response is not valid listing of reddit things
 */
public void validate(Object response) throws RedditParseException {
  if (response == null) {
    throw new RedditParseException();
  }
  if (!(response instanceof JSONObject)) {
    throw new RedditParseException("String_Node_Str");
  }
  JSONObject jsonResponse=((JSONObject)response);
  if (jsonResponse.get("String_Node_Str") != null) {
    throw new RedditParseException(JsonUtils.safeJsonToInteger(jsonResponse.get("String_Node_Str")));
  }
  if (jsonResponse.get("String_Node_Str") == null && jsonResponse.get("String_Node_Str") == null) {
    throw new RedditParseException("String_Node_Str");
  }
}
Program: 17344
Project: 17344
Buggy source:
/** 
 * Format a comma separated list of the given list.
 * @param list List of strings
 * @return Comma-separated list string (e.g. "a,b,c,d")
 */
public static String formatCommaSeparatedList(List<String> list){
  StringBuilder builder=new StringBuilder();
  for (  String s : list) {
    builder.append(s);
    builder.append("String_Node_Str");
  }
  if (builder.length() > 0) {
    builder.substring(0,builder.length() - 1);
  }
  return builder.toString();
}

Fixed version (ground truth):
/** 
 * Format a comma separated list of the given list.
 * @param list List of strings
 * @return Comma-separated list string (e.g. "a,b,c,d")
 */
public static String formatCommaSeparatedList(List<String> list){
  StringBuilder builder=new StringBuilder();
  for (int i=0; i < list.size(); i++) {
    if (i != 0) {
      builder.append("String_Node_Str");
    }
    builder.append(list.get(i));
  }
  return builder.toString();
}
Program: 17345
Project: 17345
Buggy source:
/** 
 * Retrieve the counting number assigned by reddit (does not tell much in this case).
 * @return The counting number
 */
public int getCount(){
  return count;
}

Fixed version (ground truth):
/** 
 * Retrieve the counting number assigned by reddit (does not tell much in this case).
 * @return The counting number
 */
public Integer getCount(){
  return count;
}
Program: 17346
Project: 17346
Buggy source:
/** 
 * This function comments on a submission or comment with the given full name.
 * @param fullName Full name of the submission or comment
 * @param text The text to comment (can include markdown)
 */
public boolean comment(String fullname,String text) throws ActionFailedException {
  JSONObject object=(JSONObject)restClient.post("String_Node_Str" + fullname + "String_Node_Str"+ text+ "String_Node_Str"+ user.getModhash(),ApiEndpointUtils.COMMENT,user.getCookie()).getResponseObject();
  if (object.toJSONString().contains("String_Node_Str")) {
    System.err.println("String_Node_Str");
    return false;
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * This function comments on a submission or comment with the given full name.
 * @param fullName Full name of the submission or comment
 * @param text The text to comment (can include markdown)
 */
public boolean comment(String fullname,String text) throws ActionFailedException {
  JSONObject object=(JSONObject)restClient.post("String_Node_Str" + fullname + "String_Node_Str"+ text+ "String_Node_Str"+ user.getModhash(),ApiEndpointUtils.COMMENT,user.getCookie()).getResponseObject();
  if (object.toJSONString().contains("String_Node_Str")) {
    System.err.println("String_Node_Str");
    return false;
  }
 else   if (object.toJSONString().contains("String_Node_Str")) {
    System.err.println("String_Node_Str");
    return false;
  }
 else {
    return true;
  }
}
Program: 17347
Project: 17347
Buggy source:
@Override public boolean equals(Object other){
  return (other instanceof Submission && this.getFullName().equals(((Comment)other).getFullName()));
}

Fixed version (ground truth):
@Override public boolean equals(Object other){
  return (other instanceof Submission && this.getFullName().equals(((Submission)other).getFullName()));
}
Program: 17348
Project: 17348
Buggy source:
/** 
 * Get the comment list of the given user (username).
 * @param user				(Optional, set null if not used) The user as whom to retrieve the comments
 * @param username	 		Username of the user you want to retrieve from.
 * @param sort	    		(Optional, set null if not used) Sorting method.
 * @param time		 		(Optional, set null is not used) Time window
 * @param amount        	(Optional, set -1 if not used) Integer representing the desired amount of comments to return
 * @param after				(Optional, set null if not used) After which comment to retrieve
 * @return Comments of a user.
 */
public List<Comment> ofUser(User user,String username,UserOverviewSort sort,SubmissionsSearchTime time,int amount,Comment after){
  if (amount < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<Comment> result=new LinkedList<Comment>();
  int counter=0;
  while (amount >= 0) {
    int limit=(amount < RedditConstants.MAX_LIMIT_LISTING) ? amount : RedditConstants.MAX_LIMIT_LISTING;
    amount-=limit;
    List<Comment> subresult=comments.ofUser(user,username,sort,time,counter,limit,after,null,true);
    result.addAll(subresult);
    counter+=limit;
    if (subresult.size() != limit) {
      System.out.println("String_Node_Str" + subresult.size() + "String_Node_Str"+ limit+ "String_Node_Str");
      break;
    }
    if (amount <= 0) {
      break;
    }
    after=subresult.get(subresult.size() - 1);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Get the comment list of the given user (username).
 * @param user				(Optional, set null if not used) The user as whom to retrieve the comments
 * @param username	 		Username of the user you want to retrieve from.
 * @param sort	    		(Optional, set null if not used) Sorting method.
 * @param time		 		(Optional, set null is not used) Time window
 * @param amount        	(Optional, set -1 if not used) Integer representing the desired amount of comments to return
 * @param after				(Optional, set null if not used) After which comment to retrieve
 * @return Comments of a user.
 */
public List<Comment> ofUser(User user,String username,UserOverviewSort sort,SubmissionsSearchTime time,int amount,Comment after){
  if (amount < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  List<Comment> result=new LinkedList<Comment>();
  int counter=0;
  while (amount >= 0) {
    int limit=(amount < RedditConstants.MAX_LIMIT_LISTING) ? amount : RedditConstants.MAX_LIMIT_LISTING;
    amount-=limit;
    List<Comment> subresult=comments.ofUser(user,username,sort,time,counter,limit,after,null,true);
    if (subresult == null) {
      return null;
    }
    result.addAll(subresult);
    counter+=limit;
    if (subresult.size() != limit) {
      break;
    }
    if (amount <= 0) {
      break;
    }
    after=subresult.get(subresult.size() - 1);
  }
  return result;
}
Program: 17349
Project: 17349
Buggy source:
/** 
 * Parses a JSON feed received from Reddit (URL) into a nice list of Submission objects.
 * @param user 	User
 * @param url 	URL
 * @return 		Listing of submissions
 */
public List<Submission> parse(User user,String url){
  String cookie=(user == null) ? null : user.getCookie();
  List<Submission> submissions=new LinkedList<Submission>();
  Object response=restClient.get(url,cookie).getResponseObject();
  if (response instanceof JSONObject) {
    JSONObject object=(JSONObject)response;
    JSONArray array=(JSONArray)((JSONObject)object.get("String_Node_Str")).get("String_Node_Str");
    JSONObject data;
    Submission submission;
    for (    Object anArray : array) {
      data=(JSONObject)anArray;
      String kind=safeJsonToString(data.get("String_Node_Str"));
      if (kind.equals(Kind.LINK.value())) {
        data=((JSONObject)data.get("String_Node_Str"));
        submission=new Submission(data);
        submission.setUser(user);
        submissions.add(submission);
      }
    }
  }
 else {
    System.err.println("String_Node_Str" + response.toString() + "String_Node_Str");
  }
  return submissions;
}

Fixed version (ground truth):
/** 
 * Parses a JSON feed received from Reddit (URL) into a nice list of Submission objects.
 * @param user 	User
 * @param url 	URL
 * @return 		Listing of submissions
 */
public List<Submission> parse(User user,String url){
  String cookie=(user == null) ? null : user.getCookie();
  List<Submission> submissions=new LinkedList<Submission>();
  Response r=restClient.get(url,cookie);
  if (r == null) {
    System.err.println("String_Node_Str");
    return null;
  }
  Object response=r.getResponseObject();
  if (response instanceof JSONObject) {
    JSONObject object=(JSONObject)response;
    if (object.get("String_Node_Str") != null) {
      System.err.println("String_Node_Str" + object.get("String_Node_Str"));
      return null;
    }
    JSONArray array=(JSONArray)((JSONObject)object.get("String_Node_Str")).get("String_Node_Str");
    JSONObject data;
    Submission submission;
    for (    Object anArray : array) {
      data=(JSONObject)anArray;
      String kind=safeJsonToString(data.get("String_Node_Str"));
      if (kind.equals(Kind.LINK.value())) {
        data=((JSONObject)data.get("String_Node_Str"));
        submission=new Submission(data);
        submission.setUser(user);
        submissions.add(submission);
      }
    }
  }
 else {
    System.err.println("String_Node_Str" + response.toString() + "String_Node_Str");
  }
  return submissions;
}
Program: 17350
Project: 17350
Buggy source:
public String toString(){
  StringBuilder result=new StringBuilder();
  String newLine=System.lineSeparator();
  result.append("String_Node_Str").append(id).append(newLine).append("String_Node_Str").append(name).append(newLine).append("String_Node_Str").append(modhash).append(newLine).append("String_Node_Str").append(commentKarma).append(newLine).append("String_Node_Str").append(id).append(newLine).append("String_Node_Str").append(isMod).append(newLine).append("String_Node_Str").append(hasModMail).append(newLine).append("String_Node_Str").append(hasMail).append(newLine).append("String_Node_Str").append(hasVerifiedEmail).append(newLine).append("String_Node_Str").append(isGold).append(newLine).append("String_Node_Str").append(created).append(newLine).append("String_Node_Str").append(createdUTC).append(newLine).append("String_Node_Str").append(isFriend).append(newLine).append("String_Node_Str").append(over18).append(newLine);
  return result.toString();
}

Fixed version (ground truth):
public String toString(){
  StringBuilder result=new StringBuilder();
  String newLine=System.lineSeparator();
  result.append("String_Node_Str").append(id).append(newLine).append("String_Node_Str").append(name).append(newLine).append("String_Node_Str").append(modhash).append(newLine).append("String_Node_Str").append(commentKarma).append(newLine).append("String_Node_Str").append(linkKarma).append(newLine).append("String_Node_Str").append(isMod).append(newLine).append("String_Node_Str").append(hasModMail).append(newLine).append("String_Node_Str").append(hasMail).append(newLine).append("String_Node_Str").append(hasVerifiedEmail).append(newLine).append("String_Node_Str").append(isGold).append(newLine).append("String_Node_Str").append(created).append(newLine).append("String_Node_Str").append(createdUTC).append(newLine).append("String_Node_Str").append(isFriend).append(newLine).append("String_Node_Str").append(over18);
  return result.toString();
}
Program: 17351
Project: 17351
Buggy source:
/** 
 * This function submits a GET request and returns a JSON object that corresponds to it.
 * @param apiParams HTTP arguments
 * @param url URL
 * @param cookie cookie
 */
public static Object get(String apiParams,URL url,String cookie) throws IOException, ParseException {
  HttpURLConnection connection=(HttpURLConnection)url.openConnection();
  connection.setUseCaches(false);
  connection.setRequestMethod("String_Node_Str");
  if (cookie != null) {
    connection.setRequestProperty("String_Node_Str","String_Node_Str" + cookie);
  }
  connection.setRequestProperty("String_Node_Str",userAgent);
  InputStream is=null;
  Scanner s=null;
  String response=null;
  try {
    if (connection.getResponseCode() != 200) {
      s=new Scanner(connection.getErrorStream());
    }
 else {
      is=connection.getInputStream();
      s=new Scanner(is);
    }
    s.useDelimiter("String_Node_Str");
    response=s.next();
    System.out.println("String_Node_Str" + response + "String_Node_Str");
    s.close();
  }
 catch (  IOException e2) {
    e2.printStackTrace();
  }
  JSONParser parser=new JSONParser();
  return parser.parse(response);
}

Fixed version (ground truth):
/** 
 * This function submits a GET request and returns a JSON object that corresponds to it.
 * @param apiParams HTTP arguments
 * @param url URL
 * @param cookie cookie
 */
public static Object get(String apiParams,URL url,String cookie) throws IOException, ParseException {
  HttpURLConnection connection=(HttpURLConnection)url.openConnection();
  connection.setUseCaches(false);
  connection.setRequestMethod("String_Node_Str");
  if (cookie != null) {
    connection.setRequestProperty("String_Node_Str","String_Node_Str" + cookie);
  }
  connection.setRequestProperty("String_Node_Str",userAgent);
  InputStream is=null;
  Scanner s=null;
  String response=null;
  try {
    if (connection.getResponseCode() != 200) {
      s=new Scanner(connection.getErrorStream());
    }
 else {
      is=connection.getInputStream();
      s=new Scanner(is);
    }
    s.useDelimiter("String_Node_Str");
    response="String_Node_Str";
    while (s.hasNext()) {
      response+=s.next();
    }
    System.out.println("String_Node_Str" + response + "String_Node_Str");
    s.close();
  }
 catch (  IOException e2) {
    e2.printStackTrace();
  }
  JSONParser parser=new JSONParser();
  return parser.parse(response);
}
Program: 17352
Project: 17352
Buggy source:
ResourceConfig getResourceConfig(JsonObject config){
  JsonArray resources=config.getArray(CONFIG_RESOURCES,null);
  if (resources == null || resources.size() == 0) {
    throw new RuntimeException("String_Node_Str" + CONFIG_RESOURCES);
  }
  String[] resourceArr=new String[resources.size()];
  for (int i=0; i < resources.size(); i++) {
    resourceArr[i]=String.valueOf(resources.get(i));
  }
  ResourceConfig rc=new ResourceConfig();
  rc.packages(resourceArr);
  rc.registerInstances(new VertxBinder());
  ClassLoader cl=Thread.currentThread().getContextClassLoader();
  JsonArray features=config.getArray(CONFIG_FEATURES,null);
  if (features != null && features.size() > 0) {
    for (int i=0; i < features.size(); i++) {
      try {
        Class<?> clazz=cl.loadClass(String.valueOf(features.get(i)));
        rc.register(clazz);
      }
 catch (      ClassNotFoundException e) {
        throw new RuntimeException(e);
      }
    }
  }
  JsonArray binders=config.getArray(CONFIG_BINDERS,null);
  if (binders != null && binders.size() > 0) {
    for (int i=0; i < binders.size(); i++) {
      try {
        Class<?> clazz=cl.loadClass(String.valueOf(features.get(i)));
        rc.register(clazz.newInstance());
      }
 catch (      ClassNotFoundException e) {
        throw new RuntimeException(e);
      }
catch (      InstantiationException e) {
        throw new RuntimeException(e);
      }
catch (      IllegalAccessException e) {
        throw new RuntimeException(e);
      }
    }
  }
  return rc;
}

Fixed version (ground truth):
ResourceConfig getResourceConfig(JsonObject config){
  JsonArray resources=config.getArray(CONFIG_RESOURCES,null);
  if (resources == null || resources.size() == 0) {
    throw new RuntimeException("String_Node_Str" + CONFIG_RESOURCES);
  }
  String[] resourceArr=new String[resources.size()];
  for (int i=0; i < resources.size(); i++) {
    resourceArr[i]=String.valueOf(resources.get(i));
  }
  ResourceConfig rc=new ResourceConfig();
  rc.packages(resourceArr);
  rc.registerInstances(new VertxBinder());
  ClassLoader cl=Thread.currentThread().getContextClassLoader();
  JsonArray features=config.getArray(CONFIG_FEATURES,null);
  if (features != null && features.size() > 0) {
    for (int i=0; i < features.size(); i++) {
      try {
        Class<?> clazz=cl.loadClass(String.valueOf(features.get(i)));
        rc.register(clazz);
      }
 catch (      ClassNotFoundException e) {
        throw new RuntimeException(e);
      }
    }
  }
  JsonArray binders=config.getArray(CONFIG_BINDERS,null);
  if (binders != null && binders.size() > 0) {
    for (int i=0; i < binders.size(); i++) {
      try {
        Class<?> clazz=cl.loadClass(String.valueOf(binders.get(i)));
        rc.register(clazz.newInstance());
      }
 catch (      ClassNotFoundException e) {
        throw new RuntimeException(e);
      }
catch (      InstantiationException e) {
        throw new RuntimeException(e);
      }
catch (      IllegalAccessException e) {
        throw new RuntimeException(e);
      }
    }
  }
  return rc;
}
Program: 17353
Project: 17353
Buggy source:
public Map<String,Object> next(){
  if (!rowIt.hasNext() && wideRowCounterIt.hasNext()) {
    this.currentWideRowCounter=wideRowCounterIt.next();
    try {
      resetRowIt();
    }
 catch (    RhombusException re) {
      re.printStackTrace();
      return null;
    }
  }
  if (rowIt.hasNext()) {
    FakeIdRange.IdInRange lastIdInRange=rowIt.next();
    this.lastObjectId=lastIdInRange.getId();
    return makeObject(currentWideRowCounter,lastIdInRange);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
public Map<String,Object> next(){
  if (rowIt.hasNext()) {
    FakeIdRange.IdInRange lastIdInRange=rowIt.next();
    return makeObject(lastIdInRange.getCounterValue(),lastIdInRange);
  }
 else {
    return null;
  }
}
Program: 17354
Project: 17354
Buggy source:
public boolean hasNext(){
  return rowIt.hasNext() || wideRowCounterIt.hasNext();
}

Fixed version (ground truth):
public boolean hasNext(){
  return rowIt.hasNext();
}
Program: 17355
Project: 17355
Buggy source:
public IdInRange next(){
  try {
    Long counter=rangeIterator.next();
    Object ret=getIdAtCounter(counter,shardingStrategy);
    return new IdInRange(getIdAtCounter(counter,shardingStrategy),counter);
  }
 catch (  RhombusException re) {
    re.printStackTrace();
    return null;
  }
}

Fixed version (ground truth):
public IdInRange next(){
  try {
    Long counter=rangeIterator.next();
    return new IdInRange(getIdAtCounter(counter,shardingStrategy),counter);
  }
 catch (  RhombusException re) {
    re.printStackTrace();
    return null;
  }
}
Program: 17356
Project: 17356
Buggy source:
public FakeR(CKeyspaceDefinition keyspace,Long totalWideRowsPerIndex,Long totalObjectsPerWideRange,Long objectsPerShard) throws RhombusException {
  this.keyspace=keyspace;
  Map<String,CDefinition> definitions=keyspace.getDefinitions();
  this.fakeDefinitions=Lists.newArrayList();
  for (  String defKey : definitions.keySet()) {
    this.fakeDefinitions.add(new FakeCDefinition(definitions.get(defKey),totalWideRowsPerIndex,totalObjectsPerWideRange,objectsPerShard));
  }
}

Fixed version (ground truth):
/** 
 * @param keyspace
 * @param totalShardsPerIndex Ostensibly the number of wide rows to generate per index. Not currently used.
 * @param totalObjectsPerIndex The total number of objects in a wide range (each index has one wide range)
 * @param objectsPerShard The number of objects per shard/wide row in an index. Each index divides the objects in its wide range across its shards.
 * @throws RhombusException
 */
public FakeR(CKeyspaceDefinition keyspace,Long totalShardsPerIndex,Long totalObjectsPerIndex,Long objectsPerShard) throws RhombusException {
  this.keyspace=keyspace;
  Map<String,CDefinition> definitions=keyspace.getDefinitions();
  this.fakeDefinitions=Lists.newArrayList();
  for (  String defKey : definitions.keySet()) {
    this.fakeDefinitions.add(new FakeCDefinition(definitions.get(defKey),totalShardsPerIndex,totalObjectsPerIndex,objectsPerShard));
  }
}
Program: 17357
Project: 17357
Buggy source:
@Test public void getMasterIteratorTest() throws Exception {
  String json=TestHelpers.readFileToString(this.getClass(),"String_Node_Str");
  CDefinition def=CDefinition.fromJsonString(json);
  FakeCDefinition subject=new FakeCDefinition(def,100L,50L,10L);
  Iterator<Map<String,Object>> masterIt=subject.getMasterIterator(CObjectOrdering.DESCENDING);
  long counter=0;
  while (masterIt.hasNext()) {
    counter++;
    Map<String,Object> item=masterIt.next();
    System.out.println(item);
  }
  assertEquals(3L * 5000L,counter);
}

Fixed version (ground truth):
@Test public void getMasterIteratorTest() throws Exception {
  String json=TestHelpers.readFileToString(this.getClass(),"String_Node_Str");
  CDefinition def=CDefinition.fromJsonString(json);
  FakeCDefinition subject=new FakeCDefinition(def,100L,50L,10L);
  Iterator<Map<String,Object>> masterIt=subject.getMasterIterator(CObjectOrdering.DESCENDING);
  long counter=0;
  while (masterIt.hasNext()) {
    counter++;
    Map<String,Object> item=masterIt.next();
    System.out.println(item);
  }
  assertEquals(3L * 50L,counter);
}
Program: 17358
Project: 17358
Buggy source:
@Test public void getMasterIteratorTest() throws Exception {
  String json=TestHelpers.readFileToString(this.getClass(),"String_Node_Str");
  CDefinition def=CDefinition.fromJsonString(json);
  Long millistamp=System.currentTimeMillis();
  UUID startingUUID=UUIDs.startOf(millistamp);
  FakeCIndex subject=new FakeCIndex(def.getIndexes().get("String_Node_Str"),def,startingUUID,100L,50L,10L);
  Iterator<Map<String,Object>> masterIt=subject.getMasterIterator(CObjectOrdering.DESCENDING);
  Set<String> idSet=Sets.newHashSet();
  long counter=0;
  while (masterIt.hasNext()) {
    counter++;
    Map<String,Object> item=masterIt.next();
    assertFalse("String_Node_Str",idSet.contains(item.get("String_Node_Str").toString()));
    idSet.add(item.get("String_Node_Str").toString());
    System.out.println(item);
  }
  assertEquals(5000L,counter);
}

Fixed version (ground truth):
@Test public void getMasterIteratorTest() throws Exception {
  String json=TestHelpers.readFileToString(this.getClass(),"String_Node_Str");
  CDefinition def=CDefinition.fromJsonString(json);
  Long millistamp=System.currentTimeMillis();
  UUID startingUUID=UUIDs.startOf(millistamp);
  FakeCIndex subject=new FakeCIndex(def.getIndexes().get("String_Node_Str"),def,startingUUID,100L,50L,10L);
  Iterator<Map<String,Object>> masterIt=subject.getMasterIterator(CObjectOrdering.DESCENDING);
  Set<String> idSet=Sets.newHashSet();
  long counter=0;
  while (masterIt.hasNext()) {
    counter++;
    Map<String,Object> item=masterIt.next();
    assertFalse("String_Node_Str",idSet.contains(item.get("String_Node_Str").toString()));
    idSet.add(item.get("String_Node_Str").toString());
    System.out.println(item);
  }
  assertEquals(50L,counter);
}
Program: 17362
Project: 17362
Buggy source:
public void setLimit(int limit){
  this.limit=limit;
}

Fixed version (ground truth):
public void setLimit(long limit){
  this.limit=limit;
}
Program: 17363
Project: 17363
Buggy source:
@Override public void setLimit(int limit){
  this.numberRemaining=limit;
}

Fixed version (ground truth):
@Override public void setLimit(long limit){
  this.numberRemaining=limit;
}
Program: 17364
Project: 17364
Buggy source:
public int getPageSize(){
  return pageSize;
}

Fixed version (ground truth):
public long getPageSize(){
  return pageSize;
}
Program: 17365
Project: 17365
Buggy source:
private void fetchIfNeeded(){
  if (currentPage == 0) {
    statementIterator.setLimit(pageSize + 1);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    currentPage++;
  }
 else   if (hasMore && (nextItem == pageSize)) {
    Row row=page.get(nextItem);
    UUID uuid=row.getUUID("String_Node_Str");
    statementIterator.setNextUuid(uuid);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    nextItem=0;
    currentPage++;
  }
}

Fixed version (ground truth):
private void fetchIfNeeded(){
  if (currentPage == 0) {
    statementIterator.setLimit(pageSize + 1);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (statementIterator.size() > currentPage + 1 && page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    currentPage++;
  }
 else   if (hasMore && (nextItem == pageSize)) {
    Row row=page.get(nextItem);
    UUID uuid=row.getUUID("String_Node_Str");
    statementIterator.setNextUuid(uuid);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (statementIterator.size() > currentPage + 1 && page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    nextItem=0;
    currentPage++;
  }
}
Program: 17366
Project: 17366
Buggy source:
public void setPageSize(int pageSize){
  this.pageSize=pageSize;
}

Fixed version (ground truth):
public void setPageSize(long pageSize){
  this.pageSize=pageSize;
}
Program: 17367
Project: 17367
Buggy source:
@Override public void setLimit(int limit){
  this.numberRemaining=limit;
}

Fixed version (ground truth):
@Override public void setLimit(long limit){
  this.numberRemaining=limit;
}
Program: 17368
Project: 17368
Buggy source:
private List<Map<String,Object>> getNValues(int number,String index1Value,String index2Value){
  List<Map<String,Object>> values=new ArrayList<Map<String,Object>>();
  for (int i=0; i < number; i++) {
    Map<String,Object> value=Maps.newHashMap();
    value.put("String_Node_Str",index1Value);
    value.put("String_Node_Str",index2Value);
    value.put("String_Node_Str",String.valueOf(i));
    values.add(value);
  }
  return values;
}

Fixed version (ground truth):
private List<Map<String,Object>> getNValues(long number,String index1Value,String index2Value){
  List<Map<String,Object>> values=new ArrayList<Map<String,Object>>();
  for (int i=0; i < number; i++) {
    Map<String,Object> value=Maps.newHashMap();
    value.put("String_Node_Str",index1Value);
    value.put("String_Node_Str",index2Value);
    value.put("String_Node_Str",String.valueOf(i));
    values.add(value);
  }
  return values;
}
Program: 17369
Project: 17369
Buggy source:
public Row next(){
  fetchIfNeeded();
  Row ret=null;
  if (page.size() > nextItem) {
    ret=page.get(nextItem);
    nextItem++;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    if (page.size() > 0) {
      ret=page.get(nextItem);
    }
 else {
      ret=null;
    }
  }
  return ret;
}

Fixed version (ground truth):
public Row next(){
  fetchIfNeeded();
  Row ret=null;
  if (page.size() > nextItem) {
    ret=page.get(nextItem);
    nextItem++;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    if (page.size() > 0) {
      ret=page.get(nextItem);
    }
  }
  return ret;
}
Program: 17370
Project: 17370
Buggy source:
public CQLExecutorIterator(CQLExecutor cqlExecutor,BaseCQLStatementIterator statementIterator){
  this.cqlExecutor=cqlExecutor;
  this.statementIterator=statementIterator;
}

Fixed version (ground truth):
public CQLExecutorIterator(CQLExecutor cqlExecutor,CQLStatementIterator statementIterator){
  this.cqlExecutor=cqlExecutor;
  this.statementIterator=statementIterator;
}
Program: 17371
Project: 17371
Buggy source:
private void fetchIfNeeded(){
  if (currentPage == 0) {
    statementIterator.setLimit(pageSize + 1);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    currentPage++;
    logger.info("String_Node_Str",currentPage);
  }
 else   if (hasMore && (nextItem == pageSize)) {
    Row row=page.get(nextItem);
    UUID uuid=row.getUUID("String_Node_Str");
    statementIterator.setNextUuid(uuid);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    nextItem=0;
    currentPage++;
    logger.info("String_Node_Str",currentPage);
  }
}

Fixed version (ground truth):
private void fetchIfNeeded(){
  if (currentPage == 0 && statementIterator.hasNext()) {
    statementIterator.setLimit(pageSize + 1l);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    currentPage++;
  }
 else   if (hasMore && (nextItem == pageSize)) {
    Row row=page.get(nextItem);
    UUID uuid=row.getUUID("String_Node_Str");
    statementIterator.setNextUuid(uuid);
    CQLStatement cql=statementIterator.next();
    ResultSet resultSet=cqlExecutor.executeSync(cql);
    statementNumber++;
    populatePage(resultSet);
    if (page.size() > pageSize) {
      hasMore=true;
    }
 else {
      hasMore=false;
    }
    nextItem=0;
    currentPage++;
  }
}
Program: 17372
Project: 17372
Buggy source:
public boolean hasNext(){
  fetchIfNeeded();
  if (page.size() > nextItem) {
    return true;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean hasNext(){
  fetchIfNeeded();
  if (page != null && page.size() > nextItem) {
    return true;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    return true;
  }
 else {
    return false;
  }
}
Program: 17373
Project: 17373
Buggy source:
@Test public void testBigScan() throws Exception {
  String objectType="String_Node_Str";
  ConnectionManager cm=getConnectionManager();
  cm.setLogCql(true);
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  cm.buildKeyspace(definition,true);
  logger.debug("String_Node_Str",definition.getName());
  cm.setDefaultKeyspace(definition);
  ObjectMapper om=cm.getObjectMapper();
  om.setLogCql(true);
  long insertNum=2000l;
  long batchSize=200;
  insertNObjects(om,insertNum,batchSize);
  VisitorFactoryTester visitorFactory=new VisitorFactoryTester();
  TableScanner scanner=new TableScanner(om,objectType,1,visitorFactory);
  scanner.scan();
  long totalCount=0;
  for (  VisitorTester visitor : visitorFactory.getInstances()) {
    totalCount+=visitor.getObjectCount();
  }
  assertEquals(insertNum,totalCount);
  cm.teardown();
}

Fixed version (ground truth):
@Test public void testBigScan() throws Exception {
  String objectType="String_Node_Str";
  ConnectionManager cm=getConnectionManager();
  cm.setLogCql(true);
  CKeyspaceDefinition definition=JsonUtil.objectFromJsonResource(CKeyspaceDefinition.class,this.getClass().getClassLoader(),"String_Node_Str");
  cm.buildKeyspace(definition,true);
  cm.setDefaultKeyspace(definition);
  ObjectMapper om=cm.getObjectMapper();
  om.setLogCql(true);
  long insertNum=2000l;
  long batchSize=200;
  insertNObjects(om,insertNum,batchSize);
  VisitorFactoryTester visitorFactory=new VisitorFactoryTester();
  TableScanner scanner=new TableScanner(om,objectType,1,visitorFactory);
  scanner.scan();
  long totalCount=0;
  for (  VisitorTester visitor : visitorFactory.getInstances()) {
    totalCount+=visitor.getObjectCount();
  }
  assertEquals(insertNum,totalCount);
  cm.teardown();
}
Program: 17375
Project: 17375
Buggy source:
protected void processRow(IndexUpdateRow row){
  if (row.getIndexValues().size() == 0) {
    return;
  }
  if (row.getIndexValues().size() == 1) {
    Long consistencyHorizon=UUIDs.unixTimestamp(objectMapper.getTimeUUIDAtEndOfConsistencyHorizion());
    if (row.getTimeStampOfMostCurrentUpdate() > consistencyHorizon) {
      objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),row.getIds().get(0));
    }
    return;
  }
  Map<String,Object> mostRecentUpdate=row.getIndexValues().get(0);
  row.getIndexValues().remove(0);
  row.getIds().remove(0);
  List<CIndex> listOfIndexesToDelete=Lists.newArrayList();
  List<Map<String,Object>> listOfValuesToDelete=Lists.newArrayList();
  for (  Map<String,Object> update : row.getIndexValues()) {
    if (!areIndexValuesEqual(mostRecentUpdate,update)) {
      listOfValuesToDelete.add(update);
      listOfIndexesToDelete.addAll(getListOfEffectedIndexes(objectMapper.getKeyspaceDefinition().getDefinitions().get(row.getObjectName()),mostRecentUpdate,update));
    }
  }
  for (  CIndex index : listOfIndexesToDelete) {
    for (    Map<String,Object> values : listOfValuesToDelete) {
      objectMapper.deleteObsoleteIndex(row,index,values);
    }
  }
  for (  UUID todelete : row.getIds()) {
    objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),todelete);
  }
}

Fixed version (ground truth):
protected void processRow(IndexUpdateRow row){
  if (row.getIndexValues().size() == 0) {
    return;
  }
  if (row.getIndexValues().size() == 1) {
    Long consistencyHorizon=UUIDs.unixTimestamp(objectMapper.getTimeUUIDAtEndOfConsistencyHorizion());
    if (row.getTimeStampOfMostCurrentUpdate() > consistencyHorizon) {
      objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),row.getIds().get(0));
    }
    return;
  }
  Map<String,Object> mostRecentUpdate=row.getIndexValues().get(0);
  row.getIndexValues().remove(0);
  row.getIds().remove(0);
  List<CIndex> listOfIndexesToDelete=Lists.newArrayList();
  List<Map<String,Object>> listOfValuesToDelete=Lists.newArrayList();
  for (  Map<String,Object> update : row.getIndexValues()) {
    if (!areIndexValuesEqual(mostRecentUpdate,update)) {
      listOfValuesToDelete.add(update);
      listOfIndexesToDelete.addAll(getListOfEffectedIndexes(objectMapper.getKeyspaceDefinition().getDefinitions().get(row.getObjectName()),mostRecentUpdate,update));
    }
  }
  for (  CIndex index : listOfIndexesToDelete) {
    for (    Map<String,Object> values : listOfValuesToDelete) {
      if (!areAnyValuesNull(values)) {
        objectMapper.deleteObsoleteIndex(row,index,values);
      }
    }
  }
  for (  UUID todelete : row.getIds()) {
    objectMapper.deleteObsoleteUpdateIndexColumn(row.getRowKey(),todelete);
  }
}
Program: 17380
Project: 17380
Buggy source:
public Row next(){
  fetchIfNeeded();
  Row ret=null;
  if (page.size() > nextItem) {
    ret=page.get(nextItem);
    nextItem++;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    ret=page.get(nextItem);
  }
  return ret;
}

Fixed version (ground truth):
public Row next(){
  fetchIfNeeded();
  Row ret=null;
  if (page.size() > nextItem) {
    ret=page.get(nextItem);
    nextItem++;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    if (page.size() > 0) {
      ret=page.get(nextItem);
    }
 else {
      ret=null;
    }
  }
  return ret;
}
Program: 17381
Project: 17381
Buggy source:
public boolean hasNext(){
  fetchIfNeeded();
  if (page.size() == 0) {
    return false;
  }
 else   if (page.size() > nextItem) {
    return true;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean hasNext(){
  fetchIfNeeded();
  if (page.size() > nextItem) {
    return true;
  }
 else   if (statementIterator.hasNext()) {
    statementIterator.nextShard();
    currentPage=0;
    nextItem=0;
    fetchIfNeeded();
    return true;
  }
 else {
    return false;
  }
}
Program: 17382
Project: 17382
Buggy source:
public static Date getDateFromUUID(UUID uuid){
  Long time=(uuid.timestamp() - NUMBER_OF_100NS_INTERVALS_SINCE_UUID_EPOCH) / 10000;
  return new Date(time);
}

Fixed version (ground truth):
public static DateTime getDateFromUUID(UUID uuid){
  return new DateTime(convertUUIDToJavaMillis(uuid),DateTimeZone.UTC);
}
Program: 17383
Project: 17383
Buggy source:
public FakeIdRange(CField.CDataType idType,Object startAfterId,Long totalObjects,Long objectsPerShard,TimebasedShardingStrategy shardingStrategy){
  this.shardingStrategy=shardingStrategy;
  this.startingShardNumber=shardingStrategy.getShardKey(startAfterId) + 1;
  this.objectsPerShard=objectsPerShard;
  this.spacing=getSpacingForShardingStrategy(objectsPerShard);
  this.idType=idType;
  this.counterRange=Range.closed(1L,totalObjects);
}

Fixed version (ground truth):
public FakeIdRange(CField.CDataType idType,Object startAfterId,Long totalObjects,Long objectsPerShard,TimebasedShardingStrategy shardingStrategy){
  this.shardingStrategy=shardingStrategy;
  this.startingShardNumber=shardingStrategy.getShardKey(startAfterId);
  this.objectsPerShard=objectsPerShard;
  this.spacing=getSpacingForShardingStrategy(objectsPerShard);
  this.idType=idType;
  this.counterRange=Range.closed(1L,totalObjects);
}