nus-yam/ex-repair huggingface dataset:
Program: 22528
Project: 22528
Buggy source:
@Test public void testOK() throws Exception {
  final HiberSapJaxbXmlParser hiberSapJaxbXmlParser=new HiberSapJaxbXmlParser();
  final Properties properties=hiberSapJaxbXmlParser.parseResource("String_Node_Str");
  Assert.assertNotNull(properties);
  testForNotNull(properties,Environment.SESSION_FACTORY_NAME);
  testForNotNull(properties,Environment.CONTEXT_CLASS);
  final Set<String> bapiClasses=new HashSet<String>();
  final Set<String> sapProperties=new HashSet<String>();
  for (  final Object keyObject : properties.keySet()) {
    final String key=(String)keyObject;
    if (key.startsWith(Environment.BABI_CLASSES_PREFIX)) {
      bapiClasses.add(properties.getProperty(key));
    }
 else     if (key.startsWith(Environment.SAP_PREFIX)) {
      sapProperties.add(properties.getProperty(key));
    }
  }
  Assert.assertEquals(2,bapiClasses.size());
  Assert.assertEquals(7,sapProperties.size());
}

Fixed version (ground truth):
@Test public void testOK() throws Exception {
  final HiberSapJaxbXmlParser hiberSapJaxbXmlParser=new HiberSapJaxbXmlParser();
  final Properties properties=hiberSapJaxbXmlParser.parseResource("String_Node_Str");
  Assert.assertNotNull(properties);
  testForNotNull(properties,Environment.SESSION_FACTORY_NAME);
  testForNotNull(properties,Environment.CONTEXT_CLASS);
  final Set<String> bapiClasses=new HashSet<String>();
  final Set<String> sapProperties=new HashSet<String>();
  for (  final Object keyObject : properties.keySet()) {
    final String key=(String)keyObject;
    if (key.startsWith(Environment.BABI_CLASSES_PREFIX)) {
      bapiClasses.add(properties.getProperty(key));
    }
 else     if (key.startsWith(JCoContext.HIBERSAP_JCO_PREFIX)) {
      sapProperties.add(properties.getProperty(key));
    }
  }
  Assert.assertEquals(2,bapiClasses.size());
  Assert.assertEquals(7,sapProperties.size());
}
Program: 22529
Project: 22529
Buggy source:
public void onCustomerSaved(@Observes(notifyObserver=Reception.IF_EXISTS) CustomerSavedEvent event){
  customerService.storeCustomer(event.getCustomer());
  getView().populateCustomers(customerService.getAllCustomers());
  getView().closeEditor();
}

Fixed version (ground truth):
public void onCustomerSaved(@Observes(notifyObserver=Reception.IF_EXISTS) CustomerSavedEvent event){
  customerService.storeCustomer(event.getCustomer());
  getView().populateCustomers(customerService.getAllCustomers());
  getView().removeTableSelection();
  getView().closeEditor();
}
Program: 22530
Project: 22530
Buggy source:
@Override protected void init(VaadinRequest request){
  VerticalLayout layout=new VerticalLayout();
  layout.setSizeFull();
  topBar=new HorizontalLayout();
  topBar.setWidth(100,Unit.PERCENTAGE);
  logout=new Button("String_Node_Str",logoutClickListener);
  logout.setStyleName(ChameleonTheme.BUTTON_LINK);
  logout.setVisible(false);
  topBar.addComponent(logout);
  topBar.setExpandRatio(logout,1);
  topBar.setComponentAlignment(logout,Alignment.TOP_RIGHT);
  VerticalLayout content=new VerticalLayout();
  content.setSizeFull();
  layout.addComponents(topBar,content);
  layout.setExpandRatio(content,1);
  setContent(layout);
  navigator=new Navigator(this,content);
  navigator.addProvider(viewProvider);
  if (!isLoggedIn()) {
    navigator.navigateTo("String_Node_Str");
  }
 else {
    if (navigator.getState().isEmpty()) {
      navigator.navigateTo("String_Node_Str");
      logout.setVisible(true);
    }
  }
}

Fixed version (ground truth):
@Override protected void init(VaadinRequest request){
  VerticalLayout layout=new VerticalLayout();
  layout.setSizeFull();
  topBar=new HorizontalLayout();
  topBar.setWidth(100,Unit.PERCENTAGE);
  logout=new Button("String_Node_Str",logoutClickListener);
  logout.setStyleName(ChameleonTheme.BUTTON_LINK);
  topBar.addComponent(logout);
  topBar.setExpandRatio(logout,1);
  topBar.setComponentAlignment(logout,Alignment.TOP_RIGHT);
  VerticalLayout content=new VerticalLayout();
  content.setSizeFull();
  layout.addComponents(topBar,content);
  layout.setExpandRatio(content,1);
  setContent(layout);
  navigator=new Navigator(this,content);
  navigator.addProvider(viewProvider);
  if (!isLoggedIn()) {
    navigator.navigateTo("String_Node_Str");
    logout.setVisible(false);
  }
 else {
    if (navigator.getState().isEmpty()) {
      navigator.navigateTo("String_Node_Str");
      logout.setVisible(true);
    }
  }
}
Program: 22531
Project: 22531
Buggy source:
public static Marker getMarker(Marker... markers){
  Marker output=MarkerFactory.getMarker("String_Node_Str");
  output.remove(output);
  for (  Marker marker : markers) {
    output.add(marker);
  }
  return output;
}

Fixed version (ground truth):
public static Marker getMarker(Marker... markers){
  Marker output=new MultiMarker(markers);
  return output;
}
Program: 22532
Project: 22532
Buggy source:
@Test public void multiMarkerTest(){
  Marker marker=SecurityMarkers.getMarker(SecurityMarkers.SECURITY_SUCCESS,SecurityMarkers.CONFIDENTIAL);
  LOGGER.info(marker,"String_Node_Str");
  verify(mockAppender).doAppend(captorLoggingEvent.capture());
  final LoggingEvent loggingEvent=captorLoggingEvent.getValue();
  assertThat(loggingEvent.getLevel(),is(Level.INFO));
  assertThat(loggingEvent.getFormattedMessage(),is("String_Node_Str"));
  Marker test=loggingEvent.getMarker();
  assertTrue(test.contains(SecurityMarkers.SECURITY_SUCCESS));
  assertTrue(test.contains(SecurityMarkers.CONFIDENTIAL));
}

Fixed version (ground truth):
@Test public void multiMarkerTest(){
  Marker marker=SecurityMarkers.getMarker(SecurityMarkers.SECURITY_SUCCESS,SecurityMarkers.CONFIDENTIAL);
  LOGGER.info(marker,"String_Node_Str");
  verify(mockAppender).doAppend(captorLoggingEvent.capture());
  final LoggingEvent loggingEvent=captorLoggingEvent.getValue();
  assertThat(loggingEvent.getLevel(),is(Level.INFO));
  assertThat(loggingEvent.getFormattedMessage(),is("String_Node_Str"));
  Marker test=loggingEvent.getMarker();
  assertTrue(test.contains(SecurityMarkers.SECURITY_SUCCESS));
  assertTrue(test.contains(SecurityMarkers.CONFIDENTIAL));
  assertFalse(test.contains(SecurityMarkers.EVENT_FAILURE));
}
Program: 22533
Project: 22533
Buggy source:
@Override protected void setup(){
  alsltr329.configure().gain(Gain.values()[sensorGainIndex]).measurementRate(MeasurementRate.LTR329_RATE_50MS).integrationTime(IntegrationTime.LTR329_TIME_50MS).commit();
  alsltr329.illuminance().addRouteAsync(source -> {
    source.stream((data,env) -> {
      final Float lux=data.value(Float.class);
      LineData chartData=chart.getData();
      if (startTime == -1) {
        chartData.addXValue("String_Node_Str");
        startTime=System.currentTimeMillis();
      }
 else {
        chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplingPeriod));
      }
      chartData.addEntry(new Entry(lux,sampleCount),0);
      sampleCount++;
    }
);
  }
).continueWith(task -> {
    streamRoute=task.getResult();
    alsltr329.illuminance().start();
    return null;
  }
);
}

Fixed version (ground truth):
@Override protected void setup(){
  alsltr329.configure().gain(Gain.values()[sensorGainIndex]).measurementRate(MeasurementRate.LTR329_RATE_50MS).integrationTime(IntegrationTime.LTR329_TIME_50MS).commit();
  alsltr329.illuminance().addRouteAsync(source -> {
    source.stream((data,env) -> {
      final Float lux=data.value(Float.class);
      LineData chartData=chart.getData();
      if (startTime == -1) {
        chartData.addXValue("String_Node_Str");
        startTime=System.currentTimeMillis();
      }
 else {
        chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplingPeriod));
      }
      chartData.addEntry(new Entry(lux,sampleCount),0);
      sampleCount++;
      updateChart();
    }
);
  }
).continueWith(task -> {
    streamRoute=task.getResult();
    alsltr329.illuminance().start();
    return null;
  }
);
}
Program: 22534
Project: 22534
Buggy source:
@Override protected void setup(){
  barometer.configure().pressureOversampling(OversamplingMode.ULTRA_HIGH).filterCoeff(FilterCoeff.OFF).standbyTime(0.5f).commit();
  barometer.pressure().addRouteAsync(source -> source.stream((data,env) -> {
    LineData chartData=chart.getData();
    if (pressureData.size() >= sampleCount) {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * LIGHT_SAMPLE_PERIOD));
      sampleCount++;
    }
    chartData.addEntry(new Entry(data.value(Float.class),sampleCount),0);
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return barometer.altitude().addRouteAsync(source -> source.stream((data,env) -> {
      LineData chartData=chart.getData();
      if (altitudeData.size() >= sampleCount) {
        chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * LIGHT_SAMPLE_PERIOD));
        sampleCount++;
      }
      chartData.addEntry(new Entry(data.value(Float.class),sampleCount),1);
    }
));
  }
).continueWith(task -> {
    altitudeRoute=task.getResult();
    barometer.altitude().start();
    barometer.pressure().start();
    barometer.start();
    return null;
  }
);
}

Fixed version (ground truth):
@Override protected void setup(){
  barometer.configure().pressureOversampling(OversamplingMode.ULTRA_HIGH).filterCoeff(FilterCoeff.OFF).standbyTime(0.5f).commit();
  barometer.pressure().addRouteAsync(source -> source.stream((data,env) -> {
    LineData chartData=chart.getData();
    if (pressureData.size() >= sampleCount) {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * LIGHT_SAMPLE_PERIOD));
      sampleCount++;
      updateChart();
    }
    chartData.addEntry(new Entry(data.value(Float.class),sampleCount),0);
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return barometer.altitude().addRouteAsync(source -> source.stream((data,env) -> {
      LineData chartData=chart.getData();
      if (altitudeData.size() >= sampleCount) {
        chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * LIGHT_SAMPLE_PERIOD));
        sampleCount++;
        updateChart();
      }
      chartData.addEntry(new Entry(data.value(Float.class),sampleCount),1);
    }
));
  }
).continueWith(task -> {
    altitudeRoute=task.getResult();
    barometer.altitude().start();
    barometer.pressure().start();
    barometer.start();
    return null;
  }
);
}
Program: 22535
Project: 22535
Buggy source:
@Override protected void setup(){
  ForcedDataProducer colorAdc=colorDetector.adc();
  colorDetector.configure().gain(Gain.values()[rangeIndex]).commit();
  colorAdc.addRouteAsync(source -> source.stream((data,env) -> {
    LineData chartData=chart.getData();
    if (startTime == -1) {
      chartData.addXValue("String_Node_Str");
      startTime=System.currentTimeMillis();
    }
 else {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",(sampleCount * COLOR_SAMPLE_PERIOD) / 1000.f));
    }
    ColorAdc adc=data.value(ColorAdc.class);
    chartData.addEntry(new Entry(adc.clear,sampleCount),0);
    chartData.addEntry(new Entry(adc.red,sampleCount),1);
    chartData.addEntry(new Entry(adc.green,sampleCount),2);
    chartData.addEntry(new Entry(adc.blue,sampleCount),3);
    sampleCount++;
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return timerModule.scheduleAsync(COLOR_SAMPLE_PERIOD,false,colorAdc::read);
  }
).continueWith(task -> {
    scheduledTask=task.getResult();
    scheduledTask.start();
    return null;
  }
);
}

Fixed version (ground truth):
@Override protected void setup(){
  ForcedDataProducer colorAdc=colorDetector.adc();
  colorDetector.configure().gain(Gain.values()[rangeIndex]).commit();
  colorAdc.addRouteAsync(source -> source.stream((data,env) -> {
    LineData chartData=chart.getData();
    if (startTime == -1) {
      chartData.addXValue("String_Node_Str");
      startTime=System.currentTimeMillis();
    }
 else {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",(sampleCount * COLOR_SAMPLE_PERIOD) / 1000.f));
    }
    ColorAdc adc=data.value(ColorAdc.class);
    chartData.addEntry(new Entry(adc.clear,sampleCount),0);
    chartData.addEntry(new Entry(adc.red,sampleCount),1);
    chartData.addEntry(new Entry(adc.green,sampleCount),2);
    chartData.addEntry(new Entry(adc.blue,sampleCount),3);
    sampleCount++;
    updateChart();
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return timerModule.scheduleAsync(COLOR_SAMPLE_PERIOD,false,colorAdc::read);
  }
).continueWith(task -> {
    scheduledTask=task.getResult();
    scheduledTask.start();
    return null;
  }
);
}
Program: 22536
Project: 22536
Buggy source:
@Override protected void setup(){
  Range[] values=Range.values();
  gyro.configure().odr(OutputDataRate.ODR_25_HZ).range(values[values.length - rangeIndex - 1]).commit();
  final float period=1 / GYR_ODR;
  final AsyncDataProducer producer=gyro.packedAngularVelocity() == null ? gyro.packedAngularVelocity() : gyro.angularVelocity();
  producer.addRouteAsync(source -> source.stream((data,env) -> {
    final AngularVelocity value=data.value(AngularVelocity.class);
    addChartData(value.x(),value.y(),value.z(),period);
  }
)).continueWith(task -> {
    streamRoute=task.getResult();
    gyro.angularVelocity().start();
    gyro.start();
    return null;
  }
);
}

Fixed version (ground truth):
@Override protected void setup(){
  Range[] values=Range.values();
  gyro.configure().odr(OutputDataRate.ODR_25_HZ).range(values[values.length - rangeIndex - 1]).commit();
  final float period=1 / GYR_ODR;
  final AsyncDataProducer producer=gyro.packedAngularVelocity() == null ? gyro.packedAngularVelocity() : gyro.angularVelocity();
  producer.addRouteAsync(source -> source.stream((data,env) -> {
    final AngularVelocity value=data.value(AngularVelocity.class);
    addChartData(value.x(),value.y(),value.z(),period);
    updateChart();
  }
)).continueWith(task -> {
    streamRoute=task.getResult();
    gyro.angularVelocity().start();
    gyro.start();
    return null;
  }
);
}
Program: 22537
Project: 22537
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
switch (id) {
case R.id.action_reset:
    mwBoard.getModule(Debug.class).resetAsync().continueWith(ignored -> {
      attemptReconnect(0);
      return null;
    }
);
  Snackbar.make(findViewById(R.id.drawer_layout),R.string.message_soft_reset,Snackbar.LENGTH_LONG).show();
return true;
case R.id.action_disconnect:
mwBoard.getModule(Settings.class).editBleConnParams().maxConnectionInterval(125f).commit();
mwBoard.disconnectAsync();
finish();
return true;
case R.id.action_manual_dfu:
if (checkLocationPermission()) {
startContentSelectionIntent();
}
break;
}
return super.onOptionsItemSelected(item);
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  int id=item.getItemId();
switch (id) {
case R.id.action_reset:
    if (!mwBoard.inMetaBootMode()) {
      mwBoard.getModule(Debug.class).resetAsync().continueWith(ignored -> {
        attemptReconnect(0);
        return null;
      }
);
      Snackbar.make(findViewById(R.id.drawer_layout),R.string.message_soft_reset,Snackbar.LENGTH_LONG).show();
    }
 else {
      Snackbar.make(findViewById(R.id.drawer_layout),R.string.message_no_soft_reset,Snackbar.LENGTH_LONG).show();
    }
  return true;
case R.id.action_disconnect:
if (!mwBoard.inMetaBootMode()) {
  Settings.BleConnectionParametersEditor editor=mwBoard.getModule(Settings.class).editBleConnParams();
  if (editor != null) {
    editor.maxConnectionInterval(125f).commit();
  }
  mwBoard.getModule(Debug.class).disconnectAsync();
}
 else {
  mwBoard.disconnectAsync();
}
finish();
return true;
case R.id.action_manual_dfu:
if (checkLocationPermission()) {
startContentSelectionIntent();
}
break;
}
return super.onOptionsItemSelected(item);
}
Program: 22538
Project: 22538
Buggy source:
@Override protected void setup(){
  ForcedDataProducer proximityAdc=proximity.adc();
  proximity.configure().transmitterDriveCurrent(TransmitterDriveCurrent.CURRENT_12_5MA).commit();
  proximityAdc.addRouteAsync(source -> source.stream((data,env) -> {
    LineData chartData=chart.getData();
    if (startTime == -1) {
      chartData.addXValue("String_Node_Str");
      startTime=System.currentTimeMillis();
    }
 else {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplingPeriod));
    }
    chartData.addEntry(new Entry(data.value(Integer.class),sampleCount),0);
    sampleCount++;
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return timer.scheduleAsync(PROXIMITY_SAMPLE_PERIOD,false,proximityAdc::read);
  }
).continueWith(task -> {
    scheduledTask=task.getResult();
    scheduledTask.start();
    return null;
  }
);
}

Fixed version (ground truth):
@Override protected void setup(){
  ForcedDataProducer proximityAdc=proximity.adc();
  proximity.configure().transmitterDriveCurrent(TransmitterDriveCurrent.CURRENT_12_5MA).commit();
  proximityAdc.addRouteAsync(source -> source.stream((data,env) -> {
    LineData chartData=chart.getData();
    if (startTime == -1) {
      chartData.addXValue("String_Node_Str");
      startTime=System.currentTimeMillis();
    }
 else {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplingPeriod));
    }
    chartData.addEntry(new Entry(data.value(Integer.class),sampleCount),0);
    sampleCount++;
    updateChart();
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return timer.scheduleAsync(PROXIMITY_SAMPLE_PERIOD,false,proximityAdc::read);
  }
).continueWith(task -> {
    scheduledTask=task.getResult();
    scheduledTask.start();
    return null;
  }
);
}
Program: 22539
Project: 22539
Buggy source:
static void setConnInterval(Settings settings){
  Settings.BleConnectionParametersEditor editor=settings.editBleConnParams();
  if (editor != null) {
    editor.maxConnectionInterval(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? 11.25f : 7.5f).commit();
  }
}

Fixed version (ground truth):
static void setConnInterval(Settings settings){
  if (settings != null) {
    Settings.BleConnectionParametersEditor editor=settings.editBleConnParams();
    if (editor != null) {
      editor.maxConnectionInterval(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? 11.25f : 7.5f).commit();
    }
  }
}
Program: 22540
Project: 22540
Buggy source:
private void moveViewToLast(){
  chart.setVisibleXRangeMinimum(120);
  chart.setVisibleXRangeMaximum(120);
  chart.moveViewToX(Math.max(0f,chartXValues.size()));
}

Fixed version (ground truth):
private void moveViewToLast(){
  chart.setVisibleXRangeMinimum(120);
  chart.setVisibleXRangeMaximum(120);
  chart.moveViewToX(Math.max(0f,chartXValues.size() - 1));
}
Program: 22543
Project: 22543
Buggy source:
@Override protected void setup(){
  Temperature.Sensor tempSensor=tempModule.sensors()[selectedSourceIndex];
  if (tempSensor.type() == SensorType.EXT_THERMISTOR) {
    ((Temperature.ExternalThermistor)tempModule.sensors()[selectedSourceIndex]).configure(gpioDataPin,gpioPulldownPin,activeHigh);
  }
  tempSensor.addRouteAsync(source -> source.stream((data,env) -> {
    final Float celsius=data.value(Float.class);
    LineData chartData=chart.getData();
    if (startTime == -1) {
      chartData.addXValue("String_Node_Str");
      startTime=System.currentTimeMillis();
    }
 else {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplingPeriod));
    }
    chartData.addEntry(new Entry(celsius,sampleCount),0);
    sampleCount++;
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return timerModule.scheduleAsync(TEMP_SAMPLE_PERIOD,false,tempSensor::read);
  }
).continueWithTask(task -> {
    scheduledTask=task.getResult();
    scheduledTask.start();
    return null;
  }
);
}

Fixed version (ground truth):
@Override protected void setup(){
  Temperature.Sensor tempSensor=tempModule.sensors()[selectedSourceIndex];
  if (tempSensor.type() == SensorType.EXT_THERMISTOR) {
    ((Temperature.ExternalThermistor)tempModule.sensors()[selectedSourceIndex]).configure(gpioDataPin,gpioPulldownPin,activeHigh);
  }
  tempSensor.addRouteAsync(source -> source.stream((data,env) -> {
    final Float celsius=data.value(Float.class);
    LineData chartData=chart.getData();
    if (startTime == -1) {
      chartData.addXValue("String_Node_Str");
      startTime=System.currentTimeMillis();
    }
 else {
      chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplingPeriod));
    }
    chartData.addEntry(new Entry(celsius,sampleCount),0);
    sampleCount++;
    updateChart();
  }
)).continueWithTask(task -> {
    streamRoute=task.getResult();
    return timerModule.scheduleAsync(TEMP_SAMPLE_PERIOD,false,tempSensor::read);
  }
).continueWithTask(task -> {
    scheduledTask=task.getResult();
    scheduledTask.start();
    return null;
  }
);
}
Program: 22544
Project: 22544
Buggy source:
protected void addChartData(float x0,float x1,float x2,float samplePeriod){
  LineData chartData=chart.getData();
  chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplePeriod));
  chartData.addEntry(new Entry(x0,sampleCount),0);
  chartData.addEntry(new Entry(x1,sampleCount),1);
  chartData.addEntry(new Entry(x2,sampleCount),2);
  sampleCount++;
}

Fixed version (ground truth):
protected void addChartData(float x0,float x1,float x2,float samplePeriod){
  LineData chartData=chart.getData();
  chartData.addXValue(String.format(Locale.US,"String_Node_Str",sampleCount * samplePeriod));
  chartData.addEntry(new Entry(x0,sampleCount),0);
  chartData.addEntry(new Entry(x1,sampleCount),1);
  chartData.addEntry(new Entry(x2,sampleCount),2);
  sampleCount++;
  updateChart();
}
Program: 22545
Project: 22545
Buggy source:
/** 
 * Returns <code>true</code> if the EObject is a Dart class.
 * @param eObject The EObject
 * @return <code>true</code> if the EObject is a Dart class
 */
public boolean isStrictlyClass(EObject eObject){
  return eObject instanceof Class && "String_Node_Str".equals(eObject.getClass().getName());
}

Fixed version (ground truth):
/** 
 * Returns <code>true</code> if the EObject is a Dart class.
 * @param eObject The EObject
 * @return <code>true</code> if the EObject is a Dart class
 */
public boolean isStrictlyClass(EObject eObject){
  return eObject instanceof Class && "String_Node_Str".equals(eObject.getClass().getSimpleName());
}
Program: 22547
Project: 22547
Buggy source:
public static void main(String[] arg){
  LwjglApplicationConfiguration config=new LwjglApplicationConfiguration();
  new LwjglApplication(new Bouncy(),config);
}

Fixed version (ground truth):
public static void main(String[] arg){
  LwjglApplicationConfiguration config=new LwjglApplicationConfiguration();
  config.title="String_Node_Str";
  config.width=480;
  config.height=800;
  new LwjglApplication(new Bouncy(),config);
}
Program: 22548
Project: 22548
Buggy source:
public FreeMarkerOnlineView(FreeMarkerOnlineViewResultType resultType,String resultText,String template,String dataModel){
  super("String_Node_Str");
  Assert.notNull(resultType);
  this.resultType=resultType;
  this.result=decorateResultText(resultText,resultType);
  this.template=template;
  this.dataModel=dataModel;
}

Fixed version (ground truth):
public FreeMarkerOnlineView(FreeMarkerOnlineViewResultType resultType,String resultText,String template,String dataModel){
  super("String_Node_Str",Charset.forName("String_Node_Str"));
  Assert.notNull(resultType);
  this.resultType=resultType;
  this.result=decorateResultText(resultText,resultType);
  this.template=template;
  this.dataModel=dataModel;
}
Program: 22549
Project: 22549
Buggy source:
@Test public void testResultTruncation(){
  freeMarkerService.setOutputLengthLimit(4);
  FreeMarkerServiceResponse serviceResponse=freeMarkerService.calculateFreeMarkerTemplate(TRUNCATION_TEST_TEMPLATE,Collections.<String,String>emptyMap());
  assertThat(serviceResponse.isSucceed(),is(true));
  assertThat(serviceResponse.isResultTruncated(),is(true));
  assertThat(serviceResponse.getResult(),startsWith(TRUNCATION_TEST_TEMPLATE.substring(0,freeMarkerService.getOutputLengthLimit())));
  assertThat(serviceResponse.getResult().charAt(freeMarkerService.getOutputLengthLimit()),not(equalTo(TRUNCATION_TEST_TEMPLATE.charAt(freeMarkerService.getOutputLengthLimit()))));
}

Fixed version (ground truth):
@Test public void testResultTruncation(){
  freeMarkerService.setOutputLengthLimit(4);
  FreeMarkerServiceResponse serviceResponse=freeMarkerService.calculateFreeMarkerTemplate(TRUNCATION_TEST_TEMPLATE,Collections.<String,String>emptyMap());
  assertThat(serviceResponse.isSucceed(),is(true));
  assertThat(serviceResponse.isResultTruncated(),is(true));
  assertThat(serviceResponse.getResult().substring(0,freeMarkerService.getOutputLengthLimit()),equalTo(TRUNCATION_TEST_TEMPLATE.substring(0,freeMarkerService.getOutputLengthLimit())));
  assertThat(serviceResponse.getResult().charAt(freeMarkerService.getOutputLengthLimit()),not(equalTo(TRUNCATION_TEST_TEMPLATE.charAt(freeMarkerService.getOutputLengthLimit()))));
}
Program: 22550
Project: 22550
Buggy source:
/** 
 * Unregisters messageListener so that it will no longer receive   {@link QMessage}.
 * @param listener a  {@link QMessagesListener} to be unregistered
 */
public synchronized void removeMessagesListener(final QMessagesListener listener){
  messagesListeners.remove(listener);
}

Fixed version (ground truth):
/** 
 * Unregisters messageListener so that it will no longer receive   {@link QMessage}.
 * @param listener a  {@link QMessagesListener} to be unregistered
 */
public void removeMessagesListener(final QMessagesListener listener){
  messagesListeners.remove(listener);
}
Program: 22551
Project: 22551
Buggy source:
/** 
 * Registers messageListener so that it will receive   {@link QMessage} when data from kdb+ has been received.
 * @param listener a  {@link QMessagesListener} to be registered
 */
public synchronized void addMessagesListener(final QMessagesListener listener){
  messagesListeners.add(listener);
}

Fixed version (ground truth):
/** 
 * Registers messageListener so that it will receive   {@link QMessage} when data from kdb+ has been received.
 * @param listener a  {@link QMessagesListener} to be registered
 */
public void addMessagesListener(final QMessagesListener listener){
  messagesListeners.add(listener);
}
Program: 22552
Project: 22552
Buggy source:
private static synchronized DateFormat getDateformat(){
  return dateFormat;
}

Fixed version (ground truth):
private static DateFormat getDateformat(){
  return (DateFormat)dateFormat.clone();
}
Program: 22553
Project: 22553
Buggy source:
private static synchronized DateFormat getDateformat(){
  return dateFormat;
}

Fixed version (ground truth):
private static DateFormat getDateformat(){
  return (DateFormat)dateFormat.clone();
}
Program: 22554
Project: 22554
Buggy source:
/** 
 * Indicates whether some other object is "equal to" this dictionary.   {@link QDictionary} objects are consideredequal if the keys and values lists are equal for both instances.
 * @return <code>true</code> if this object is the same as the obj argument, <code>false</code> otherwise.
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof QDictionary)) {
    return false;
  }
  final QDictionary d=(QDictionary)obj;
  if (areValuesArray) {
    return Utils.deepArraysEquals(keys,d.keys) && Utils.deepArraysEquals(values,d.values);
  }
 else {
    return Utils.deepArraysEquals(keys,d.keys) && ((QTable)values).equals(d.values);
  }
}

Fixed version (ground truth):
/** 
 * Indicates whether some other object is "equal to" this dictionary.   {@link QDictionary} objects are consideredequal if the keys and values lists are equal for both instances.
 * @return <code>true</code> if this object is the same as the obj argument, <code>false</code> otherwise.
 * @see java.lang.Object#equals(java.lang.Object)
 */
@Override public boolean equals(final Object obj){
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof QDictionary)) {
    return false;
  }
  final QDictionary d=(QDictionary)obj;
  if (areValuesArray) {
    return Utils.deepArraysEquals(keys,d.keys) && Utils.deepArraysEquals(values,d.values);
  }
 else {
    return Utils.deepArraysEquals(keys,d.keys) && values.equals(d.values);
  }
}
Program: 22555
Project: 22555
Buggy source:
private static synchronized DateFormat getDateformat(){
  return dateFormat;
}

Fixed version (ground truth):
private static DateFormat getDateformat(){
  return (DateFormat)dateFormat.clone();
}
Program: 22556
Project: 22556
Buggy source:
private static synchronized NumberFormat getNanosformat(){
  return nanosFormatter;
}

Fixed version (ground truth):
private static NumberFormat getNanosformat(){
  return (NumberFormat)nanosFormatter.clone();
}
Program: 22557
Project: 22557
Buggy source:
private static synchronized DateFormat getDateformat(){
  return dateFormat;
}

Fixed version (ground truth):
private static DateFormat getDateformat(){
  return (DateFormat)dateFormat.clone();
}
Program: 22558
Project: 22558
Buggy source:
/** 
 * Returns a String that represents the current   {@link QTimespan}.
 * @return a String representation of the {@link QTimespan}
 * @see java.lang.Object#toString()
 */
@Override public String toString(){
  final Date dt=toDateTime();
  return dt == null ? NULL_STR : (value < 0 ? "String_Node_Str" : "String_Node_Str") + (Math.abs(value) / NANOS_PER_DAY) + getDateformat().format(dt)+ nanosFormatter.format(Math.abs(value) % NANOS_PER_SECOND);
}

Fixed version (ground truth):
/** 
 * Returns a String that represents the current   {@link QTimespan}.
 * @return a String representation of the {@link QTimespan}
 * @see java.lang.Object#toString()
 */
@Override public String toString(){
  final Date dt=toDateTime();
  return dt == null ? NULL_STR : (value < 0 ? "String_Node_Str" : "String_Node_Str") + (Math.abs(value) / NANOS_PER_DAY) + getDateformat().format(dt)+ getNanosformat().format(Math.abs(value) % NANOS_PER_SECOND);
}
Program: 22559
Project: 22559
Buggy source:
private static synchronized NumberFormat getNanosformat(){
  return nanosFormatter;
}

Fixed version (ground truth):
private static NumberFormat getNanosformat(){
  return (NumberFormat)nanosFormatter.clone();
}
Program: 22560
Project: 22560
Buggy source:
private static synchronized DateFormat getDateformat(){
  return dateFormat;
}

Fixed version (ground truth):
private static DateFormat getDateformat(){
  return (DateFormat)dateFormat.clone();
}
Program: 22561
Project: 22561
Buggy source:
/** 
 * Returns a String that represents the current   {@link QTimestamp}.
 * @return a String representation of the {@link QTimestamp}
 * @see java.lang.Object#toString()
 */
@Override public String toString(){
  final Date dt=toDateTime();
  return dt == null ? NULL_STR : getDateformat().format(dt) + nanosFormatter.format(value % NANOS_PER_SECOND);
}

Fixed version (ground truth):
/** 
 * Returns a String that represents the current   {@link QTimestamp}.
 * @return a String representation of the {@link QTimestamp}
 * @see java.lang.Object#toString()
 */
@Override public String toString(){
  final Date dt=toDateTime();
  return dt == null ? NULL_STR : getDateformat().format(dt) + getNanosformat().format(value % NANOS_PER_SECOND);
}
Program: 22562
Project: 22562
Buggy source:
public void writeLongBigEndian(final long value){
  final byte[] arr=new byte[]{(byte)((value >> 56) & 0xff),(byte)((value >> 48) & 0xff),(byte)((value >> 40) & 0xff),(byte)((value >> 32) & 0xff),(byte)((value >> 24) & 0xff),(byte)((value >> 16) & 0xff),(byte)((value >> 8) & 0xff),(byte)((value >> 0) & 0xff)};
  for (int i=0; i < arr.length; i++) {
    writeByte(arr[i]);
  }
}

Fixed version (ground truth):
public void writeLongBigEndian(final long value){
  final byte[] arr=new byte[]{(byte)((value >> 56) & 0xff),(byte)((value >> 48) & 0xff),(byte)((value >> 40) & 0xff),(byte)((value >> 32) & 0xff),(byte)((value >> 24) & 0xff),(byte)((value >> 16) & 0xff),(byte)((value >> 8) & 0xff),(byte)((value >> 0) & 0xff)};
  for (  byte anArr : arr) {
    writeByte(anArr);
  }
}
Program: 22563
Project: 22563
Buggy source:
static String arrayToString(final Object list){
  if (list == null || !list.getClass().isArray() || Array.getLength(list) == 0) {
    return "String_Node_Str";
  }
 else {
    final int length=Array.getLength(list);
    final StringBuffer buffer=new StringBuffer("String_Node_Str");
    Object obj=Array.get(list,0);
    buffer.append(obj == null ? null : obj.getClass().isArray() ? arrayToString(obj) : obj);
    for (int i=1; i < length; i++) {
      obj=Array.get(list,i);
      buffer.append("String_Node_Str");
      buffer.append(obj == null ? null : obj.getClass().isArray() ? arrayToString(obj) : obj);
    }
    buffer.append(']');
    return buffer.toString();
  }
}

Fixed version (ground truth):
static String arrayToString(final Object list){
  if (list == null || !list.getClass().isArray() || Array.getLength(list) == 0) {
    return "String_Node_Str";
  }
 else {
    final int length=Array.getLength(list);
    final StringBuilder buffer=new StringBuilder("String_Node_Str");
    Object obj=Array.get(list,0);
    buffer.append(obj == null ? null : obj.getClass().isArray() ? arrayToString(obj) : obj);
    for (int i=1; i < length; i++) {
      obj=Array.get(list,i);
      buffer.append("String_Node_Str");
      buffer.append(obj == null ? null : obj.getClass().isArray() ? arrayToString(obj) : obj);
    }
    buffer.append(']');
    return buffer.toString();
  }
}
Program: 22564
Project: 22564
Buggy source:
/** 
 * Create a directory and any nonexistent parents. Any portion of the directory tree can exist without error.
 * @param path The directory path to create
 * @param perms The permissions to apply to the created directories.
 * @return true if successful, false otherwise
 * @throws IOException if the path is a child of a file.
 */
@Override public boolean mkdirs(Path path,FsPermission perms) throws IOException {
  path=makeAbsolute(path);
  boolean result=false;
  try {
    ceph.mkdirs(path,(int)perms.toShort());
    result=true;
  }
 catch (  CephFileAlreadyExistsException e) {
    result=true;
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Create a directory and any nonexistent parents. Any portion of the directory tree can exist without error.  Apply umask from conf
 * @param f The directory path to create
 * @return true if successful, false otherwise
 * @throws IOException if the path is a child of a file.
 */
@Override public boolean mkdirs(Path f) throws IOException {
  return mkdirs(f,FsPermission.getDirDefault().applyUMask(FsPermission.getUMask(getConf())));
}
Program: 22565
Project: 22565
Buggy source:
private String pathString(Path path){
  return path.toUri().getPath();
}

Fixed version (ground truth):
private String pathString(Path path){
  if (null == path) {
    return "String_Node_Str";
  }
  return path.toUri().getPath();
}
Program: 22566
Project: 22566
Buggy source:
/** 
 * See MAPREDUCE-5902 for context on why this test is critical for ecosystem interoperability.
 */
@org.junit.Test public void testEncodedPaths() throws Exception {
  FileSystem fs2=fs;
  Path encodedFiles=new Path("String_Node_Str" + System.currentTimeMillis());
  fs2.mkdirs(encodedFiles);
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  Assert.assertEquals(5,fs2.listStatus(encodedFiles).length);
  fs2.delete(encodedFiles);
}

Fixed version (ground truth):
/** 
 * See MAPREDUCE-5902 for context on why this test is critical for ecosystem interoperability.
 */
@org.junit.Test public void testEncodedPaths() throws Exception {
  FileSystem fs2=fs;
  Path encodedFiles=new Path("String_Node_Str" + System.currentTimeMillis());
  fs2.mkdirs(encodedFiles);
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  fs2.create(new Path(encodedFiles,"String_Node_Str"));
  Assert.assertEquals(5,fs2.listStatus(encodedFiles).length);
  fs2.delete(encodedFiles,true);
}
Program: 22567
Project: 22567
Buggy source:
@Test public void testGlobStatusThrowsExceptionForNonExistentFile() throws Exception {
  try {
    fSys.globStatus(getTestRootPath(fSys,"String_Node_Str"));
  }
 catch (  FileNotFoundException fnfe) {
  }
}

Fixed version (ground truth):
@Test public void testGlobStatusThrowsExceptionForNonExistentFile() throws Exception {
  try {
    fSys.globStatus(getTestRootPath(fSys,"String_Node_Str"));
  }
 catch (  FileNotFoundException fnfe) {
  }
catch (  NullPointerException ne) {
  }
}
Program: 22568
Project: 22568
Buggy source:
@Test public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception {
  Path testDir=getTestRootPath(fSys,"String_Node_Str");
  Assert.assertFalse(exists(fSys,testDir));
  fSys.mkdirs(testDir);
  Assert.assertTrue(exists(fSys,testDir));
  createFile(getTestRootPath(fSys,"String_Node_Str"));
  Path testSubDir=getTestRootPath(fSys,"String_Node_Str");
  try {
    Assert.assertFalse(fSys.mkdirs(testSubDir));
  }
 catch (  FileAlreadyExistsException ex) {
  }
  Assert.assertFalse(exists(fSys,testSubDir));
  Path testDeepSubDir=getTestRootPath(fSys,"String_Node_Str");
  Assert.assertFalse(exists(fSys,testSubDir));
  try {
    Assert.assertFalse(fSys.mkdirs(testDeepSubDir));
  }
 catch (  FileAlreadyExistsException ex) {
  }
  Assert.assertFalse(exists(fSys,testDeepSubDir));
}

Fixed version (ground truth):
@Test public void testMkdirsFailsForSubdirectoryOfExistingFile() throws Exception {
  Path testDir=getTestRootPath(fSys,"String_Node_Str");
  Assert.assertFalse(exists(fSys,testDir));
  fSys.mkdirs(testDir);
  Assert.assertTrue(exists(fSys,testDir));
  createFile(getTestRootPath(fSys,"String_Node_Str"));
  Path testSubDir=getTestRootPath(fSys,"String_Node_Str");
  try {
    Assert.assertFalse(fSys.mkdirs(testSubDir));
  }
 catch (  IOException ex) {
  }
  Assert.assertFalse(exists(fSys,testSubDir));
  Path testDeepSubDir=getTestRootPath(fSys,"String_Node_Str");
  Assert.assertFalse(exists(fSys,testSubDir));
  try {
    Assert.assertFalse(fSys.mkdirs(testDeepSubDir));
  }
 catch (  IOException ex) {
  }
  Assert.assertFalse(exists(fSys,testDeepSubDir));
}
Program: 22569
Project: 22569
Buggy source:
public ArmorProperties getProperties(EntityLivingBase player,ItemStack armor,DamageSource source,double damage,int slot){
  ArmorProperties prop=new ArmorProperties(0,0.0,0);
  ItemBackpack backpack=(ItemBackpack)armor.getItem();
  prop.Armor=backpack.getArmorDamageReductionAmount(armor);
  prop.Toughness=backpack.getArmorToughness(armor);
  prop.AbsorbRatio=prop.Armor / 25.0;
  prop.AbsorbMax=armor.getMaxDamage() - armor.getItemDamage() + 1;
  return prop;
}

Fixed version (ground truth):
public ArmorProperties getProperties(EntityLivingBase player,ItemStack armor,DamageSource source,double damage,int slot){
  ArmorProperties prop=new ArmorProperties(0,0.0,0);
  ItemBackpack backpack=(ItemBackpack)armor.getItem();
  prop.Armor=backpack.getArmorDamageReductionAmount(armor);
  prop.Toughness=backpack.getArmorToughness(armor);
  prop.AbsorbRatio=prop.Armor / 25.0;
  prop.AbsorbMax=Math.max(1,armor.getMaxDamage() - armor.getItemDamage() + 1);
  return prop;
}
Program: 22570
Project: 22570
Buggy source:
@Override public void onPlacedInteract(EntityPlayer player,TileEntity tileEntity,IBackpack backpack){
  if (player.world.isRemote)   return;
  new ContainerBackpack(player,backpack){
    @Override public boolean canInteractWith(    EntityPlayer player){
      return (player.isEntityAlive() && !tileEntity.isInvalid() && (player.world.getTileEntity(tileEntity.getPos()) == tileEntity)&& (player.getDistanceSq(tileEntity.getPos()) <= 64));
    }
  }
.open();
}

Fixed version (ground truth):
@Override public void onPlacedInteract(EntityPlayer player,TileEntity tileEntity,IBackpack backpack){
  if (player.world.isRemote)   return;
  new ContainerBackpack(player,backpack){
    @Override public boolean canInteractWith(    EntityPlayer player){
      return player.isEntityAlive() && !tileEntity.isInvalid() && (player.world.getTileEntity(tileEntity.getPos()) == tileEntity)&& (player.getDistanceSq(tileEntity.getPos()) <= 64);
    }
  }
.open();
}
Program: 22571
Project: 22571
Buggy source:
@Override public void deserializeNBT(NBTTagCompound compound){
  backpack.stack=NbtUtils.readItem(compound.getCompoundTag(TAG_STACK));
  IBackpackType type;
  if (backpack.stack == null) {
    String typeString=compound.getString(TAG_TYPE);
    type=BackpackHelper.getBackpackType((typeString != null) ? Item.getByNameOrId(typeString) : null);
    backpack.lastType=type;
  }
 else   type=BackpackHelper.getBackpackType(backpack.stack);
  if (type == null) {
    WearableBackpacks.LOG.error("String_Node_Str");
    return;
  }
  backpack.data=type.createBackpackData();
  NBTBase dataTag=compound.getTag(TAG_DATA);
  if ((backpack.data != null) && (dataTag != null))   backpack.data.deserializeNBT(dataTag);
}

Fixed version (ground truth):
@Override public void deserializeNBT(NBTTagCompound compound){
  backpack.stack=NbtUtils.readItem(compound.getCompoundTag(TAG_STACK));
  IBackpackType type;
  if (backpack.stack == null) {
    if (!compound.hasKey(TAG_TYPE,NbtType.STRING))     return;
    String id=compound.getString(TAG_TYPE);
    backpack.lastType=type=BackpackHelper.getBackpackType(Item.REGISTRY.getObject(new ResourceLocation(id)));
    if (type == null)     return;
  }
 else   type=BackpackHelper.getBackpackType(backpack.stack);
  if (type == null) {
    WearableBackpacks.LOG.error("String_Node_Str");
    return;
  }
  backpack.data=type.createBackpackData();
  NBTBase dataTag=compound.getTag(TAG_DATA);
  if ((backpack.data != null) && (dataTag != null))   backpack.data.deserializeNBT(dataTag);
}
Program: 22573
Project: 22573
Buggy source:
private void attemptStopTransport(){
  try {
    transport.tell(PoisonPill.getInstance(),self());
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
private void attemptStopTransport(){
  try {
    if (connected)     transport.tell(PoisonPill.getInstance(),self());
  }
 catch (  Exception e) {
  }
}
Program: 22575
Project: 22575
Buggy source:
/** 
 * Locate the block of a string doing binary search.
 */
protected int locateBlock(CharSequence str){
  int low=0;
  int high=(int)blocks.getNumberOfElements() - 1;
  int max=high;
  while (low <= high) {
    int mid=(low + high) >>> 1;
    int cmp;
    if (max == high) {
      cmp=-1;
    }
 else {
      cmp=ByteStringUtil.strcmp(str,data[mid / BLOCK_PER_BUFFER],(int)(blocks.get(mid) - posFirst[mid / BLOCK_PER_BUFFER]));
    }
    if (cmp < 0) {
      high=mid - 1;
    }
 else     if (cmp > 0) {
      low=mid + 1;
    }
 else {
      return mid;
    }
  }
  return -(low + 1);
}

Fixed version (ground truth):
/** 
 * Locate the block of a string doing binary search.
 */
protected int locateBlock(CharSequence str){
  int low=0;
  int high=(int)blocks.getNumberOfElements() - 1;
  int max=high;
  while (low <= high) {
    int mid=(low + high) >>> 1;
    int cmp;
    if (mid == max) {
      cmp=-1;
    }
 else {
      cmp=ByteStringUtil.strcmp(str,data[mid / BLOCK_PER_BUFFER],(int)(blocks.get(mid) - posFirst[mid / BLOCK_PER_BUFFER]));
    }
    if (cmp < 0) {
      high=mid - 1;
    }
 else     if (cmp > 0) {
      low=mid + 1;
    }
 else {
      return mid;
    }
  }
  return -(low + 1);
}
Program: 22576
Project: 22576
Buggy source:
protected int locateInBlock(int blockid,CharSequence str){
  ReplazableString tempString=new ReplazableString();
  Mutable<Long> delta=new Mutable<Long>(0L);
  int idInBlock=0;
  int cshared=0;
  byte[] block=data[blockid / BLOCK_PER_BUFFER];
  int pos=(int)(blocks.get(blockid) - posFirst[blockid / BLOCK_PER_BUFFER]);
  int slen=ByteStringUtil.strlen(block,pos);
  tempString.append(block,pos,slen);
  pos+=slen + 1;
  idInBlock++;
  while ((idInBlock < blocksize) && (pos < block.length)) {
    pos+=VByte.decode(block,pos,delta);
    slen=ByteStringUtil.strlen(block,pos);
    tempString.replace(delta.getValue().intValue(),block,pos,slen);
    if (delta.getValue() >= cshared) {
      cshared+=ByteStringUtil.longestCommonPrefix(tempString,str,cshared);
      if ((cshared == str.length()) && (tempString.length() == str.length())) {
        break;
      }
    }
 else {
      idInBlock=0;
      break;
    }
    pos+=slen + 1;
    idInBlock++;
  }
  if (pos == block.length || idInBlock == blocksize) {
    idInBlock=0;
  }
  return idInBlock;
}

Fixed version (ground truth):
protected int locateInBlock(int blockid,CharSequence str){
  ReplazableString tempString=new ReplazableString();
  Mutable<Long> delta=new Mutable<Long>(0L);
  int idInBlock=0;
  int cshared=0;
  byte[] block=data[blockid / BLOCK_PER_BUFFER];
  int pos=(int)(blocks.get(blockid) - posFirst[blockid / BLOCK_PER_BUFFER]);
  int slen=ByteStringUtil.strlen(block,pos);
  tempString.append(block,pos,slen);
  pos+=slen + 1;
  idInBlock++;
  while ((idInBlock < blocksize) && (pos < block.length)) {
    pos+=VByte.decode(block,pos,delta);
    slen=ByteStringUtil.strlen(block,pos);
    tempString.replace(delta.getValue().intValue(),block,pos,slen);
    if (delta.getValue() >= cshared) {
      cshared+=ByteStringUtil.longestCommonPrefix(tempString,str,cshared);
      if ((cshared == str.length()) && (tempString.length() == str.length())) {
        return idInBlock;
      }
    }
 else {
      idInBlock=0;
      break;
    }
    pos+=slen + 1;
    idInBlock++;
  }
  if (pos == block.length || idInBlock == blocksize) {
    idInBlock=0;
  }
  return idInBlock;
}
Program: 22577
Project: 22577
Buggy source:
private void mapFiles(File f,long base) throws IOException {
  ch=new FileInputStream(f).getChannel();
  long maxSize=base + SequenceLog64.numBytesFor(numbits,numentries);
  int buffer=0;
  long block=0;
  buffers=new ByteBuffer[(int)(1L + numwords / LONGS_PER_BUFFER)];
  while (block < numwords) {
    long current=base + buffer * 8L * LONGS_PER_BUFFER;
    long next=current + 8L * LONGS_PER_BUFFER;
    long length=Math.min(maxSize,next) - current;
    buffers[buffer]=ch.map(MapMode.READ_ONLY,current,length);
    buffers[buffer].order(ByteOrder.LITTLE_ENDIAN);
    block+=LONGS_PER_BUFFER;
    buffer++;
  }
  CountInputStream in=new CountInputStream(new BufferedInputStream(new FileInputStream(f)));
  IOUtil.skip(in,base + ((numwords - 1) * 8L));
  int lastWordUsedBits=SequenceLog64.lastWordNumBits(numbits,numentries);
  lastword=BitUtil.readLowerBitsByteAligned(lastWordUsedBits,in);
  in.close();
}

Fixed version (ground truth):
private void mapFiles(File f,long base) throws IOException {
  ch=FileChannel.open(Paths.get(f.toString()));
  long maxSize=base + SequenceLog64.numBytesFor(numbits,numentries);
  int buffer=0;
  long block=0;
  buffers=new ByteBuffer[(int)(1L + numwords / LONGS_PER_BUFFER)];
  while (block < numwords) {
    long current=base + buffer * 8L * LONGS_PER_BUFFER;
    long next=current + 8L * LONGS_PER_BUFFER;
    long length=Math.min(maxSize,next) - current;
    buffers[buffer]=ch.map(MapMode.READ_ONLY,current,length);
    buffers[buffer].order(ByteOrder.LITTLE_ENDIAN);
    block+=LONGS_PER_BUFFER;
    buffer++;
  }
  CountInputStream in=new CountInputStream(new BufferedInputStream(new FileInputStream(f)));
  IOUtil.skip(in,base + ((numwords - 1) * 8L));
  int lastWordUsedBits=SequenceLog64.lastWordNumBits(numbits,numentries);
  lastword=BitUtil.readLowerBitsByteAligned(lastWordUsedBits,in);
  in.close();
}
Program: 22578
Project: 22578
Buggy source:
@Override public void close() throws IOException {
  ch.close();
}

Fixed version (ground truth):
@Override public void close() throws IOException {
  buffers=null;
  System.gc();
  ch.close();
}