nus-yam/ex-repair huggingface dataset:
Program: 39064
Project: 39064
Buggy source:
private boolean isCollectionType(VCFCompoundHeaderLine info){
  VCFHeaderLineCount count=info.getCountType();
  return count == VCFHeaderLineCount.A || count == VCFHeaderLineCount.R || count == VCFHeaderLineCount.UNBOUNDED || (count == VCFHeaderLineCount.INTEGER && info.getCount() > 1);
}

Fixed version (ground truth):
private boolean isCollectionType(VCFCompoundHeaderLine info){
  VCFHeaderLineCount count=info.getCountType();
  return count == VCFHeaderLineCount.A || count == VCFHeaderLineCount.G || count == VCFHeaderLineCount.R || count == VCFHeaderLineCount.UNBOUNDED || (count == VCFHeaderLineCount.INTEGER && info.getCount() > 1);
}
Program: 39065
Project: 39065
Buggy source:
private String getSingleColumnValue(List call,String column){
  VariantPropertyType type=getColumnType(column);
  Object value=call.get(indexMap.get(column));
switch (type) {
case STRING:
    return (String)value;
case STRING_COLLECTION:
  List<String> values=(List<String>)value;
if (values.size() != 1) {
  throw new IllegalStateException("String_Node_Str");
}
return values.get(0);
default :
throw new IllegalStateException("String_Node_Str");
}
}

Fixed version (ground truth):
private String getSingleColumnValue(List call,String column){
  VariantPropertyType type=getColumnType(column);
  Object value=call.get(indexMap.get(column));
switch (type) {
case NUMERIC:
case STRING:
    return value.toString();
case NUMERIC_COLLECTION:
case STRING_COLLECTION:
  List values=(List)value;
if (values.size() != 1) {
  throw new IllegalStateException("String_Node_Str");
}
return values.get(0).toString();
default :
throw new IllegalStateException("String_Node_Str");
}
}
Program: 39066
Project: 39066
Buggy source:
@Override public Object instantiateItem(ViewGroup container,int position){
  layoutInflater=(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View v=layoutInflater.inflate(R.layout.fullwallpaper_view_layout,container,false);
  draweeView=v.findViewById(R.id.full_image_view);
  if (arrayList != null) {
    draweeView.setImageURI(arrayList.get(position).getWallpaperFullURL());
  }
 else {
    Uri imageUri=Uri.fromFile(new File(path.get(position)));
    draweeView.setImageURI(imageUri);
  }
  container.addView(v);
  return v;
}

Fixed version (ground truth):
@Override public Object instantiateItem(ViewGroup container,int position){
  layoutInflater=(LayoutInflater)activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View v=layoutInflater.inflate(R.layout.fullwallpaper_view_layout,container,false);
  draweeView=v.findViewById(R.id.full_image_view);
  if (arrayList != null) {
    DraweeController controller=Fresco.newDraweeControllerBuilder().setLowResImageRequest(ImageRequest.fromUri(arrayList.get(position).getWallpaperURL())).setImageRequest(ImageRequest.fromUri(arrayList.get(position).getWallpaperFullURL())).setOldController(draweeView.getController()).build();
    draweeView.setController(controller);
    draweeView.setController(controller);
  }
 else {
    Uri imageUri=Uri.fromFile(new File(path.get(position)));
    ImageRequest request=ImageRequestBuilder.newBuilderWithSource(imageUri).setLocalThumbnailPreviewsEnabled(true).build();
    DraweeController controller=Fresco.newDraweeControllerBuilder().setImageRequest(request).setOldController(draweeView.getController()).build();
    ProgressBarDrawable progressBarDrawable=new ProgressBarDrawable();
    progressBarDrawable.setPadding(50);
    progressBarDrawable.setColor(R.color.colorBackground);
    draweeView.getHierarchy().setProgressBarImage(progressBarDrawable);
    draweeView.setController(controller);
  }
  container.addView(v);
  return v;
}
Program: 39068
Project: 39068
Buggy source:
@Override public void onPageSelected(int position){
  if ((arrayList.size() - position <= 2)) {
    Log.i("String_Node_Str","String_Node_Str");
    Log.i("String_Node_Str",String.valueOf(pageCount));
    Intent intent=new Intent("String_Node_Str");
    LocalBroadcastManager.getInstance(FullWallpaperViewActivity.this).sendBroadcast(intent);
    Log.i("String_Node_Str","String_Node_Str");
    viewPager.invalidate();
  }
}

Fixed version (ground truth):
@Override public void onPageSelected(int position){
  if ((arrayList.size() - position <= 2)) {
    Log.i("String_Node_Str","String_Node_Str");
    Log.i("String_Node_Str",String.valueOf(pageCount));
    Intent intent=new Intent("String_Node_Str");
    LocalBroadcastManager.getInstance(FullWallpaperViewActivity.this).sendBroadcast(intent);
    Log.i("String_Node_Str","String_Node_Str");
    viewPager.invalidate();
  }
  encodedUrlFull=arrayList.get(position).getWallpaperFullURL();
  wallId=arrayList.get(position).getWallId();
  Log.i("String_Node_Str",String.valueOf(pos));
  Log.i("String_Node_Str",encodedUrlFull);
}
Program: 39069
Project: 39069
Buggy source:
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  String title="String_Node_Str" + String.valueOf(arrayList.get(position).getWallId());
  getSupportActionBar().setTitle(title);
  toolbar.setTitleTextColor(ContextCompat.getColor(FullWallpaperViewActivity.this,R.color.white));
  toolbar.setPadding(0,getStatusBarHeight(),0,0);
  toolbar.setBackgroundColor(ContextCompat.getColor(FullWallpaperViewActivity.this,R.color.translucentBlackColor));
  toolbar.setNavigationIcon(R.drawable.back_arrow);
  toolbar.setNavigationOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      onBackPressed();
    }
  }
);
  encodedUrlFull=arrayList.get(position).getWallpaperFullURL();
}

Fixed version (ground truth):
@Override public void onPageScrolled(int position,float positionOffset,int positionOffsetPixels){
  String title="String_Node_Str" + String.valueOf(arrayList.get(position).getWallId());
  getSupportActionBar().setTitle(title);
  toolbar.setTitleTextColor(ContextCompat.getColor(FullWallpaperViewActivity.this,R.color.white));
  toolbar.setPadding(0,getStatusBarHeight(),0,0);
  toolbar.setBackgroundColor(ContextCompat.getColor(FullWallpaperViewActivity.this,R.color.translucentBlackColor));
  toolbar.setNavigationIcon(R.drawable.back_arrow);
  toolbar.setNavigationOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      onBackPressed();
    }
  }
);
}
Program: 39070
Project: 39070
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  new loadMore().execute("String_Node_Str" + pageCount + "String_Node_Str");
  Log.i("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  new loadMore().execute("String_Node_Str" + pageCount + "String_Node_Str");
  Log.i("String_Node_Str","String_Node_Str");
  homeFragmentCustomAdapter.notifyDataSetChanged();
}
Program: 39071
Project: 39071
Buggy source:
@Override public void onLoadMore(){
  wallpapersModelArrayList.add(null);
  Log.i("String_Node_Str","String_Node_Str");
  homeFragmentCustomAdapter.notifyItemInserted(wallpapersModelArrayList.size() - 1);
  handler.postDelayed(new Runnable(){
    @Override public void run(){
      wallpapersModelArrayList.remove(wallpapersModelArrayList.size() - 1);
      homeFragmentCustomAdapter.notifyItemRemoved(wallpapersModelArrayList.size());
      Log.i("String_Node_Str","String_Node_Str");
      Log.i("String_Node_Str","String_Node_Str");
      new loadMore().execute("String_Node_Str" + pageCount);
      homeFragmentCustomAdapter.setLoaded();
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
,700);
}

Fixed version (ground truth):
@Override public void onLoadMore(){
  wallpapersModelArrayList.add(null);
  Log.i("String_Node_Str","String_Node_Str");
  homeFragmentCustomAdapter.notifyItemInserted(wallpapersModelArrayList.size() - 1);
  handler.postDelayed(new Runnable(){
    @Override public void run(){
      wallpapersModelArrayList.remove(wallpapersModelArrayList.size() - 1);
      homeFragmentCustomAdapter.notifyItemRemoved(wallpapersModelArrayList.size());
      Log.i("String_Node_Str","String_Node_Str");
      Log.i("String_Node_Str","String_Node_Str");
      new loadMore().execute("String_Node_Str" + pageCount);
      homeFragmentCustomAdapter.setLoaded();
      Log.i("String_Node_Str","String_Node_Str");
    }
  }
,900);
}
Program: 39072
Project: 39072
Buggy source:
private void initData(){
  isNetworkConnected=isNetworkAvailable();
  if (isNetworkConnected) {
    noNetImage.setVisibility(View.INVISIBLE);
    loadFromInternet("String_Node_Str");
  }
 else {
    noNetImage.setImageDrawable(ContextCompat.getDrawable(getActivity(),R.drawable.nonetwork));
    noNetImage.setVisibility(View.VISIBLE);
    Toast.makeText(getContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}

Fixed version (ground truth):
private void initData(){
  isNetworkConnected=isNetworkAvailable();
  if (isNetworkConnected) {
    noNetImage.setVisibility(View.INVISIBLE);
    noNetText.setVisibility(View.INVISIBLE);
    connectBtn.setVisibility(View.GONE);
    loadFromInternet("String_Node_Str");
  }
 else {
    noNetImage.setImageDrawable(ContextCompat.getDrawable(getActivity(),R.drawable.nonetwork));
    noNetImage.setVisibility(View.VISIBLE);
    noNetText.setVisibility(View.VISIBLE);
    connectBtn.setVisibility(View.VISIBLE);
    Toast.makeText(getContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
  }
}
Program: 39074
Project: 39074
Buggy source:
@Override public void handleDelivery(String consumerTag,Envelope envelope,AMQP.BasicProperties properties,byte[] body) throws IOException {
  client.send(new String(body,StandardCharsets.UTF_8));
  channel.basicAck(envelope.getDeliveryTag(),false);
}

Fixed version (ground truth):
@Override public void handleDelivery(String consumerTag,Envelope envelope,AMQP.BasicProperties properties,byte[] body) throws IOException {
  client.send(new String(body,StandardCharsets.UTF_8));
}
Program: 39077
Project: 39077
Buggy source:
protected void register(ServerWebSocketClient client) throws IOException {
  channel.basicConsume("String_Node_Str" + shardId + "String_Node_Str",false,new DefaultConsumer(channel){
    @Override public void handleDelivery(    String consumerTag,    Envelope envelope,    AMQP.BasicProperties properties,    byte[] body) throws IOException {
      client.send(new String(body,StandardCharsets.UTF_8));
      channel.basicAck(envelope.getDeliveryTag(),false);
    }
  }
);
}

Fixed version (ground truth):
protected void register(ServerWebSocketClient client) throws IOException {
  channel.basicConsume("String_Node_Str" + shardId + "String_Node_Str",true,new DefaultConsumer(channel){
    @Override public void handleDelivery(    String consumerTag,    Envelope envelope,    AMQP.BasicProperties properties,    byte[] body) throws IOException {
      client.send(new String(body,StandardCharsets.UTF_8));
    }
  }
);
}
Program: 39078
Project: 39078
Buggy source:
@Override public void handleDelivery(String consumerTag,Envelope envelope,AMQP.BasicProperties properties,byte[] body) throws IOException {
  JSONObject obj=new JSONObject(new String(body,StandardCharsets.UTF_8));
  if (obj.has("String_Node_Str") && obj.getString("String_Node_Str").equals("String_Node_Str")) {
    client.getJDA().setPing(obj.getJSONObject("String_Node_Str").getLong("String_Node_Str"));
    return;
  }
  if (enableRawGatewayEvent)   client.getJDA().getEventManager().handle(new RawGatewayEvent(client.getJDA(),new JSONObject(obj.toString())));
  client.handleEvent(obj);
  channel.basicAck(envelope.getDeliveryTag(),false);
}

Fixed version (ground truth):
@Override public void handleDelivery(String consumerTag,Envelope envelope,AMQP.BasicProperties properties,byte[] body) throws IOException {
  JSONObject obj=new JSONObject(new String(body,StandardCharsets.UTF_8));
  if (obj.has("String_Node_Str") && obj.getString("String_Node_Str").equals("String_Node_Str")) {
    client.getJDA().setPing(obj.getJSONObject("String_Node_Str").getLong("String_Node_Str"));
    return;
  }
  if (enableRawGatewayEvent)   client.getJDA().getEventManager().handle(new RawGatewayEvent(client.getJDA(),new JSONObject(obj.toString())));
  client.handleEvent(obj);
}
Program: 39079
Project: 39079
Buggy source:
protected void register(ClientWebSocketClient client) throws IOException {
  channel.basicConsume("String_Node_Str" + shardId + "String_Node_Str",false,new DefaultConsumer(channel){
    @Override public void handleDelivery(    String consumerTag,    Envelope envelope,    AMQP.BasicProperties properties,    byte[] body) throws IOException {
      JSONObject obj=new JSONObject(new String(body,StandardCharsets.UTF_8));
      if (obj.has("String_Node_Str") && obj.getString("String_Node_Str").equals("String_Node_Str")) {
        client.getJDA().setPing(obj.getJSONObject("String_Node_Str").getLong("String_Node_Str"));
        return;
      }
      if (enableRawGatewayEvent)       client.getJDA().getEventManager().handle(new RawGatewayEvent(client.getJDA(),new JSONObject(obj.toString())));
      client.handleEvent(obj);
      channel.basicAck(envelope.getDeliveryTag(),false);
    }
  }
);
  channel.basicPublish("String_Node_Str","String_Node_Str" + shardId + "String_Node_Str",null,new byte[0]);
}

Fixed version (ground truth):
protected void register(ClientWebSocketClient client) throws IOException {
  channel.basicConsume("String_Node_Str" + shardId + "String_Node_Str",true,new DefaultConsumer(channel){
    @Override public void handleDelivery(    String consumerTag,    Envelope envelope,    AMQP.BasicProperties properties,    byte[] body) throws IOException {
      JSONObject obj=new JSONObject(new String(body,StandardCharsets.UTF_8));
      if (obj.has("String_Node_Str") && obj.getString("String_Node_Str").equals("String_Node_Str")) {
        client.getJDA().setPing(obj.getJSONObject("String_Node_Str").getLong("String_Node_Str"));
        return;
      }
      if (enableRawGatewayEvent)       client.getJDA().getEventManager().handle(new RawGatewayEvent(client.getJDA(),new JSONObject(obj.toString())));
      client.handleEvent(obj);
    }
  }
);
  channel.basicPublish("String_Node_Str","String_Node_Str" + shardId + "String_Node_Str",null,new byte[0]);
}
Program: 39080
Project: 39080
Buggy source:
public static BigDecimal calculateTheta(List<WeightedSensitivity> weightedSensitivies){
  BigDecimal sumOfRiskExposures=WeightedSensitivityUtils.sumWeightSensitivities(weightedSensitivies);
  BigDecimal sumOfAbsRiskExposures=WeightedSensitivityUtils.sumAbsoluteValues(weightedSensitivies);
  BigDecimal quotient=BigDecimalUtils.divideWithPrecision(sumOfRiskExposures,sumOfAbsRiskExposures);
  return quotient.min(BigDecimal.ZERO);
}

Fixed version (ground truth):
public static BigDecimal calculateTheta(List<WeightedSensitivity> weightedSensitivies){
  BigDecimal sumOfRiskExposures=WeightedSensitivityUtils.sumWeightSensitivities(weightedSensitivies);
  BigDecimal sumOfAbsRiskExposures=WeightedSensitivityUtils.sumAbsoluteValues(weightedSensitivies);
  if (sumOfAbsRiskExposures.stripTrailingZeros().equals(BigDecimal.ZERO)) {
    return BigDecimal.ZERO;
  }
 else {
    BigDecimal quotient=BigDecimalUtils.divideWithPrecision(sumOfRiskExposures,sumOfAbsRiskExposures);
    return quotient.min(BigDecimal.ZERO);
  }
}
Program: 39084
Project: 39084
Buggy source:
private static void updateDashboards(){
  List<String> availableDashboards=getFilesFromDir("String_Node_Str");
  if (availableDashboards.isEmpty()) {
    log.info("String_Node_Str");
    return;
  }
  String grafanaBaseUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",buildAuthenticationHeader());
  switchOrg(grafanaBaseUrl,headers);
  JsonArray dashboardArray=loadDashboards(grafanaBaseUrl,headers);
  if (dashboardArray.size() > 0) {
    log.info("String_Node_Str");
    return;
  }
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  JsonObject requestJson=null;
  JsonArray inputs=null;
  JsonObject jsonResponse=null;
  for (  String dashboard : availableDashboards) {
    JsonObject dashboardJson=loadJsonFile("String_Node_Str" + dashboard);
    requestJson=getNewJsonObject();
    requestJson.add("String_Node_Str",dashboardJson);
    requestJson.addProperty("String_Node_Str",true);
    inputs=getNewJsonArray();
    inputs.add(buildDSInput(NEO4J_DS,"String_Node_Str"));
    inputs.add(buildDSInput(ElaticSearch_DS,"String_Node_Str"));
    requestJson.add("String_Node_Str",inputs);
    ClientResponse response=RestHandler.doPost(apiUrl,requestJson,headers);
    jsonResponse=getNewJsonParser().parse(response.getEntity(String.class)).getAsJsonObject();
    if (jsonResponse.get("String_Node_Str").getAsBoolean()) {
      log.info("String_Node_Str" + dashboard);
    }
 else {
      log.warn("String_Node_Str" + jsonResponse.toString());
    }
  }
}

Fixed version (ground truth):
private static void updateDashboards(){
  List<String> availableDashboards=getFilesFromDir("String_Node_Str");
  if (availableDashboards.isEmpty()) {
    log.info("String_Node_Str");
    return;
  }
  String grafanaBaseUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",buildAuthenticationHeader());
  switchOrg(grafanaBaseUrl,headers);
  JsonArray dashboardArray=loadDashboards(grafanaBaseUrl,headers);
  if (dashboardArray.size() > 0) {
    log.info("String_Node_Str");
    return;
  }
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  JsonObject requestJson=null;
  JsonArray inputs=null;
  JsonObject jsonResponse=null;
  for (  String dashboard : availableDashboards) {
    JsonObject dashboardJson=loadJsonFile("String_Node_Str" + dashboard);
    requestJson=getNewJsonObject();
    requestJson.add("String_Node_Str",dashboardJson);
    requestJson.addProperty("String_Node_Str",true);
    inputs=getNewJsonArray();
    inputs.add(buildDSInput(NEO4J_DS,"String_Node_Str"));
    inputs.add(buildDSInput(ElaticSearch_DS,"String_Node_Str"));
    requestJson.add("String_Node_Str",inputs);
    ClientResponse response=RestHandler.doPost(apiUrl,requestJson,headers);
    jsonResponse=getNewJsonParser().parse(response.getEntity(String.class)).getAsJsonObject();
  }
}
Program: 39086
Project: 39086
Buggy source:
public int executeOfflineProcessing(){
  File queryFolderPath=new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH);
  File[] files=queryFolderPath.listFiles();
  int jsonFileCount=0;
  for (  File eachFile : files) {
    if (eachFile.isFile()) {
      String fileName=eachFile.getName();
      if (hasJsonFileExtension(fileName)) {
        jsonFileCount++;
        processOfflineConfiguration(eachFile);
      }
    }
  }
  return jsonFileCount;
}

Fixed version (ground truth):
public int executeOfflineProcessing(){
  File queryFolderPath=new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH);
  File[] files=queryFolderPath.listFiles();
  int jsonFileCount=0;
  if (files != null) {
    for (    File eachFile : files) {
      if (eachFile.isFile()) {
        String fileName=eachFile.getName();
        if (hasJsonFileExtension(fileName)) {
          jsonFileCount++;
          processOfflineConfiguration(eachFile);
        }
      }
    }
  }
  return jsonFileCount;
}
Program: 39087
Project: 39087
Buggy source:
private static void updateDashboards(){
  List<String> availableDashboards=getFilesFromDir("String_Node_Str");
  if (availableDashboards.isEmpty()) {
    log.info("String_Node_Str");
    return;
  }
  String grafanaBaseUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",buildAuthenticationHeader());
  switchOrg(grafanaBaseUrl,headers);
  JsonArray dashboardArray=loadDashboards(grafanaBaseUrl,headers);
  if (dashboardArray.size() > 0) {
    log.info("String_Node_Str");
    return;
  }
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  JsonObject requestJson=null;
  JsonArray inputs=null;
  JsonObject jsonResponse=null;
  for (  String dashboard : availableDashboards) {
    JsonObject dashboardJson=loadJsonFile("String_Node_Str" + dashboard);
    requestJson=getNewJsonObject();
    requestJson.add("String_Node_Str",dashboardJson);
    requestJson.addProperty("String_Node_Str",true);
    inputs=getNewJsonArray();
    inputs.add(buildDSInput(NEO4J_DS,"String_Node_Str"));
    inputs.add(buildDSInput(ElaticSearch_DS,"String_Node_Str"));
    requestJson.add("String_Node_Str",inputs);
    ClientResponse response=RestHandler.doPost(apiUrl,requestJson,headers);
    jsonResponse=getNewJsonParser().parse(response.getEntity(String.class)).getAsJsonObject();
    if (jsonResponse.get("String_Node_Str").getAsBoolean()) {
      log.info("String_Node_Str" + dashboard);
    }
 else {
      log.warn("String_Node_Str" + jsonResponse.toString());
    }
  }
}

Fixed version (ground truth):
private static void updateDashboards(){
  List<String> availableDashboards=getFilesFromDir("String_Node_Str");
  if (availableDashboards.isEmpty()) {
    log.info("String_Node_Str");
    return;
  }
  String grafanaBaseUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint();
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",buildAuthenticationHeader());
  switchOrg(grafanaBaseUrl,headers);
  JsonArray dashboardArray=loadDashboards(grafanaBaseUrl,headers);
  if (dashboardArray.size() > 0) {
    log.info("String_Node_Str");
    return;
  }
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  JsonObject requestJson=null;
  JsonArray inputs=null;
  JsonObject jsonResponse=null;
  for (  String dashboard : availableDashboards) {
    JsonObject dashboardJson=loadJsonFile("String_Node_Str" + dashboard);
    requestJson=getNewJsonObject();
    requestJson.add("String_Node_Str",dashboardJson);
    requestJson.addProperty("String_Node_Str",true);
    inputs=getNewJsonArray();
    inputs.add(buildDSInput(NEO4J_DS,"String_Node_Str"));
    inputs.add(buildDSInput(ElaticSearch_DS,"String_Node_Str"));
    requestJson.add("String_Node_Str",inputs);
    ClientResponse response=RestHandler.doPost(apiUrl,requestJson,headers);
    jsonResponse=getNewJsonParser().parse(response.getEntity(String.class)).getAsJsonObject();
  }
}
Program: 39089
Project: 39089
Buggy source:
@RequestMapping(value="String_Node_Str",headers=("String_Node_Str"),method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE,consumes=MediaType.MULTIPART_FORM_DATA_VALUE) public @ResponseBody JsonObject uploadHierarchyDetails(@RequestParam("String_Node_Str") MultipartFile file,@RequestParam String action){
  boolean status=false;
  if (null != action && action.equals("String_Node_Str")) {
    status=DataProcessorUtil.getInstance().createBusinessHierarchyMetaData(file);
  }
 else   if (null != action && action.equals("String_Node_Str")) {
    status=DataProcessorUtil.getInstance().updateHiearchyProperty(file);
  }
  if (!status) {
    return PlatformServiceUtil.buildFailureResponse(ErrorMessage.DB_INSERTION_FAILED);
  }
  return PlatformServiceUtil.buildSuccessResponse();
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",headers=("String_Node_Str"),method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE,consumes=MediaType.MULTIPART_FORM_DATA_VALUE) public @ResponseBody JsonObject uploadHierarchyDetails(@RequestParam("String_Node_Str") MultipartFile file,@RequestParam String action){
  boolean status=false;
  try {
    if (null != action && action.equals("String_Node_Str")) {
      status=DataProcessorUtil.getInstance().createBusinessHierarchyMetaData(file);
    }
 else     if (null != action && action.equals("String_Node_Str")) {
      status=DataProcessorUtil.getInstance().updateHiearchyProperty(file);
    }
    if (!status) {
      return PlatformServiceUtil.buildFailureResponse(ErrorMessage.DB_INSERTION_FAILED);
    }
  }
 catch (  InsightsCustomException e) {
    return PlatformServiceUtil.buildFailureResponse(e.getMessage());
  }
  return PlatformServiceUtil.buildSuccessResponse();
}
Program: 39090
Project: 39090
Buggy source:
private JsonObject getHierachyDetails(CSVRecord record,Map<String,Integer> headerMap){
  JsonObject json=new JsonObject();
  for (  Map.Entry<String,Integer> header : headerMap.entrySet()) {
    if (header.getKey() != null && !DatataggingConstants.ACTION.equalsIgnoreCase(header.getKey())) {
      json.addProperty(header.getKey(),record.get(header.getValue()));
    }
  }
  return json;
}

Fixed version (ground truth):
private JsonObject getHierachyDetails(CSVRecord record,Map<String,Integer> headerMap){
  JsonObject json=new JsonObject();
  for (  Map.Entry<String,Integer> header : headerMap.entrySet()) {
    if (header.getKey() != null && !DatataggingConstants.ACTION.equalsIgnoreCase(header.getKey())) {
      if (DatataggingConstants.METADATA_ID.equalsIgnoreCase(header.getKey()) && (record.get(header.getValue()) != null && !record.get(header.getValue()).isEmpty())) {
        json.addProperty(header.getKey(),Integer.valueOf(record.get(header.getValue())));
      }
 else {
        json.addProperty(header.getKey(),record.get(header.getValue()));
      }
    }
  }
  return json;
}
Program: 39091
Project: 39091
Buggy source:
private Path updateAgentConfig(String toolName,JsonObject json) throws IOException {
  String filePath=ApplicationConfigProvider.getInstance().getAgentDetails().getUnzipPath();
  filePath=filePath + File.separator + toolName;
  File configFile=null;
  Path dir=Paths.get(filePath);
  try (Stream<Path> paths=Files.find(dir,Integer.MAX_VALUE,(path,attrs) -> attrs.isRegularFile() && path.toString().endsWith("String_Node_Str"))){
    configFile=paths.limit(1).findFirst().get().toFile();
  }
   try (FileWriter file=new FileWriter(configFile)){
    file.write(json.toString());
    file.flush();
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    throw e;
  }
  Path sourceFolderPath=Paths.get(ApplicationConfigProvider.getInstance().getAgentDetails().getUnzipPath(),toolName);
  Path zipPath=Paths.get(ApplicationConfigProvider.getInstance().getAgentDetails().getUnzipPath(),toolName + "String_Node_Str");
  Path agentZipPath=null;
  try {
    agentZipPath=AgentManagementUtil.getInstance().getAgentZipFolder(sourceFolderPath,zipPath);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw e;
  }
  return agentZipPath;
}

Fixed version (ground truth):
private Path updateAgentConfig(String toolName,JsonObject json) throws IOException {
  String filePath=ApplicationConfigProvider.getInstance().getAgentDetails().getUnzipPath() + File.separator + toolName;
  File configFile=null;
  Path dir=Paths.get(filePath);
  try (Stream<Path> paths=Files.find(dir,Integer.MAX_VALUE,(path,attrs) -> attrs.isRegularFile() && path.toString().endsWith("String_Node_Str"))){
    configFile=paths.limit(1).findFirst().get().toFile();
  }
   try (FileWriter file=new FileWriter(configFile)){
    file.write(json.toString());
    file.flush();
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    throw e;
  }
  Path sourceFolderPath=Paths.get(ApplicationConfigProvider.getInstance().getAgentDetails().getUnzipPath(),toolName);
  Path zipPath=Paths.get(ApplicationConfigProvider.getInstance().getAgentDetails().getUnzipPath(),toolName + "String_Node_Str");
  Path agentZipPath=null;
  try {
    agentZipPath=AgentManagementUtil.getInstance().getAgentZipFolder(sourceFolderPath,zipPath);
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
    throw e;
  }
  return agentZipPath;
}
Program: 39092
Project: 39092
Buggy source:
private String getOfflineToolRawConfigFile(String version,String tool) throws InsightsCustomException {
  String offlinePath=ApplicationConfigProvider.getInstance().getAgentDetails().getOfflineAgentPath();
  offlinePath=offlinePath + File.separator + version+ File.separator+ tool;
  Path dir=Paths.get(offlinePath);
  String config=null;
  try (Stream<Path> paths=Files.find(dir,Integer.MAX_VALUE,(path,attrs) -> attrs.isRegularFile() && path.toString().endsWith("String_Node_Str"))){
    JsonParser parser=new JsonParser();
    Object obj=parser.parse(new FileReader(paths.limit(1).findFirst().get().toFile()));
    config=((JsonObject)obj).toString();
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
  }
  return config;
}

Fixed version (ground truth):
private String getOfflineToolRawConfigFile(String version,String tool) throws InsightsCustomException {
  String offlinePath=ApplicationConfigProvider.getInstance().getAgentDetails().getOfflineAgentPath() + File.separator + version+ File.separator+ tool;
  String filePath=ApplicationConfigProvider.getInstance().getAgentDetails().getUnzipPath() + File.separator + tool;
  try {
    FileUtils.copyDirectory(new File(offlinePath),new File(filePath));
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    throw new InsightsCustomException("String_Node_Str" + e.getMessage());
  }
  Path dir=Paths.get(filePath);
  String config=null;
  try (Stream<Path> paths=Files.find(dir,Integer.MAX_VALUE,(path,attrs) -> attrs.isRegularFile() && path.toString().endsWith("String_Node_Str"))){
    JsonParser parser=new JsonParser();
    Object obj=parser.parse(new FileReader(paths.limit(1).findFirst().get().toFile()));
    config=((JsonObject)obj).toString();
  }
 catch (  IOException e) {
    log.error("String_Node_Str",e);
    throw new InsightsCustomException("String_Node_Str" + e.getMessage());
  }
  return config;
}
Program: 39093
Project: 39093
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject getCurrentUserOrgs(){
  Map<String,String> headers=new HashMap<String,String>();
  String cookies=getUserCookies();
  headers.put("String_Node_Str",cookies);
  log.debug("String_Node_Str" + cookies);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  ClientResponse response=RestHandler.doGet(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject getCurrentUserOrgs(){
  log.debug("String_Node_Str");
  Map<String,String> headers=new HashMap<String,String>();
  String cookies=getUserCookies();
  headers.put("String_Node_Str",cookies);
  log.debug("String_Node_Str" + cookies);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  ClientResponse response=RestHandler.doGet(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}
Program: 39094
Project: 39094
Buggy source:
private String getCurrentOrgRole(Map<String,String> headers,String grafanaCurrentOrg){
  String userOrgsApiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  ClientResponse grafanaCurrentOrgResponse=RestHandler.doGet(userOrgsApiUrl,null,headers);
  JsonArray grafanaOrgs=new JsonParser().parse(grafanaCurrentOrgResponse.getEntity(String.class)).getAsJsonArray();
  String grafanaCurrentOrgRole=null;
  for (  JsonElement org : grafanaOrgs) {
    if (grafanaCurrentOrg.equals(org.getAsJsonObject().get("String_Node_Str").toString())) {
      grafanaCurrentOrgRole=org.getAsJsonObject().get("String_Node_Str").getAsString();
      break;
    }
  }
  return grafanaCurrentOrgRole;
}

Fixed version (ground truth):
private String getCurrentOrgRole(Map<String,String> headers,String grafanaCurrentOrg){
  log.debug("String_Node_Str");
  String userOrgsApiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  log.debug("String_Node_Str" + userOrgsApiUrl);
  log.debug("String_Node_Str" + headers);
  ClientResponse grafanaCurrentOrgResponse=RestHandler.doGet(userOrgsApiUrl,null,headers);
  JsonArray grafanaOrgs=new JsonParser().parse(grafanaCurrentOrgResponse.getEntity(String.class)).getAsJsonArray();
  String grafanaCurrentOrgRole=null;
  for (  JsonElement org : grafanaOrgs) {
    if (grafanaCurrentOrg.equals(org.getAsJsonObject().get("String_Node_Str").toString())) {
      grafanaCurrentOrgRole=org.getAsJsonObject().get("String_Node_Str").getAsString();
      break;
    }
  }
  log.debug("String_Node_Str" + grafanaCurrentOrgRole + "String_Node_Str");
  return grafanaCurrentOrgRole;
}
Program: 39095
Project: 39095
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject getOrgs(){
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",buildAuthenticationHeader());
  ClientResponse response=RestHandler.doGet(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject getOrgs(){
  log.debug("String_Node_Str");
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  log.debug("String_Node_Str" + apiUrl);
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",buildAuthenticationHeader());
  ClientResponse response=RestHandler.doGet(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}
Program: 39096
Project: 39096
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject getUser(){
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",getUserCookies());
  ClientResponse response=RestHandler.doGet(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject getUser(){
  log.debug("String_Node_Str");
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  log.debug("String_Node_Str" + apiUrl);
  Map<String,String> headers=new HashMap<String,String>();
  headers.put("String_Node_Str",getUserCookies());
  ClientResponse response=RestHandler.doGet(apiUrl,null,headers);
  log.debug("String_Node_Str" + headers + "String_Node_Str");
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}
Program: 39098
Project: 39098
Buggy source:
private String getGrafanaCurrentOrg(Map<String,String> headers){
  String loginApiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  ClientResponse grafanaCurrentOrgResponse=RestHandler.doGet(loginApiUrl,null,headers);
  JsonObject responseJson=new JsonParser().parse(grafanaCurrentOrgResponse.getEntity(String.class)).getAsJsonObject();
  String grafanaCurrentOrg=responseJson.get("String_Node_Str").toString();
  return grafanaCurrentOrg;
}

Fixed version (ground truth):
private String getGrafanaCurrentOrg(Map<String,String> headers){
  log.debug("String_Node_Str");
  String loginApiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str";
  ClientResponse grafanaCurrentOrgResponse=RestHandler.doGet(loginApiUrl,null,headers);
  JsonObject responseJson=new JsonParser().parse(grafanaCurrentOrgResponse.getEntity(String.class)).getAsJsonObject();
  String grafanaCurrentOrg=responseJson.get("String_Node_Str").toString();
  log.debug("String_Node_Str" + grafanaCurrentOrg + "String_Node_Str");
  return grafanaCurrentOrg;
}
Program: 39099
Project: 39099
Buggy source:
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthorityUtil.getSpringAuthorityRole(grafanaCurrentOrgRole));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}

Fixed version (ground truth):
@RequestMapping(value="String_Node_Str",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE) public JsonObject switchUserOrg(@RequestParam int orgId){
  log.debug("String_Node_Str" + orgId);
  Map<String,String> headers=new HashMap<String,String>();
  String grafanaCookie=getUserCookies();
  headers.put("String_Node_Str",grafanaCookie);
  String apiUrl=ApplicationConfigProvider.getInstance().getGrafana().getGrafanaEndpoint() + "String_Node_Str" + orgId;
  ClientResponse response=RestHandler.doPost(apiUrl,null,headers);
  log.debug("String_Node_Str" + apiUrl);
  log.debug("String_Node_Str" + headers);
  Map<String,String> grafanaResponseCookies=new HashMap<String,String>();
  String grafanaCurrentOrg=getGrafanaCurrentOrg(headers);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrg);
  String grafanaCurrentOrgRole=getCurrentOrgRole(headers,grafanaCurrentOrg);
  grafanaResponseCookies.put("String_Node_Str",grafanaCurrentOrgRole);
  httpRequest.setAttribute("String_Node_Str",grafanaResponseCookies);
  Authentication auth=SecurityContextHolder.getContext().getAuthentication();
  List<GrantedAuthority> updatedAuthorities=new ArrayList<>(auth.getAuthorities());
  updatedAuthorities.add(SpringAuthorityUtil.getSpringAuthorityRole(grafanaCurrentOrgRole));
  Authentication newAuth=new UsernamePasswordAuthenticationToken(auth.getPrincipal(),auth.getCredentials(),updatedAuthorities);
  SecurityContextHolder.getContext().setAuthentication(newAuth);
  return PlatformServiceUtil.buildSuccessResponseWithData(new JsonParser().parse(response.getEntity(String.class)));
}
Program: 39101
Project: 39101
Buggy source:
@Override public String registerAgent(String toolName,String agentVersion,String osversion,String configDetails) throws InsightsCustomException {
  try {
    String agentId=getAgentkey(toolName);
    Gson gson=new Gson();
    JsonElement jelement=gson.fromJson(configDetails.trim(),JsonElement.class);
    JsonObject json=jelement.getAsJsonObject();
    json.addProperty("String_Node_Str",agentId);
    json.addProperty("String_Node_Str",osversion);
    json.addProperty("String_Node_Str",agentVersion);
    json.get("String_Node_Str").getAsJsonObject().addProperty("String_Node_Str",agentId);
    boolean isDataUpdateSupported=false;
    if (json.get("String_Node_Str") != null && !json.get("String_Node_Str").isJsonNull()) {
      isDataUpdateSupported=json.get("String_Node_Str").getAsBoolean();
    }
    String uniqueKey=agentId;
    Date updateDate=Timestamp.valueOf(LocalDateTime.now());
    AgentConfigDAL agentConfigDAL=new AgentConfigDAL();
    agentConfigDAL.saveAgentConfigFromUI(agentId,json.get("String_Node_Str").getAsString(),toolName,json,isDataUpdateSupported,uniqueKey,agentVersion,osversion,updateDate);
    Path agentZipPath=updateAgentConfig(toolName,agentId,json);
    byte[] data=Files.readAllBytes(agentZipPath);
    sendAgentPackage(data,toolName,agentId,toolName,osversion);
    performAgentAction(agentId,AGENTSTATUS.START.name());
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + toolName,e);
    throw new InsightsCustomException(e.toString());
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String registerAgent(String toolName,String agentVersion,String osversion,String configDetails) throws InsightsCustomException {
  try {
    String agentId=getAgentkey(toolName);
    Gson gson=new Gson();
    JsonElement jelement=gson.fromJson(configDetails.trim(),JsonElement.class);
    JsonObject json=jelement.getAsJsonObject();
    json.addProperty("String_Node_Str",agentId);
    json.addProperty("String_Node_Str",osversion);
    json.addProperty("String_Node_Str",agentVersion);
    json.get("String_Node_Str").getAsJsonObject().addProperty("String_Node_Str",agentId);
    boolean isDataUpdateSupported=false;
    if (json.get("String_Node_Str") != null && !json.get("String_Node_Str").isJsonNull()) {
      isDataUpdateSupported=json.get("String_Node_Str").getAsBoolean();
    }
    String uniqueKey=agentId;
    Date updateDate=Timestamp.valueOf(LocalDateTime.now());
    AgentConfigDAL agentConfigDAL=new AgentConfigDAL();
    agentConfigDAL.saveAgentConfigFromUI(agentId,json.get("String_Node_Str").getAsString(),toolName,json,isDataUpdateSupported,uniqueKey,agentVersion,osversion,updateDate);
    Path agentZipPath=updateAgentConfig(toolName,agentId,json);
    byte[] data=Files.readAllBytes(agentZipPath);
    String fileName=toolName + FILETYPE;
    sendAgentPackage(data,fileName,agentId,toolName,osversion);
    performAgentAction(agentId,AGENTSTATUS.START.name());
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + toolName,e);
    throw new InsightsCustomException(e.toString());
  }
  return "String_Node_Str";
}
Program: 39102
Project: 39102
Buggy source:
@Override public String updateAgent(String agentId,String configDetails,String toolName,String agentVersion,String osversion) throws InsightsCustomException {
  try {
    getToolRawConfigFile(agentVersion,toolName);
    Gson gson=new Gson();
    JsonElement jelement=gson.fromJson(configDetails.trim(),JsonElement.class);
    JsonObject json=jelement.getAsJsonObject();
    json.addProperty("String_Node_Str",osversion);
    json.addProperty("String_Node_Str",agentVersion);
    boolean isDataUpdateSupported=false;
    if (json.get("String_Node_Str") != null && !json.get("String_Node_Str").isJsonNull()) {
      isDataUpdateSupported=json.get("String_Node_Str").getAsBoolean();
    }
    String uniqueKey=agentId;
    Date updateDate=Timestamp.valueOf(LocalDateTime.now());
    AgentConfigDAL agentConfigDAL=new AgentConfigDAL();
    agentConfigDAL.saveAgentConfigFromUI(agentId,json.get("String_Node_Str").getAsString(),toolName,json,isDataUpdateSupported,uniqueKey,agentVersion,osversion,updateDate);
    Path agentZipPath=updateAgentConfig(toolName,agentId,json);
    byte[] data=Files.readAllBytes(agentZipPath);
    sendAgentPackage(data,toolName,agentId,toolName,osversion);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw new InsightsCustomException(e.toString());
  }
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String updateAgent(String agentId,String configDetails,String toolName,String agentVersion,String osversion) throws InsightsCustomException {
  try {
    getToolRawConfigFile(agentVersion,toolName);
    Gson gson=new Gson();
    JsonElement jelement=gson.fromJson(configDetails.trim(),JsonElement.class);
    JsonObject json=jelement.getAsJsonObject();
    json.addProperty("String_Node_Str",osversion);
    json.addProperty("String_Node_Str",agentVersion);
    boolean isDataUpdateSupported=false;
    if (json.get("String_Node_Str") != null && !json.get("String_Node_Str").isJsonNull()) {
      isDataUpdateSupported=json.get("String_Node_Str").getAsBoolean();
    }
    String uniqueKey=agentId;
    Date updateDate=Timestamp.valueOf(LocalDateTime.now());
    AgentConfigDAL agentConfigDAL=new AgentConfigDAL();
    agentConfigDAL.saveAgentConfigFromUI(agentId,json.get("String_Node_Str").getAsString(),toolName,json,isDataUpdateSupported,uniqueKey,agentVersion,osversion,updateDate);
    Path agentZipPath=updateAgentConfig(toolName,agentId,json);
    byte[] data=Files.readAllBytes(agentZipPath);
    String fileName=toolName + FILETYPE;
    sendAgentPackage(data,fileName,agentId,toolName,osversion);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw new InsightsCustomException(e.toString());
  }
  return "String_Node_Str";
}
Program: 39103
Project: 39103
Buggy source:
@Override protected Map<String,Object> execute() throws InsightsSparkJobFailedException {
  Map<String,Object> resultMap=new HashMap<>();
  ElasticSearchDBHandler esDBHandler=new ElasticSearchDBHandler();
  try {
    log.debug("String_Node_Str");
    String esQuery=getEsQueryWithDates(kpiDefinition.getSchedule(),kpiDefinition.getEsquery());
    log.debug("String_Node_Str" + esQuery);
    JsonObject jsonObj=esDBHandler.queryES(ConfigConstants.SPARK_ES_HOST + "String_Node_Str" + ConfigConstants.SPARK_ES_PORT+ "String_Node_Str"+ kpiDefinition.getEsResource()+ "String_Node_Str",esQuery);
    JsonObject aggObj=jsonObj.get("String_Node_Str").getAsJsonObject().get("String_Node_Str").getAsJsonObject();
    JsonElement jsonElement=aggObj.get("String_Node_Str");
    resultMap=getResultMap(jsonElement.getAsLong(),null);
    saveResult(resultMap);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + kpiDefinition.getKpiID() + "String_Node_Str"+ kpiDefinition.getName(),e);
    throw new InsightsSparkJobFailedException("String_Node_Str" + kpiDefinition.getKpiID() + "String_Node_Str"+ kpiDefinition.getName(),e);
  }
  return resultMap;
}

Fixed version (ground truth):
@Override protected Map<String,Object> execute() throws InsightsSparkJobFailedException {
  Map<String,Object> resultMap=new HashMap<>();
  ElasticSearchDBHandler esDBHandler=new ElasticSearchDBHandler();
  try {
    log.debug("String_Node_Str");
    String esQuery=getEsQueryWithDates(kpiDefinition.getSchedule(),kpiDefinition.getEsquery());
    log.debug("String_Node_Str" + esQuery);
    JsonObject jsonObj=esDBHandler.queryES(ConfigConstants.SPARK_ES_HOST + "String_Node_Str" + ConfigConstants.SPARK_ES_PORT+ "String_Node_Str"+ kpiDefinition.getEsResource()+ "String_Node_Str",esQuery);
    JsonObject aggObj=jsonObj.get("String_Node_Str").getAsJsonObject().get("String_Node_Str").getAsJsonObject();
    JsonElement jsonElement=aggObj.get("String_Node_Str");
    if (jsonElement.isJsonNull()) {
      resultMap=getResultMap(0L,null);
    }
 else {
      resultMap=getResultMap(jsonElement.getAsLong(),null);
    }
    saveResult(resultMap);
  }
 catch (  Exception e) {
    log.error("String_Node_Str" + kpiDefinition.getKpiID() + "String_Node_Str"+ kpiDefinition.getName(),e);
    throw new InsightsSparkJobFailedException("String_Node_Str" + kpiDefinition.getKpiID() + "String_Node_Str"+ kpiDefinition.getName(),e);
  }
  return resultMap;
}