nus-yam/ex-repair huggingface dataset:
Program: 44175
Project: 44175
Buggy source:
public ReadLog(String filename,double burnIn){
  time=-System.currentTimeMillis();
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
  time+=System.currentTimeMillis();
}

Fixed version (ground truth):
public ReadLog(String filename,double burnIn){
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  System.out.println(nrow * burnIn);
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
}
Program: 44176
Project: 44176
Buggy source:
public ReadLog(String filename,double burnIn){
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  System.out.println(nrow * burnIn);
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
}

Fixed version (ground truth):
public ReadLog(String filename,double burnIn){
  String[] lines=LoadStrings(filename);
  int commentedLines=0;
  for (int row=0; row < lines.length; row++) {
    if (lines[row].startsWith("String_Node_Str")) {
      commentedLines++;
    }
  }
  nrow=lines.length - commentedLines - 1;
  String[] colNames=lines[commentedLines].split("String_Node_Str");
  List<Integer> list=new ArrayList<Integer>();
  Pattern pattern=Pattern.compile("String_Node_Str");
  for (int row=0; row < colNames.length; row++) {
    Matcher matcher=pattern.matcher(colNames[row]);
    if (matcher.find()) {
      list.add(row);
    }
  }
  ncol=list.size();
  int delete=(int)(nrow * burnIn) + 1;
  indicators=new double[nrow - delete][ncol];
  int i=0;
  for (int row=delete; row < nrow; row++) {
    String[] line=lines[row].split("String_Node_Str");
    indicators[i]=Utils.parseDouble(Utils.Subset(line,list.get(0),ncol));
    i++;
  }
  indicators=(double[][])indicators;
  nrow=indicators.length;
}
Program: 44177
Project: 44177
Buggy source:
@Override public void setUp() throws Exception {
  this.db=new MockDatabase();
  ActiveRecordBase.bootStrap(this.db,getApplicationContext());
  exampleRecord=new ExampleRecord();
  subRecord=new SubRecord();
  subRecord.record=exampleRecord;
  subRecord.id=(long)123;
  exampleRecord.id=(long)321;
  exampleRecord.subrecord=subRecord;
  blog=new Blog();
  blog.id=(long)2;
  post1=new Post();
  post2=new Post();
  post1.id=(long)1;
  post1.blog=blog;
  post2.id=(long)3;
  post2.blog=blog;
  blog.posts.addAll(post1,post2);
}

Fixed version (ground truth):
@Override public void setUp() throws Exception {
  this.db=new MockDatabase();
  ActiveRecordBase.bootStrap(this.db,null);
  exampleRecord=new ExampleRecord();
  subRecord=new SubRecord();
  subRecord.record=exampleRecord;
  subRecord.id=(long)123;
  exampleRecord.id=(long)321;
  exampleRecord.subrecord=subRecord;
  blog=new Blog();
  blog.id=(long)2;
  post1=new Post();
  post2=new Post();
  post1.id=(long)1;
  post1.blog=blog;
  post2.id=(long)3;
  post2.blog=blog;
  blog.posts.addAll(post1,post2);
}
Program: 44180
Project: 44180
Buggy source:
/** 
 * The same as   {@link #byLocation(float,float,int)} but instead of using coordinates a foursquare location IDis provided
 * @param fourSquareLocation a valid foursquare location ID e.g.  5XfVJe
 * @return this
 */
public Instagram byFoursquareLocation(String fourSquareLocation){
  addResource(Type.LOCATION,null,-1,-1,-1,false,fourSquareLocation);
  return this;
}

Fixed version (ground truth):
/** 
 * The same as   {@link #byLocation(float,float,int)} but instead of using coordinates a foursquare location IDis provided
 * @param fourSquareLocation a valid foursquare location ID e.g.  5XfVJe
 * @return this
 */
public Instagram byFoursquareLocation(String fourSquareLocation) throws Exception {
  throw new Exception("String_Node_Str");
}
Program: 44182
Project: 44182
Buggy source:
/** 
 * The same as   {@link #byLocation(float,float,int)} but instead of using coordinates a foursquare location IDis provided
 * @param fourSquareLocation a valid foursquare location ID e.g.  5XfVJe
 * @deprecated Instagram has deprecated foursquare support since 20th April 2016
 * @return this
 */
public Instagram byFoursquareLocation(String fourSquareLocation) throws Exception {
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * The same as   {@link #byLocation(float,float,int)} but instead of using coordinates a foursquare location IDis provided
 * @param fourSquareLocation a valid foursquare location ID e.g.  5XfVJe
 * @return this
 * @deprecated Instagram has deprecated foursquare support since 20th April 2016
 */
public Instagram byFoursquareLocation(String fourSquareLocation) throws Exception {
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 44183
Project: 44183
Buggy source:
/** 
 * Retrieve VEDO tags for a given recording. For information on this endpoint see documentation page: http://dev.datasift.com/pylon/docs/api/pylon-api-endpoints/pylontags
 * @param recordingId A recording id. See {@link com.datasift.client.pylon.PylonRecording.PylonRecordingId}
 * @return vedo tags for the given filter
 */
public FutureData<PylonTags> tags(PylonRecordingId recordingId){
  URI uri=newParams().put("String_Node_Str",recordingId).forURL(config.newAPIEndpointURI(TAGS));
  FutureData<PylonTags> future=new FutureData<>();
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new PylonTags(),config)));
  performRequest(future,request);
  return future;
}

Fixed version (ground truth):
/** 
 * Retrieve VEDO tags for a given recording. For information on this endpoint see documentation page: http://dev.datasift.com/pylon/docs/api/pylon-api-endpoints/pylontags
 * @param recordingId A recording id. See {@link com.datasift.client.pylon.PylonRecording.PylonRecordingId}
 * @return vedo tags for the given filter
 */
public FutureData<PylonTags> tags(PylonRecordingId recordingId){
  URI uri=newParams().put("String_Node_Str",recordingId.id).forURL(config.newAPIEndpointURI(TAGS));
  FutureData<PylonTags> future=new FutureData<>();
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new PylonTags(),config)));
  performRequest(future,request);
  return future;
}
Program: 44184
Project: 44184
Buggy source:
public PylonQuery(String hash,PylonQueryParameters parameters){
  new PylonQuery(hash,parameters,null,null,null);
}

Fixed version (ground truth):
public PylonQuery(String hash,PylonQueryParameters parameters){
  this(hash,parameters,null,null,null);
}
Program: 44185
Project: 44185
Buggy source:
public PylonSampleRequest(String hash){
  new PylonSampleRequest(hash,null,null,null,null);
}

Fixed version (ground truth):
public PylonSampleRequest(String hash){
  this(hash,null,null,null,null);
}
Program: 44186
Project: 44186
Buggy source:
/** 
 * Update an existing identity with values
 * @param id     target to update
 * @param label  new label (may be null otherwise)
 * @param active new activity (may be null otherwise)
 * @param master new master (may be null otherwise)
 * @return the new updated Identity
 */
public FutureData<Identity> update(String id,String label,boolean active,boolean master){
  String activeStr=active ? "String_Node_Str" : "String_Node_Str";
  FutureData<Identity> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(IDENTITY + "String_Node_Str" + id));
  try {
    Request request=config.http().putJSON(uri,new PageReader(newRequestCallback(future,new Identity(),config))).setData(new NewIdentity(label,activeStr,master));
    performRequest(future,request);
  }
 catch (  JsonProcessingException e) {
    e.printStackTrace();
  }
  return future;
}

Fixed version (ground truth):
/** 
 * Update an existing identity with values
 * @param id     target to update
 * @param label  new label (may be null otherwise)
 * @param active new activity (may be null otherwise)
 * @param master new master (may be null otherwise)
 * @return the new updated Identity
 */
public FutureData<Identity> update(String id,String label,Boolean active,Boolean master){
  String activeStr=null;
  if (active != null) {
    activeStr=active ? "String_Node_Str" : "String_Node_Str";
  }
  FutureData<Identity> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(IDENTITY + "String_Node_Str" + id));
  try {
    Request request=config.http().putJSON(uri,new PageReader(newRequestCallback(future,new Identity(),config))).setData(new NewIdentity(label,activeStr,master));
    performRequest(future,request);
  }
 catch (  JsonProcessingException e) {
    e.printStackTrace();
  }
  return future;
}
Program: 44187
Project: 44187
Buggy source:
/** 
 * Update a token
 * @param identity identity to update a token inside
 * @param service service to update the token for
 * @param allowance new limit value
 * @return the updated Token
 */
public FutureData<Token> updateLimit(String identity,String service,Long allowance){
  if (identity == null || identity.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (service == null || service.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (allowance < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<Token> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(IDENTITY + "String_Node_Str" + identity+ "String_Node_Str"+ service));
  try {
    Request request=config.http().putJSON(uri,new PageReader(newRequestCallback(future,new Token(),config))).setData(new NewLimitValue(allowance));
    performRequest(future,request);
  }
 catch (  JsonProcessingException e) {
    e.printStackTrace();
  }
  return future;
}

Fixed version (ground truth):
/** 
 * Update a token
 * @param identity identity to update a token inside
 * @param service service to update the token for
 * @param allowance new limit value
 * @return the updated Token
 */
public FutureData<Limit> updateLimit(String identity,String service,Long allowance){
  if (identity == null || identity.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (service == null || service.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (allowance < 0) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<Limit> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(IDENTITY + "String_Node_Str" + identity+ "String_Node_Str"+ service));
  try {
    Request request=config.http().putJSON(uri,new PageReader(newRequestCallback(future,new Limit(),config))).setData(new NewLimitValue(allowance));
    performRequest(future,request);
  }
 catch (  JsonProcessingException e) {
    e.printStackTrace();
  }
  return future;
}
Program: 44188
Project: 44188
Buggy source:
/** 
 * Fetch a token using it's ID and it's Identity's ID
 * @param identity the ID of the identity to query
 * @param tokenid  the ID of the token to fetch
 * @return the identity for the ID provided
 */
public FutureData<Token> getToken(String identity,String tokenid){
  FutureData<Token> future=new FutureData<>();
  URI uri=newParams().put("String_Node_Str",identity).forURL(config.newAPIEndpointURI(IDENTITY + "String_Node_Str" + identity+ "String_Node_Str"+ tokenid));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new Token(),config)));
  performRequest(future,request);
  return future;
}

Fixed version (ground truth):
/** 
 * Fetch a token using it's service ID and it's Identity's ID
 * @param identity the ID of the identity to query
 * @param service  the service of the token to fetch
 * @return the identity for the ID provided
 */
public FutureData<Token> getToken(String identity,String service){
  FutureData<Token> future=new FutureData<>();
  URI uri=newParams().put("String_Node_Str",identity).forURL(config.newAPIEndpointURI(IDENTITY + "String_Node_Str" + identity+ "String_Node_Str"+ service));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new Token(),config)));
  performRequest(future,request);
  return future;
}
Program: 44189
Project: 44189
Buggy source:
public IdentityStatus status(){
  return status;
}

Fixed version (ground truth):
public String status(){
  return status;
}
Program: 44191
Project: 44191
Buggy source:
public void put(String currentSwitch,String name,String value){
  if (currentSwitch.indexOf("String_Node_Str") == 0) {
    currentSwitch=currentSwitch.substring(2);
  }
  if (currentSwitch.indexOf("String_Node_Str") == 0) {
    currentSwitch=currentSwitch.substring(1);
  }
  Object val=res.get(currentSwitch);
  String shortForm=shortForm(currentSwitch);
  if (val == null && shortForm != null) {
    if (value != null) {
      val=new HashMap<>();
    }
    res.put(shortForm,val);
  }
  if (value == null) {
    res.put(currentSwitch,name);
  }
 else {
    if (val != null) {
      ((HashMap<String,String>)val).put(name,value);
    }
  }
}

Fixed version (ground truth):
public void put(String currentSwitch,String name,String value){
  if (currentSwitch.indexOf("String_Node_Str") == 0) {
    currentSwitch=currentSwitch.substring(2);
  }
  if (currentSwitch.indexOf("String_Node_Str") == 0) {
    currentSwitch=currentSwitch.substring(1);
  }
  Object val=res.get(currentSwitch);
  String shortForm=shortForm(currentSwitch);
  if (val == null && shortForm != null) {
    if (value != null) {
      val=new HashMap<>();
    }
    res.put(shortForm,val);
  }
  if (value == null) {
    if (val instanceof Map) {
      ((HashMap<String,String>)val).put(name,value);
    }
 else {
      res.put(currentSwitch,name);
    }
  }
 else {
    if (val != null) {
      ((HashMap<String,String>)val).put(name,value);
    }
  }
}
Program: 44192
Project: 44192
Buggy source:
protected <T extends DataSiftResult>Function2<String,io.higgs.http.client.Response> newRequestCallback(final FutureData<T> future,final T instance,final DataSiftConfig config){
  return new Function2<String,io.higgs.http.client.Response>(){
    public void apply(    String s,    io.higgs.http.client.Response response){
      T result=instance;
      if (response.getStatus() != null && HttpResponseStatus.NO_CONTENT.equals(response.getStatus())) {
        result.successful();
      }
 else       if (response.hasFailed()) {
        result.failed(response.failureCause());
        if (config.isAllowedToRaiseExceptions()) {
          throw new DataSiftException("String_Node_Str",response.failureCause(),response);
        }
      }
 else {
        try {
          result=(T)DataSiftClient.MAPPER.readValue(s,instance.getClass());
        }
 catch (        IOException e) {
          result.failed(e);
          if (config.isAllowedToRaiseExceptions()) {
            throw new JsonParsingException("String_Node_Str",e,response);
          }
        }
      }
      result.setResponse(new com.datasift.client.Response(s,response));
      if (config.isAllowedToRaiseExceptions() && response.getStatus().code() == 401) {
        throw new AuthException("String_Node_Str",response);
      }
      if (config.isAllowedToRaiseExceptions() && !result.isSuccessful()) {
        throw new DataSiftException(result.getError(),result.failureCause());
      }
      future.received(result);
    }
  }
;
}

Fixed version (ground truth):
protected <T extends DataSiftResult>Function2<String,io.higgs.http.client.Response> newRequestCallback(final FutureData<T> future,final T instance,final DataSiftConfig config){
  return new Function2<String,io.higgs.http.client.Response>(){
    public void apply(    String s,    io.higgs.http.client.Response response){
      T result=instance;
      if (response.getStatus() != null && HttpResponseStatus.NO_CONTENT.equals(response.getStatus())) {
        result.successful();
      }
 else       if (response.hasFailed()) {
        result.failed(response.failureCause());
        throw new DataSiftException("String_Node_Str",response.failureCause(),response);
      }
 else {
        try {
          result=(T)DataSiftClient.MAPPER.readValue(s,instance.getClass());
        }
 catch (        IOException e) {
          result.failed(e);
          throw new JsonParsingException("String_Node_Str",e,response);
        }
      }
      result.setResponse(new com.datasift.client.Response(s,response));
      if (response.getStatus().code() == 401) {
        throw new AuthException("String_Node_Str",response);
      }
      if (!result.isSuccessful()) {
        throw new DataSiftException(result.getError(),result.failureCause());
      }
      future.received(result);
    }
  }
;
}
Program: 44193
Project: 44193
Buggy source:
/** 
 * @param config a configuration which should be used for making API requests
 */
public DataSiftClient(DataSiftConfig config){
  super(config);
  configureMapper();
  this.config=config;
  this.historics=new DataSiftHistorics(config);
  this.source=new DataSiftManagedSource(config);
  this.preview=new DataSiftPreview(config);
  this.push=new DataSiftPush(config);
  this.liveStream=new StreamingData(config);
}

Fixed version (ground truth):
/** 
 * @param config a configuration which should be used for making API requests
 */
public DataSiftClient(DataSiftConfig config){
  super(config);
  configureMapper();
  this.config=config;
  this.historics=new DataSiftHistorics(config);
  this.source=new DataSiftManagedSource(config);
  this.preview=new DataSiftPreview(config);
  this.push=new DataSiftPush(config);
  this.liveStream=new StreamingData(config);
  DependencyProvider.global().add(config);
}
Program: 44194
Project: 44194
Buggy source:
public void apply(Stream stream){
  URI uri=newParams().put("String_Node_Str",stream.hash()).forURL(config.newAPIEndpointURI(DPU));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,dpu,config)));
  applyConfig(request).execute();
}

Fixed version (ground truth):
public void apply(Stream stream){
  URI uri=newParams().put("String_Node_Str",stream.hash()).forURL(config.newAPIEndpointURI(DPU));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,dpu,config)));
  performRequest(future,request);
}
Program: 44195
Project: 44195
Buggy source:
/** 
 * @param timePeriod A time period during which the usage information should be broken down
 * @return a break down over the time period specified
 */
public FutureData<Usage> usage(Usage.Period timePeriod){
  FutureData<Usage> future=new FutureData<Usage>();
  String period;
switch (timePeriod) {
case HOUR:
    period="String_Node_Str";
  break;
case CURRENT:
period="String_Node_Str";
break;
case DAY:
default :
period="String_Node_Str";
}
URI uri=newParams().put("String_Node_Str",period).forURL(config.newAPIEndpointURI(USAGE));
Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new Usage(),config)));
applyConfig(request).execute();
return future;
}

Fixed version (ground truth):
/** 
 * @param timePeriod A time period during which the usage information should be broken down
 * @return a break down over the time period specified
 */
public FutureData<Usage> usage(Usage.Period timePeriod){
  FutureData<Usage> future=new FutureData<Usage>();
  String period;
switch (timePeriod) {
case HOUR:
    period="String_Node_Str";
  break;
case CURRENT:
period="String_Node_Str";
break;
case DAY:
default :
period="String_Node_Str";
}
URI uri=newParams().put("String_Node_Str",period).forURL(config.newAPIEndpointURI(USAGE));
Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new Usage(),config)));
performRequest(future,request);
return future;
}
Program: 44196
Project: 44196
Buggy source:
public FutureData<Dpu> dpu(FutureData<Stream> streamFuture){
  final FutureData<Dpu> future=new FutureData<Dpu>();
  final Dpu dpu=new Dpu();
  final FutureResponse<Stream> response=new FutureResponse<Stream>(){
    public void apply(    Stream stream){
      URI uri=newParams().put("String_Node_Str",stream.hash()).forURL(config.newAPIEndpointURI(DPU));
      Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,dpu,config)));
      applyConfig(request).execute();
    }
  }
;
  unwrapFuture(streamFuture,future,dpu,response);
  return future;
}

Fixed version (ground truth):
public FutureData<Dpu> dpu(FutureData<Stream> streamFuture){
  final FutureData<Dpu> future=new FutureData<Dpu>();
  final Dpu dpu=new Dpu();
  final FutureResponse<Stream> response=new FutureResponse<Stream>(){
    public void apply(    Stream stream){
      URI uri=newParams().put("String_Node_Str",stream.hash()).forURL(config.newAPIEndpointURI(DPU));
      Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,dpu,config)));
      performRequest(future,request);
    }
  }
;
  unwrapFuture(streamFuture,future,dpu,response);
  return future;
}
Program: 44197
Project: 44197
Buggy source:
/** 
 * Compile a CSDL string to a stream hash to which you can later subscribe and receive interactions from
 * @param csdl the CSDL to compile
 * @return a stream object representing the DataSift compiled CSDL, use {@link com.datasift.client.core.Stream#hash()}to list the hash for the compiled CSDL
 */
public FutureData<Stream> compile(String csdl){
  FutureData<Stream> future=new FutureData<Stream>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(COMPILE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new Stream(),config))).form("String_Node_Str",csdl);
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Compile a CSDL string to a stream hash to which you can later subscribe and receive interactions from
 * @param csdl the CSDL to compile
 * @return a stream object representing the DataSift compiled CSDL, use {@link com.datasift.client.core.Stream#hash()}to list the hash for the compiled CSDL
 */
public FutureData<Stream> compile(String csdl){
  FutureData<Stream> future=new FutureData<Stream>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(COMPILE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new Stream(),config))).form("String_Node_Str",csdl);
  performRequest(future,request);
  return future;
}
Program: 44198
Project: 44198
Buggy source:
/** 
 * @return The balance on the account being used to make API calls
 */
public FutureData<Balance> balance(){
  FutureData<Balance> future=new FutureData<Balance>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(BALANCE));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new Balance(),config)));
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * @return The balance on the account being used to make API calls
 */
public FutureData<Balance> balance(){
  FutureData<Balance> future=new FutureData<Balance>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(BALANCE));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new Balance(),config)));
  performRequest(future,request);
  return future;
}
Program: 44199
Project: 44199
Buggy source:
/** 
 * Validate the given CSDL string against the DataSift API
 * @param csdl the CSDL to validate
 * @return the results of the validation, use {@link com.datasift.client.core.Validation#isSuccessful()} to check ifvalidation was successful or not
 */
public FutureData<Validation> validate(String csdl){
  FutureData<Validation> future=new FutureData<Validation>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(VALIDATE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new Validation(),config))).form("String_Node_Str",csdl);
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Validate the given CSDL string against the DataSift API
 * @param csdl the CSDL to validate
 * @return the results of the validation, use {@link com.datasift.client.core.Validation#isSuccessful()} to check ifvalidation was successful or not
 */
public FutureData<Validation> validate(String csdl){
  FutureData<Validation> future=new FutureData<Validation>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(VALIDATE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new Validation(),config))).form("String_Node_Str",csdl);
  performRequest(future,request);
  return future;
}
Program: 44200
Project: 44200
Buggy source:
/** 
 * Forces the client to wait until a response is received before returning
 * @return a result instance - if an interrupt exception is thrown it is possible that a response isn't availableyet the user must check to ensure null isn't returned
 */
public T sync(){
  if (data != null) {
    return data;
  }
synchronized (this) {
    try {
      wait();
    }
 catch (    InterruptedException e) {
      return data;
    }
  }
  return data;
}

Fixed version (ground truth):
/** 
 * Forces the client to wait until a response is received before returning
 * @return a result instance - if an interrupt exception is thrown it is possible that a response isn't availableyet the user must check to ensure null isn't returned
 */
public T sync(){
  if (data != null) {
    return data;
  }
synchronized (this) {
    try {
      wait();
    }
 catch (    InterruptedException e) {
      if (interruptCause != null) {
        if (interruptCause instanceof DataSiftException) {
          throw (DataSiftException)interruptCause;
        }
 else {
          throw new DataSiftException("String_Node_Str",interruptCause);
        }
      }
      return data;
    }
  }
  return data;
}
Program: 44201
Project: 44201
Buggy source:
public FutureData<PreparedHistoricsQuery> prepare(String hash,long start,long end,String name,int sample,String... sources){
  FutureData<PreparedHistoricsQuery> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(PREPARE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new PreparedHistoricsQuery(),config))).form("String_Node_Str",hash).form("String_Node_Str",start).form("String_Node_Str",end).form("String_Node_Str",name);
  if (sample > 0) {
    request.form("String_Node_Str",sample);
  }
  if (sources == null || sources.length == 0) {
    sources=new String[]{"String_Node_Str"};
  }
  StringBuilder b=new StringBuilder();
  for (  String source : sources) {
    b.append(source).append("String_Node_Str");
  }
  request.form("String_Node_Str",b.toString().substring(0,b.length() - 1));
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
public FutureData<PreparedHistoricsQuery> prepare(String hash,long start,long end,String name,int sample,String... sources){
  FutureData<PreparedHistoricsQuery> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(PREPARE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new PreparedHistoricsQuery(),config))).form("String_Node_Str",hash).form("String_Node_Str",start).form("String_Node_Str",end).form("String_Node_Str",name);
  if (sample > 0) {
    request.form("String_Node_Str",sample);
  }
  if (sources == null || sources.length == 0) {
    sources=new String[]{"String_Node_Str"};
  }
  StringBuilder b=new StringBuilder();
  for (  String source : sources) {
    b.append(source).append("String_Node_Str");
  }
  request.form("String_Node_Str",b.toString().substring(0,b.length() - 1));
  performRequest(future,request);
  return future;
}
Program: 44202
Project: 44202
Buggy source:
/** 
 * Stop a given historics query
 * @param id     the historics ID
 * @param reason an optional ID
 * @return the results of calling the stop API
 */
public FutureData<DataSiftResult> stop(String id,String reason){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(STOP));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id);
  if (reason != null) {
    request.form("String_Node_Str",reason);
  }
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Stop a given historics query
 * @param id     the historics ID
 * @param reason an optional ID
 * @return the results of calling the stop API
 */
public FutureData<DataSiftResult> stop(String id,String reason){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(STOP));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id);
  if (reason != null) {
    request.form("String_Node_Str",reason);
  }
  performRequest(future,request);
  return future;
}
Program: 44203
Project: 44203
Buggy source:
/** 
 * Get detailed information about a historics query
 * @param id           the id of the historics to list
 * @param withEstimate if true then an estimated completion time is include in the response
 * @return a historics query
 */
public FutureData<HistoricsQuery> get(String id,boolean withEstimate){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<HistoricsQuery> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(GET));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new HistoricsQuery(),config))).form("String_Node_Str",id).form("String_Node_Str",withEstimate ? 1 : 0);
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Get detailed information about a historics query
 * @param id           the id of the historics to list
 * @param withEstimate if true then an estimated completion time is include in the response
 * @return a historics query
 */
public FutureData<HistoricsQuery> get(String id,boolean withEstimate){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<HistoricsQuery> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(GET));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new HistoricsQuery(),config))).form("String_Node_Str",id).form("String_Node_Str",withEstimate ? 1 : 0);
  performRequest(future,request);
  return future;
}
Program: 44204
Project: 44204
Buggy source:
protected FutureData<DataSiftResult> start(String id,FutureData<DataSiftResult> f){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=f != null ? f : new FutureData<DataSiftResult>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(START));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id);
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
protected FutureData<DataSiftResult> start(String id,FutureData<DataSiftResult> f){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=f != null ? f : new FutureData<DataSiftResult>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(START));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id);
  performRequest(future,request);
  return future;
}
Program: 44205
Project: 44205
Buggy source:
/** 
 * Update the name of a historics query
 * @param id   the ID of the historics to update
 * @param name the new name for the historics
 * @return a result that can be used to check the success or failure of the request
 */
public FutureData<DataSiftResult> update(String id,String name){
  if (id == null || name == null || id.isEmpty() || name.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(UPDATE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id).form("String_Node_Str",name);
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Update the name of a historics query
 * @param id   the ID of the historics to update
 * @param name the new name for the historics
 * @return a result that can be used to check the success or failure of the request
 */
public FutureData<DataSiftResult> update(String id,String name){
  if (id == null || name == null || id.isEmpty() || name.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(UPDATE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id).form("String_Node_Str",name);
  performRequest(future,request);
  return future;
}
Program: 44206
Project: 44206
Buggy source:
/** 
 * Retrieve a list of   {@link HistoricsQuery} objects
 * @param max          max number of objects to list
 * @param page         a page number
 * @param withEstimate if true, include an estimated completion time
 * @return an iterable list of {@link HistoricsQuery}s
 */
public FutureData<HistoricsQueryList> list(int max,int page,boolean withEstimate){
  FutureData<HistoricsQueryList> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(GET));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new HistoricsQueryList(),config))).form("String_Node_Str",withEstimate ? 1 : 0);
  if (max > 0) {
    request.form("String_Node_Str",max);
  }
  if (page > 0) {
    request.form("String_Node_Str",page);
  }
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Retrieve a list of   {@link HistoricsQuery} objects
 * @param max          max number of objects to list
 * @param page         a page number
 * @param withEstimate if true, include an estimated completion time
 * @return an iterable list of {@link HistoricsQuery}s
 */
public FutureData<HistoricsQueryList> list(int max,int page,boolean withEstimate){
  FutureData<HistoricsQueryList> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(GET));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new HistoricsQueryList(),config))).form("String_Node_Str",withEstimate ? 1 : 0);
  if (max > 0) {
    request.form("String_Node_Str",max);
  }
  if (page > 0) {
    request.form("String_Node_Str",page);
  }
  performRequest(future,request);
  return future;
}
Program: 44207
Project: 44207
Buggy source:
/** 
 * Delete the historic with the given ID
 * @param id an historic ID
 * @return a result indicating whether the request was successful or not
 */
public FutureData<DataSiftResult> delete(String id){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(DELETE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id);
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Delete the historic with the given ID
 * @param id an historic ID
 * @return a result indicating whether the request was successful or not
 */
public FutureData<DataSiftResult> delete(String id){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<DataSiftResult> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(DELETE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new BaseDataSiftResult(),config))).form("String_Node_Str",id);
  performRequest(future,request);
  return future;
}
Program: 44208
Project: 44208
Buggy source:
/** 
 * Check the status of data availability in our archive for the given time period
 * @param start   the dat from which the archive should be checked
 * @param end     the up to which the archive should be checked
 * @param sources an optional list of data sources that should be queried, e.g. [facebook,twitter,...]
 * @return a report of the current status/availability of data for the given time period
 */
public FutureData<HistoricsStatus> status(DateTime start,DateTime end,String... sources){
  FutureData<HistoricsStatus> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(STATUS));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new HistoricsStatus(),config))).form("String_Node_Str",MILLISECONDS.toSeconds(start.getMillis())).form("String_Node_Str",MILLISECONDS.toSeconds(end.getMillis()));
  if (sources != null && sources.length > 0) {
    StringBuilder b=new StringBuilder();
    for (    String source : sources) {
      b.append(source).append("String_Node_Str");
    }
    request.form("String_Node_Str",b.toString().substring(0,b.length() - 1));
  }
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * Check the status of data availability in our archive for the given time period
 * @param start   the dat from which the archive should be checked
 * @param end     the up to which the archive should be checked
 * @param sources an optional list of data sources that should be queried, e.g. [facebook,twitter,...]
 * @return a report of the current status/availability of data for the given time period
 */
public FutureData<HistoricsStatus> status(DateTime start,DateTime end,String... sources){
  FutureData<HistoricsStatus> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(STATUS));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new HistoricsStatus(),config))).form("String_Node_Str",MILLISECONDS.toSeconds(start.getMillis())).form("String_Node_Str",MILLISECONDS.toSeconds(end.getMillis()));
  if (sources != null && sources.length > 0) {
    StringBuilder b=new StringBuilder();
    for (    String source : sources) {
      b.append(source).append("String_Node_Str");
    }
    request.form("String_Node_Str",b.toString().substring(0,b.length() - 1));
  }
  performRequest(future,request);
  return future;
}
Program: 44209
Project: 44209
Buggy source:
/** 
 * @param id the ID of the managed source to stop
 * @return this
 */
public FutureData<ManagedSource> stop(String id){
  if (id == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<ManagedSource> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(STOP));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new ManagedSource(),config))).form("String_Node_Str",id);
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * @param id the ID of the managed source to stop
 * @return this
 */
public FutureData<ManagedSource> stop(String id){
  if (id == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<ManagedSource> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(STOP));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new ManagedSource(),config))).form("String_Node_Str",id);
  performRequest(future,request);
  return future;
}
Program: 44210
Project: 44210
Buggy source:
public void apply(ManagedSource data){
  URI uri=newParams().forURL(config.newAPIEndpointURI(START));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,data,config))).form("String_Node_Str",data.getId());
  applyConfig(request).execute();
}

Fixed version (ground truth):
public void apply(ManagedSource data){
  URI uri=newParams().forURL(config.newAPIEndpointURI(START));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,data,config))).form("String_Node_Str",data.getId());
  performRequest(future,request);
}
Program: 44211
Project: 44211
Buggy source:
public FutureData<ManagedSourceLog> log(String id,int page,int perPage){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<ManagedSourceLog> future=new FutureData<>();
  ParamBuilder b=newParams();
  if (page > 0) {
    b.put("String_Node_Str",page);
  }
  if (perPage > 0) {
    b.put("String_Node_Str",perPage);
  }
  URI uri=b.forURL(config.newAPIEndpointURI(LOG));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new ManagedSourceLog(),config)));
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
public FutureData<ManagedSourceLog> log(String id,int page,int perPage){
  if (id == null || id.isEmpty()) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<ManagedSourceLog> future=new FutureData<>();
  ParamBuilder b=newParams();
  if (page > 0) {
    b.put("String_Node_Str",page);
  }
  if (perPage > 0) {
    b.put("String_Node_Str",perPage);
  }
  URI uri=b.forURL(config.newAPIEndpointURI(LOG));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new ManagedSourceLog(),config)));
  performRequest(future,request);
  return future;
}
Program: 44212
Project: 44212
Buggy source:
/** 
 * @param id the ID of the managed source to fetch
 * @return the managed source for the ID provided
 */
public FutureData<ManagedSource> get(String id){
  FutureData<ManagedSource> future=new FutureData<>();
  URI uri=newParams().put("String_Node_Str",id).forURL(config.newAPIEndpointURI(GET));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new ManagedSource(),config)));
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
/** 
 * @param id the ID of the managed source to fetch
 * @return the managed source for the ID provided
 */
public FutureData<ManagedSource> get(String id){
  FutureData<ManagedSource> future=new FutureData<>();
  URI uri=newParams().put("String_Node_Str",id).forURL(config.newAPIEndpointURI(GET));
  Request request=config.http().GET(uri,new PageReader(newRequestCallback(future,new ManagedSource(),config)));
  performRequest(future,request);
  return future;
}
Program: 44213
Project: 44213
Buggy source:
/** 
 * @param source start a configured managed source
 * @return this
 */
public FutureData<DataSiftResult> start(final FutureData<ManagedSource> source){
  if (source == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final FutureData<DataSiftResult> future=new FutureData<>();
  final DataSiftResult res=new BaseDataSiftResult();
  unwrapFuture(source,future,res,new FutureResponse<ManagedSource>(){
    public void apply(    ManagedSource data){
      URI uri=newParams().forURL(config.newAPIEndpointURI(START));
      POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,data,config))).form("String_Node_Str",data.getId());
      applyConfig(request).execute();
    }
  }
);
  return future;
}

Fixed version (ground truth):
/** 
 * @param source start a configured managed source
 * @return this
 */
public FutureData<DataSiftResult> start(final FutureData<ManagedSource> source){
  if (source == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  final FutureData<DataSiftResult> future=new FutureData<>();
  final DataSiftResult res=new BaseDataSiftResult();
  unwrapFuture(source,future,res,new FutureResponse<ManagedSource>(){
    public void apply(    ManagedSource data){
      URI uri=newParams().forURL(config.newAPIEndpointURI(START));
      POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,data,config))).form("String_Node_Str",data.getId());
      performRequest(future,request);
    }
  }
);
  return future;
}
Program: 44214
Project: 44214
Buggy source:
protected <T extends DataSource>FutureData<ManagedSource> updateOrCreate(String name,T source,String id){
  if (name == null || source == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<ManagedSource> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(id == null ? CREATE : UPDATE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new ManagedSource(),config))).form("String_Node_Str",source.type().value()).form("String_Node_Str",name);
  if (source.hasParams()) {
    request.form("String_Node_Str",source.getParametersAsJSON());
  }
  if (source.hasResources()) {
    request.form("String_Node_Str",source.getResourcesAsJSON());
  }
  if (source.hasAuth()) {
    request.form("String_Node_Str",source.getAuthAsJSON());
  }
  applyConfig(request).execute();
  return future;
}

Fixed version (ground truth):
protected <T extends DataSource>FutureData<ManagedSource> updateOrCreate(String name,T source,String id){
  if (name == null || source == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  FutureData<ManagedSource> future=new FutureData<>();
  URI uri=newParams().forURL(config.newAPIEndpointURI(id == null ? CREATE : UPDATE));
  POST request=config.http().POST(uri,new PageReader(newRequestCallback(future,new ManagedSource(),config))).form("String_Node_Str",source.type().value()).form("String_Node_Str",name);
  if (source.hasParams()) {
    request.form("String_Node_Str",source.getParametersAsJSON());
  }
  if (source.hasResources()) {
    request.form("String_Node_Str",source.getResourcesAsJSON());
  }
  if (source.hasAuth()) {
    request.form("String_Node_Str",source.getAuthAsJSON());
  }
  performRequest(future,request);
  return future;
}